0% found this document useful (0 votes)
2 views2 pages

NumPy Guide: From Basics to Advanced

Uploaded by

G.Vineela Reddy
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

NumPy Guide: From Basics to Advanced

Uploaded by

G.Vineela Reddy
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

NumPy Complete Guide: Basics to Advanced

1. Introduction
NumPy is a numerical computing library used for fast array operations, linear algebra, statistics,
and more.

2. Creating Arrays
[Link]([1,2,3])
[Link](5)
[Link]((2,3))
[Link]((2,3),7)
[Link](1,10,2)
[Link](1,5,10)

3. Array Attributes
shape, ndim, dtype, size, itemsize

4. Indexing & Slicing


arr[0], arr[2:5], arr[::-1]
2D: mat[1,2], mat[:,1], mat[0:2,1:3]

5. Operations
Arithmetic, comparison, [Link](), sum(), mean(), min(), max(), std(), var()

6. Broadcasting
Array operations on different shapes automatically align dimensions.

7. Reshaping
reshape(), ravel(), flatten(), transpose, expand_dims, squeeze

8. Joining & Splitting


concatenate, vstack, hstack, split vs array_split

9. Iteration
nditer(), ndenumerate()

10. Math Functions


sqrt, log, exp, sin, cos

11. Searching
[Link](), [Link]()

12. Sorting
[Link](), [Link]()

13. Random Module


rand, randint, randn, shuffle, choice

14. Linear Algebra


dot, matmul, determinant, inverse, eigenvalues
15. Advanced Indexing
Boolean & integer indexing

16. File I/O


save(), load(), savez()

Practice Questions
1. Create a 3x3 matrix and find its transpose.
2. Generate random numbers between 1–100 (size=10) and sort them.
3. Explain broadcasting with an example.
4. Differentiate reshape(), ravel(), flatten().
5. Use searchsorted() to find positions in a sorted array.

Solutions:
1. arr.T
2. [Link]([Link](1,100,10))
3. A + b where A is 2D and b is 1D
4. reshape=changes shape, ravel=view, flatten=copy
5. [Link](arr, value)

You might also like