C макет:
In [447]: np.arange(42).reshape(7,6)
Out[447]:
array([[ 0, 1, 2, 3, 4, 5],
[ 6, 7, 8, 9, 10, 11],
[12, 13, 14, 15, 16, 17],
[18, 19, 20, 21, 22, 23],
[24, 25, 26, 27, 28, 29],
[30, 31, 32, 33, 34, 35],
[36, 37, 38, 39, 40, 41]])
In [448]: np.unravel_index([31, 41, 13], (7,6), order='C')
Out[448]: (array([5, 6, 2]), array([1, 5, 1]))
F макет:
In [450]: np.arange(42).reshape(7,6,order='F')
Out[450]:
array([[ 0, 7, 14, 21, 28, 35],
[ 1, 8, 15, 22, 29, 36],
[ 2, 9, 16, 23, 30, 37],
[ 3, 10, 17, 24, 31, 38],
[ 4, 11, 18, 25, 32, 39],
[ 5, 12, 19, 26, 33, 40],
[ 6, 13, 20, 27, 34, 41]])
In [451]: np.unravel_index([31, 41, 13], (7,6), order='F')
Out[451]: (array([3, 6, 6]), array([4, 5, 1]))