# Python NumPy Tutorial for Beginners

///Python NumPy Tutorial for Beginners

## Python NumPy Tutorial for Beginners

Learn the basics of the NumPy library in this tutorial for beginners. It provides background information on how NumPy works and how it compares to Python’s Built-in lists. This video goes through how to write code with NumPy. It starts with the basics of creating arrays and then gets into more advanced stuff. The video covers creating arrays, indexing, math, statistics, reshaping, and more.

💻 Code:

🎥 Tutorial from Keith Galli. Check out his YouTube channel:

⭐️ Course Contents ⭐️
⌨️ (01:15) What is NumPy
⌨️ (01:35) NumPy vs Lists (speed, functionality)
⌨️ (09:17) Applications of NumPy
⌨️ (11:08) The Basics (creating arrays, shape, size, data type)
⌨️ (16:08) Accessing/Changing Specific Elements, Rows, Columns, etc (slicing)
⌨️ (23:14) Initializing Different Arrays (1s, 0s, full, random, etc…)
⌨️ (31:34) Problem #1 (How do you initialize this array?)
⌨️ (33:42) Be careful when copying variables!
⌨️ (35:45) Basic Mathematics (arithmetic, trigonometry, etc.)
⌨️ (38:20) Linear Algebra
⌨️ (42:19) Statistics
⌨️ (43:57) Reorganizing Arrays (reshape, vstack, hstack)
⌨️ (47:29) Load data in from a file
⌨️ (55:59) Problem #2 (How do you index these values?)

🔗 NumPy vs Lists:
🔗 Indexing:
🔗 Array Creation Routines:
🔗 Math Routines Docs:
🔗 Linear Algebra Docs:

Read hundreds of articles on programming:

And subscribe for new videos on technology every day:

source

By |2021-07-17T15:10:14+00:00July 17th, 2021|Python Video Tutorials|33 Comments

1. Keith Galli July 17, 2021 at 3:10 pm - Reply

Hope you all enjoyed! And thanks for sharing FreeCodeCamp! Check out my channel for more Python & Data Science videos 🙂

Also I mention that a full video timeline is in the comments, that can actually be found under the video description.

2. q zorn July 17, 2021 at 3:10 pm - Reply

last time i smashed the button i had to get a new keyboard! Mmmm…:/ thanks a lot and great video…:)

3. lou Naguez July 17, 2021 at 3:10 pm - Reply

this was my solution
one=np.ones(5)
x=np.asmatrix(one)
matrix=np.repeat(x,5,axis=0)
matrix[1:-1,1:-1]=0
matrix[2,2]=9

4. achintha isuru July 17, 2021 at 3:10 pm - Reply

For the part in 35:10,

It is happening because Lists / Arrays are
mutable by nature. This means once you created them you cannot change it.

5. Epsilonator July 17, 2021 at 3:10 pm - Reply

I did the matrix exercise a bit differently:

arr = np.ones((5, 5))

arr[1:-1, 1:-1] = np.zeros((3, 3))

arr[2, 2] = 9

6. meher shrishti nigam July 17, 2021 at 3:10 pm - Reply

a = np.array([[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]])
b = np.array([])

for i in range(4):

b = np.append(b,a[i,i+1])

print(b)

This also worked for the second problem at the end, but the numbers were floats

[ 2. 8. 14. 20.]

7. meher shrishti nigam July 17, 2021 at 3:10 pm - Reply

filedata = np.genfromtxt('data.txt', delimiter=',') is showing "IOError ("%s not found." % path)

OSError: data.txt not found" for me, I have created a data.txt file in the same folder in which I'm running my python script (using vscode). What am I doing wrong?

8. meher shrishti nigam July 17, 2021 at 3:10 pm - Reply

224 bits to store a 5 in a list!?☻

9. Sneha July 17, 2021 at 3:10 pm - Reply

Wonderful tutorial! I've shared it to friends

10. Salman Alsaffar July 17, 2021 at 3:10 pm - Reply

I am learning numpy but still dont know whats the point with it

11. Kal July 17, 2021 at 3:10 pm - Reply

I am gonna burp u like a bby

12. Vincent Blaze July 17, 2021 at 3:10 pm - Reply

You could at least try to show some interest. Felt like watching a zombie speak

13. Announcer July 17, 2021 at 3:10 pm - Reply

Thanks for everything big man

14. Mohammed umar Farhan July 17, 2021 at 3:10 pm - Reply

May God bless you mate

15. Majid Howsawi July 17, 2021 at 3:10 pm - Reply

just amazing

16. suraj gupta July 17, 2021 at 3:10 pm - Reply

20.50, I, think something is wrong in it.
[:, 2] = 5 doesn't changed in every row

17. Bruno Araújo July 17, 2021 at 3:10 pm - Reply

AWESOME video!!!

18. Rohan Kandra July 17, 2021 at 3:10 pm - Reply

We can also solve the exercise at 33' using
output = np.ones((5,5))

print(output)
output[1:4,1:4]=0

print(output)
output[2,2]=9

print(output)

19. Mohan PAKALAPATI July 17, 2021 at 3:10 pm - Reply

Could you please clarify below points?

Why NumPy is not having Objective value, I think everything in python is an object?
Why NumPy doesn't have object type?
Why NumPy doesn't have references count?
I think size of NumPy is homogeneous data, it can be int8….

20. Neethin Nandakumar July 17, 2021 at 3:10 pm - Reply

The cooking sounds making me hungry :). Great video

21. Ayush Agrawal July 17, 2021 at 3:10 pm - Reply

31:50

q = np.ones((5,5),dtype='int8')

q[1:4, 1:-1:1],q[2,2] = 0,9

22. Robert Alvarado Lugo July 17, 2021 at 3:10 pm - Reply

Thanks sir

23. S K July 17, 2021 at 3:10 pm - Reply

Absolute clarity and upto speed. Very comprehensive coverage.

24. The Soulful Reincarnation July 17, 2021 at 3:10 pm - Reply

Thank you for the lesson

25. Александр July 17, 2021 at 3:10 pm - Reply

Thank you! The only thing was a little bit complicated to me is working with axis. None the less, great tutorial!

26. YASH LEGEND July 17, 2021 at 3:10 pm - Reply
27. Cyber Pirate July 17, 2021 at 3:10 pm - Reply

Watched it in 1.5x Speed lol

28. Santosh Shriyan July 17, 2021 at 3:10 pm - Reply

Even OpenCV a top choice among computer vision professionals uses numpy array to store the image data….
Basically if you know how to manipulate numpy array you can do fine / pixel level operations…

29. Tony Stark July 17, 2021 at 3:10 pm - Reply

i figured that this video seems better at speed 1.5x

30. Vincent Valdinata July 17, 2021 at 3:10 pm - Reply

THANK YOU SO MUCH

31. Vaibhavi krishna siva July 17, 2021 at 3:10 pm - Reply

God own child

32. Emambucus Sohail July 17, 2021 at 3:10 pm - Reply
33. AASHI JAIN July 17, 2021 at 3:10 pm - Reply

Arr=numpy.arr["array",5,5.6]
What is the dtype of this arr and why??