DEV Community

Aditi Sharma
Aditi Sharma

Posted on

πŸš€ Day 12 of My Python Learning Journey

Getting Started with Pandas Series

Today I explored Pandas, one of the most powerful Python libraries for data analysis. I began with the Series object, which is like a 1D labeled array.

πŸ”Ή Creating a Series

import pandas as pd

data = [10, 20, 30, 40]
s = pd.Series(data)
print(s)

βœ… Output:

0 10
1 20
2 30
3 40
dtype: int64

πŸ”Ή Custom Index

s = pd.Series([10, 20, 30], index=["a", "b", "c"])
print(s["b"]) # 20

πŸ”Ή From Dictionary

data = {"apples": 3, "bananas": 5, "oranges": 2}
fruits = pd.Series(data)
print(fruits)

πŸ”Ή Vectorized Operations

print(s * 2)

a 20

b 40

c 60

⚑ Interesting Facts
β€’ A Pandas Series is built on NumPy arrays (fast + efficient).
β€’ Labels (index) make data handling more intuitive.
β€’ It’s the foundation for Pandas DataFrame.

✨ Reflection
Series may look simple, but they’re the first step toward mastering data manipulation in Pandas. I can already see how useful they’ll be for analytics tasks.

Next β†’ I’ll dive into Pandas DataFrames πŸ“Š

Python #Pandas #100DaysOfCode #DataAnalytics #DevCommunity

Top comments (0)