DEV Community

Ramya .C
Ramya .C

Posted on

🧮 Day 53 of My Data Analytics Journey !

Exploring NumPy Fundamentals

Today, I dove deep into NumPy, one of the most essential Python libraries for data analysis and scientific computing.
Understanding how to create and manipulate arrays is a key skill for any data analyst or data scientist.


🧱 What I Learned Today

🔹 Creating Arrays

NumPy allows us to create different types of arrays:

import numpy as np

r = np.array([1, 2, 3])             # 1D array
r1 = np.array([[1, 2], [3, 4]])     # 2D array
r2 = np.array([[1, 2], [2, 3], [3, 4]])  # 3x2 array
Enter fullscreen mode Exit fullscreen mode

🔹 Array Initialization Functions

Creating arrays filled with specific values is super easy:

np.zeros([3, 3])     # Array of zeros
np.full([3, 3], 5)   # Array filled with 5
np.eye(3)            # Identity matrix
np.diag((1, 2, 3))   # Diagonal matrix
np.zeros_like(r1)    # Zero array with same shape as r1
Enter fullscreen mode Exit fullscreen mode

🔹 Generating Number Sequences

NumPy makes it easy to generate sequences or random numbers:

np.linspace(0, 10, 5)             # Evenly spaced numbers from 0 to 10
np.random.rand(2, 3)              # Random floats (0 to 1)
np.random.randint(1, 10, (2, 3))  # Random integers from 1 to 9
Enter fullscreen mode Exit fullscreen mode

🎯 Key Takeaways

  • NumPy provides efficient ways to handle numerical data.
  • Arrays are faster and more memory-efficient than Python lists.
  • Functions like zeros, full, and random are crucial for data preprocessing and simulation tasks.

💡 Reflection

Learning NumPy has helped me understand how numerical data is structured and processed behind the scenes.
It’s the foundation of pandas, machine learning, and deep learning workflows — mastering it builds confidence for bigger projects!


🔗 View Full Code on GitHub

https://github.com/ramyacse21/numpy_workspace

#Day53 #DataAnalytics #NumPy #Python #DataScience #MachineLearning #100DaysOfCode

Top comments (0)