Hi
In Python, starting indexes from 0 (it has been the choice of Guido Van Rossum from what I read some time ago, but it's confusing compare to Matlab or Julia for example) and it leads to some quirkinesses, but maybe I'm doing wrong and that's why more experienced people may give me/us a more relevant method.
Some practical examples and my understanding:
Is there another (relevant) way to proceed?
(of course I did some searches on internet, but that's the only I've found so far)
Thanks for your feedback
Paul
In Python, starting indexes from 0 (it has been the choice of Guido Van Rossum from what I read some time ago, but it's confusing compare to Matlab or Julia for example) and it leads to some quirkinesses, but maybe I'm doing wrong and that's why more experienced people may give me/us a more relevant method.
Some practical examples and my understanding:
1 2 3 4 5 6 7 |
## array copy B1 = np.copy(A[ 3 :, :]); # here all the lines fron the 3rd up the last one are taken into account B2 = np.copy(A[ 3 : - 1 , :]); # as usually in python the last index is not included in the list ## now the goal is to delete the last column/row => "-1" is used C = np.delete(A, - 1 , axis = 1 ); # the last column is removed D = np.delete(A, - 1 , axis = 0 ); # ditto for the last row |
(of course I did some searches on internet, but that's the only I've found so far)
Thanks for your feedback
Paul