Back to Modules

Pandas Tutorial

Learn Pandas for data analysis and manipulation with hands-on examples and clear explanations.

Part 1

Part 2

Introduction to Pandas

Pandas is a powerful Python library for data manipulation and analysis. It provides data structures like Series and DataFrame for handling structured data.

Examples:

import pandas as pd
data = {'Name': ['Alice', 'Bob'], 'Age': [25, 30]}
df = pd.DataFrame(data)
print(df)

Create a simple DataFrame and print it.

Reading CSV Files

Pandas makes it easy to read data from CSV files into DataFrames for analysis.

Examples:

import pandas as pd
df = pd.read_csv('data.csv')
print(df.head())

Read a CSV file and display the first five rows.

Data Selection and Filtering

You can select columns, rows, and filter data in Pandas using intuitive syntax.

Examples:

import pandas as pd
df = pd.DataFrame({'A': [1, 2, 3], 'B': [4, 5, 6]})
print(df['A'])  # Select column
print(df[df['B'] > 4])  # Filter rows

Select a column and filter rows in a DataFrame.