0

i have the following numpy array extracted from a dataframe that i want to reshape

Extraction

x = c_df['x'].values
y = c_df['y'].values
z = c_df['z'].values

convert to array

x_y_z = np.array([x, y, z])
x_y_z

Array looks like this

array([[748260.27757, 748262.56478, 748263.52455, ..., 730354.86406,
        730374.75   , 730388.45066],
       [333346.25   , 333308.43521, 333296.25   , ..., 331466.13593,
        331453.84365, 331446.25   ],
       [  2840.     ,   2840.     ,   2840.     , ...,   2400.     ,
          2400.     ,   2400.     ]])

basically i want to reshape it to be able to plot using plt.contourf which required Z to be 2D array

so i assume the array needs to be reshaped to something like

 YYYYYYYYYY
Xzzzzzzzzzz
Xzzzzzzzzzz
Xzzzzzzzzzz
Xzzzzzzzzzz

is my assumption correct? if yes how to reshape the array.

1 Answers1

0

If I understand you correctly Numpy Mgrid should be able to help you. However you might want some more explanation which can be found on this thread.

For the next time you can make it easier if you provide a simplified example of your problem.

Dharman
  • 30,962
  • 25
  • 85
  • 135