![]() |
help creating an array - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: help creating an array (/thread-36295.html) |
help creating an array - jenya56 - Feb-05-2022 I have a question. I have a dataframe in format ['x','y','z']. The columns have 100 values in them. I also have created a regular grid in the following manner. extent = x_min, x_max, y_min, y_max = [df.x.min()-100, df.x.max()+100, df.y.min()-100, df.y.max()+100] grid_x, grid_y = np.mgrid[x_min:x_max:100, y_min:y_max:100]Now question: I would like to create a an array of 100x100 where it is filled with NaNs if the point is not on the grid. And it should equal to z value if the point 'x' 'y' is found in my dataframe. Any suggestions? Thank you! |