Learn to add and/or remove elements from NumPy arrays in this video tutorial by Charles Kelly. These are explained in the context of computer science and data science to technologists and students in preparation for machine learning, applied statistics, n
- [Instructor] The adding and removing elements file…in your exercises file folder…includes a NumPy import statement,…as well as an array named a,…that has been initialized with 24 elements.…In this video, I'll explain NumPy functions…for adding elements to an array,…horizontally stacking arrays, vertically stacking arrays,…and inserting and deleting elements from an array.…Before you begin using this notebook,…go to the Cell menu, select Run All.…
The first thing that we'll learn to do…is use NumPy's append function.…Let's create an array named b,…and assign it the value of numpy.append.…We'll use a as the first parameter,…and to a, we'll append a Python list…that contains the values 5, 6, 7, and 8.…If we examine b, it contains the values 1 through 23,…plus 5, 6, 7, and 8, which we just appended.…
Let's examine the shape of b.…Here, we see it's a one dimensional array…that contains 28 elements.…This makes sense, because a has 24 elements,…we added four additional elements,…and therefore, the total is 28 elements.…
- Using Jupyter Notebook
- Creating NumPy arrays from Python structures
- Slicing arrays
- Using Boolean masking and broadcasting techniques
- Plotting in Jupyter notebooks
- Joining and splitting arrays
- Rearranging array elements
- Creating universal functions
- Finding patterns
- Building magic squares and magic cubes with NumPy and Python
Skill Level Intermediate
2. Create NumPy Arrays
3. Index, Slice, and Iterate
4. Plots: Matplotlib and Pyplot
5. Manipulate Arrays
6. Short Examples
7. Extended Examples
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.