TGViewer
Data Science & Machine Learning Data Science & Machine Learning @datasciencefun ยท 77.8K subscribers
Post #4104 4.6K
โœ… NumPy Basics ๐Ÿ๐Ÿ“Š

NumPy (Numerical Python) is the most important library for numerical computing in Python.

It is widely used in:
โœ” Data Science
โœ” Machine Learning
โœ” AI
โœ” Scientific computing

๐Ÿ”น 1. What is NumPy?

NumPy provides a powerful data structure called NumPy Array. It is faster and more efficient than Python lists for mathematical operations.

Example:
import numpy as np


๐Ÿ”น 2. Creating a NumPy Array

From a List

import numpy as np
arr = np.array([1, 2, 3, 4])
print(arr)


Output:
[1 2 3 4]


๐Ÿ”น 3. Check Array Type

print(type(arr))


Output:
<class 'numpy.ndarray'>


๐Ÿ”น 4. NumPy Array Operations

Addition:

import numpy as np
arr = np.array([1, 2, 3])
print(arr + 2)


Output:
[3 4 5]


Multiplication:
print(arr * 2)


Output:
[2 4 6]


๐Ÿ”น 5. NumPy Built-in Functions

arr = np.array([10, 20, 30, 40])
print(arr.sum())
print(arr.mean())
print(arr.max())
print(arr.min())


Output:
100
25.0
40
10


๐Ÿ”น 6. NumPy Array Shape

arr = np.array([[1, 2, 3], [4, 5, 6]])
print(arr.shape)


Output:
(2, 3)


Meaning: 2 rows and 3 columns.

๐Ÿ”น 7. Why NumPy is Important?

NumPy is the foundation of data science libraries:
โœ” Pandas
โœ” Scikit-Learn
โœ” TensorFlow
โœ” PyTorch

All these libraries use NumPy internally.

๐ŸŽฏ Today's Goal
โœ” Install NumPy
โœ” Create arrays
โœ” Perform math operations
โœ” Understand array shape

Double Tap โ™ฅ๏ธ For More
  • โค 17
  • ๐Ÿ‘ 2
More from @datasciencefun
  1. Oct 15, 2026Post #4665
  2. Oct 15, 2026Post #4664
  3. Oct 15, 2026Post #4663
  4. Oct 15, 2026Post #4662
  5. Oct 13, 2026๐—ง๐—ข๐—ฃ ๐—™๐—ฅ๐—˜๐—˜ ๐—–๐—ข๐—จ๐—ฅ๐—ฆ๐—˜๐—ฆ ๐—ง๐—ข ๐—•๐—ข๐—ข๐—ฆ๐—ง ๐—ฌ๐—ข๐—จ๐—ฅ ๐—ฆ๐—ž๐—œ๐—Ÿ๐—Ÿ๐—ฆ ๐—œ๐—ก ๐Ÿฎ๐Ÿฌ๐Ÿฎ๐Ÿฒ! Explorโ€ฆ
  6. Oct 12, 2026Used when you want to perform calculations for each department. Simple rule: DISTINCT โ†’ Giโ€ฆ
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook โ†’Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 โ†’