Student Activity

Student Activity Guide:

1) Introduction to Pandas DataFrames and Series

  • Create a Pandas DataFrame from a dictionary.

  • Extract and manipulate data using Series.

Example Code:

import pandas as pd

# Creating a DataFrame
data = {'Name': ['Alice', 'Bob', 'Charlie'], 'Age': [25, 30, 35], 'City': ['New York', 'Los Angeles', 'Chicago']}
df = pd.DataFrame(data)
print(df)

# Extracting a column as a Series
ages = df['Age']
print("Ages:", ages)

Student Exercise: Create a DataFrame with student names, marks, and subjects. Extract a specific column as a Series.

2) Data Manipulation and Transformation

  • Add, modify, and delete columns in a DataFrame.

  • Perform data filtering using conditions.

Example Code:

Student Exercise: Modify an existing column and filter data based on multiple conditions.

3) Handling Missing Data

  • Identify missing values in a DataFrame.

  • Fill or drop missing values appropriately.

Example Code:

Student Exercise: Load a dataset with missing values and handle them using fillna() and dropna().

4) Merging and Grouping Data

  • Merge two DataFrames using common keys.

  • Group data and calculate aggregate statistics.

Example Code:

Student Exercise: Merge two datasets containing student scores and details, and group by subjects to calculate average scores.

Last updated