Pandas is the most important library for data manipulation and analysis. It provides two key data structures: Series and DataFrame.
import pandas as pd
s = pd.Series([10, 20, 30])
print(s)
df = pd.DataFrame({
"Name": ["John", "Mary"],
"Age": [28, 34]
})
print(df)
df = pd.read_csv("data.csv")
df.head()
df["Age"]
df[["Name", "Age"]]
df[df["Age"] > 30]
df.isnull().sum()
df.fillna(0)
df.dropna()
df.sort_values("Age", ascending=False)
df.groupby("Department")["Salary"].mean()
merged = pd.merge(df1, df2, on="id")
Pandas is the heart of data analysis, making data cleaning and transformation fast and efficient.
Take quizzes related to this topic and see where you stand!
Start Quiz Now