Answers for "numpy 2d array meshgrid"

0

numpy 2d array meshgrid

>>> import numpy as np
>>> i_coords, j_coords = np.meshgrid(range(5), range(4), indexing='ij')
>>> i_coords
array([[0, 0, 0, 0],
       [1, 1, 1, 1],
       [2, 2, 2, 2],
       [3, 3, 3, 3],
       [4, 4, 4, 4]])
>>> j_coords
array([[0, 1, 2, 3],
       [0, 1, 2, 3],
       [0, 1, 2, 3],
       [0, 1, 2, 3],
       [0, 1, 2, 3]])
Posted by: Guest on September-23-2021

Python Answers by Framework

Browse Popular Code Answers by Language