Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 9c704a2

Browse files
Update 3_Indexing.py
1 parent 72d1015 commit 9c704a2

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

‎NumPy/3_Indexing.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,7 @@
88
arr = np.array([[1,2,3,4,5], [6,7,8,9,10]])
99
print('2nd element on 1st dim: ', arr[0, 1]) #output 2nd element on 1st dim: 2
1010

11+
# Negative Indexing
12+
import numpy as np
13+
arr = np.array([[1,2,3,4,5], [6,7,8,9,10]])
14+
print('Last element from 2nd dim: ', arr[1, -1]) #output Last element from 2nd dim: 10

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /