TGViewer
Data Science Portfolio - Kaggle Datasets & AI Projects | Artificial Intelligence Data Science Portfolio - Kaggle Datasets & AI Projects | Artificial Intelligence @dataportfolio · 38K subscribers
Post #974 3.48K
✅ Python for Data Science – Part 1: NumPy Interview Q&A 📊

🔹 1. What is NumPy and why is it important?
NumPy (Numerical Python) is a powerful Python library for numerical computing. It supports fast array operations, broadcasting, linear algebra, and random number generation. It’s the backbone of many data science libraries like Pandas and Scikit-learn.

🔹 2. Difference between Python list and NumPy array
Python lists can store mixed data types and are slower for numerical operations. NumPy arrays are faster, use less memory, and support vectorized operations, making them ideal for numerical tasks.

🔹 3. How to create a NumPy array
import numpy as np
arr = np.array([1, 2, 3])


🔹 4. What is broadcasting in NumPy?
Broadcasting lets you perform operations on arrays of different shapes. For example, adding a scalar to an array applies the operation to each element.

🔹 5. How to generate random numbers
Use np.random.rand() for uniform distribution, np.random.randn() for normal distribution, and np.random.randint() for random integers.

🔹 6. How to reshape an array
Use .reshape() to change the shape of an array without changing its data.
Example: arr.reshape(2, 3) turns a 1D array of 6 elements into a 2x3 matrix.

🔹 7. Basic statistical operations
Use functions like mean(), std(), var(), sum(), min(), and max() to get quick stats from your data.

🔹 8. Difference between zeros(), ones(), and empty()
np.zeros() creates an array filled with 0s, np.ones() with 1s, and np.empty() creates an array without initializing values (faster but unpredictable).

🔹 9. Handling missing values
Use np.nan to represent missing values and np.isnan() to detect them.
Example:
arr = np.array([1, 2, np.nan])
np.isnan(arr) # Output: [False False True]


🔹 10. Element-wise operations
NumPy supports element-wise addition, subtraction, multiplication, and division.
Example:
a = np.array([1, 2, 3])
b = np.array([4, 5, 6])
a + b # Output: [5 7 9]


💡 Pro Tip: NumPy is all about speed and efficiency. Mastering it gives you a huge edge in data manipulation and model building.

Double Tap ❤️ For More
  • ❤ 13
More from @dataportfolio
  1. Sep 20, 2026🌐 Data Science Tools & Their Use Cases 📊🔍 🔹 Python ➜ Core language for scripting, anal…
  2. Sep 19, 2026🤖 GigaChat 3.5 Reasoning 🎯 Thinks before answering: breaks problems into stages, builds…
  3. Sep 14, 2026✅ Data Science Interview Questions with Answers Part-4 • 31. Why is Python popular in data…
  4. Sep 14, 2026✅ Data Science Interview Questions with Answers Part-3 21. How do you handle missing value…
  5. Sep 14, 2026✅ Data Science Interview Questions with Answers Part-2 11. What is the difference between…
  6. Sep 14, 202610. What is bias in data and how does it affect models? Bias in data occurs when certain g…
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 →