Welcome to the Pandas basics tutorial! Pandas is a powerful library for data analysis and manipulation in Python. Let's explore its core features and how to get started.
Core Data Structures
Pandas provides two primary data structures:
- Series: One-dimensional labeled array (think of it as a column in a spreadsheet)
- DataFrame: Two-dimensional labeled data structure (like a table in a relational database)
import pandas as pd
# Example: Creating a Series
s = pd.Series([1, 2, 3], name="Numbers")
# Example: Creating a DataFrame
df = pd.DataFrame({"Name": ["Alice", "Bob"], "Age": [25, 30]})
Basic Operations
Learn how to perform common tasks with Pandas:
- Reading data: Use
pd.read_csv()
orpd.read_excel()
to load datasets - Data selection: Access columns with
df['column_name']
or rows withdf.loc[]
- Data filtering: Use boolean indexing like
df[df['Age'] > 25]
Need more practice? Check out our Data Wrangling Tutorial for hands-on exercises!
Data Cleaning
Pandas makes it easy to handle missing data and duplicates:
- Use
df.dropna()
to remove missing values - Use
df.fillna()
to fill missing values - Use
df.drop_duplicates()
to clean up repeated entries
Data Visualization
Create visualizations with Pandas' built-in tools:
- Use
df.plot()
for quick graphs - Use
sns
(Seaborn) for more advanced plots
Next Steps
Ready to level up your Pandas skills? Explore these topics:
Happy coding! 🚀