Created
August 12, 2020 19:07
-
-
Save KenoLeon/80e468e794f6f49e6ae43947b262ca9b to your computer and use it in GitHub Desktop.
Simple Selection Numpy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| randomNumbers = np.array([0, 15, 30, 45, 60]) | |
| # Append : | |
| randomNumbers = np.append(randomNumbers, [10], axis=0) | |
| # >>> [ 0 15 30 45 60 10] | |
| # Insert: | |
| randomNumbers = np.insert(randomNumbers, 2, 5) | |
| # >>> [ 0 15 5 30 45 60 10] | |
| # Delete by position: | |
| randomNumbers = np.delete(randomNumbers, 2, 0) | |
| # >>> [ 0 15 30 45 60 10] | |
| # Get N element: | |
| randomNumber = randomNumbers[2] | |
| # >>> 30 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment