Modifying meshgrid function

I have this piece of code regarding the meshgrid function that I want to modify it's output:

x_list = list(range(5))
y_list = list(range(2))
X, Y = meshgrid(x_list, y_list)

which prints out:

array([[0, 1, 2, 3, 4],
       [0, 1, 2, 3, 4]])


    Y = array([[0, 0, 0, 0, 0],
               [1, 1, 1, 1, 1]])

How can I modify my output to produce

    X = array([0,0,0,0,0],

and Y = array([0,1], [0,1], [0,1], [0,1], [0,1]]

instead? What I have in mind is something like this making X basically representing the x_axis values and Y the Y-axis values:

    03 13 23 33 43
    02 12 22 32 42
    01 11 21 31 41
    00 10 20 30 40

in the end I am doing something wrong I know it but I can't figure how to change the code in meshgrid in order to get me a normal x-y plane.


size= 4
X = np.array([np.zeros(size), np.ones(size)])
Y = X.copy().T

will get the output you want. But if you're using meshgrid, aren't you feeding functions that expect the format meshgrid produces?

Need Your Help

Counting, reversed bit pattern

algorithm bit-manipulation

I am trying to find an algorithm to count from 0 to 2n-1 but their bit pattern reversed. I care about only n LSB of a word. As you may have guessed I failed.

jQuery child of parent class change?

javascript jquery html css

I'm using FontAwesome, and have an icon within my accordion. So, I have a plus icon, and a minus icon. When the class becomes an 'active-header', then I want it to change the icon of that h2 only...