numpy

plot of two variables python

I need to plot two variables a on y axis and b on x axis:
a = np.linspace(0, 100, 20,endpoint=False)
print(a) #type <class ‘numpy.ndarray’>
[ 0. 5. 10. 15. 20. 25. 30. 35. 40. 45. 50. 55. 60. 65. 70. 75. 80. 85.
90. 95.]
b= consens…

Why 3d doesnt want ddtype?

when ı try to create a 2-D array using ndarray if I dont specify ddtype value it gives me error but when trying to create a 3-D one it doesn’t why, I mean is there a rule like that?
import numpy as np
array=np.array([[1,1,1,1,1,1],[1,1,2,1…

Numpy floor float values to int

I have array of floats, and I want to floor them to nearest integer, so I can use them as indices.
For example:
In [2]: import numpy as np

In [3]: arr = np.random.rand(1, 10) * 10

In [4]: arr
Out[4]:
array([[4.97896461, 0.21473121, 0.133…