[go: up one dir, main page]

0% found this document useful (0 votes)
64 views5 pages

Class 12 AI Practical File

The document outlines a practical assignment for Class XII students on Artificial Intelligence, focusing on data analysis using Python's pandas and matplotlib libraries. It includes instructions on creating DataFrames, performing data analysis workflows, and conducting survival analysis on the Titanic dataset. Students are required to write Python code, take screenshots of outputs, and compile their work in a practical file by the submission deadline of August 22, 2025.

Uploaded by

yevek91290
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
64 views5 pages

Class 12 AI Practical File

The document outlines a practical assignment for Class XII students on Artificial Intelligence, focusing on data analysis using Python's pandas and matplotlib libraries. It includes instructions on creating DataFrames, performing data analysis workflows, and conducting survival analysis on the Titanic dataset. Students are required to write Python code, take screenshots of outputs, and compile their work in a practical file by the submission deadline of August 22, 2025.

Uploaded by

yevek91290
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

ARTIFICIAL INTELLIGENCE(843)

Session—2025 –26
CLASS—XII
Question-1:
How can you create a DataFrame using sequence data types and perform basic
operations such as displaying its contents, viewing the first or last few rows, and
identifying missing values using pandas in Python?
(Hints:
a) How do you create a DataFrame using sequence data types (like lists, tuples, or
dictionaries) in Python using pandas?
Answer: By using the pd.DataFrame() function and passing a dictionary of lists.

b) How do you display the full contents of a DataFrame?

Answer: By simply printing the DataFrame, e.g., print(df).

c) How do you display the first 5 records (rows) of a DataFrame?

Answer: Using df.head() method.

d) How do you display the last 10 records of a DataFrame?

Answer: Using df.tail(10) method.

e) How do you find the number of missing (null) values in each column of a
DataFrame?

Answer: Using df.isnull().sum()

Question- 2:

How do you perform a complete data analysis workflow in Python using pandas and
matplotlib—starting from importing libraries, loading and exploring datasets (like Iris.csv
and mdms_data.csv), handling missing values, visualizing trends (such as Enrollment and
Dropout Rate over the years), and finally building and using a Linear Regression model with
scikit-learn to predict future dropout rates?

(Hints:

PART 1: IRIS DATASET ANALYSIS

a) How do you import the required library for data analysis in Python?

import pandas as pd
b) How do you load a CSV file into a DataFrame using pandas?

df = pd.read_csv("Iris.csv")

c) How do you display the first 5 rows of a DataFrame?

df.head()

d) How do you check for missing values in each column of a DataFrame?

df.isnull().sum()

e) How do you generate a statistical summary (mean, std, etc.) of numeric columns in a
DataFrame?

df.describe()

f) How do you get data type, memory usage, and null value info about a DataFrame?

df.info()

g) How do you fill missing values using the forward fill method?

df.fillna(method='ffill', inplace=True)

PART 2: PLOTTING TRENDS FROM mdms_data.csv

h)How do you import the required libraries for plotting in Python?

import matplotlib.pyplot as plt

i)How do you load a dataset from a CSV file named mdms_data.csv?

df = pd.read_csv('mdms_data.csv')

j)How do you plot a line graph of Enrollment over Years?

Use plt.plot(df['Year'], df['Enrollment']) with appropriate labels and plt.show()

k)How do you plot a line graph of Dropout Rate (%) over the Years?

Use plt.plot(df['Year'], df['Dropout (%)']) with appropriate formatting

PART 3: LINEAR REGRESSION FOR PREDICTION

l)How do you import the Linear Regression model from scikit-learn?

from sklearn.linear_model import LinearRegression

m)How do you define the features (X) and target (y) for modeling dropout prediction?
X = df[['Year']], y = df['Dropout (%)']

n)How do you train a Linear Regression model in Python?

o)How do you predict the dropout rate for a future year (e.g., 2025)?

model.predict([[2025]])

p)How do you format and display the predicted value in a user-friendly format?

Question-3:

How do you perform a complete survival analysis on the Titanic dataset using pandas and
matplotlib, including loading the data, previewing it, analyzing survival rates by gender and
passenger class, visualizing the results with stacked bar charts, and summarizing key insights
from the analysis?

(Hints:Data Loading & Preview

1. How do you load the Titanic dataset into a pandas DataFrame from a CSV file?

titanic = pd.read_csv("Titanic.csv")

2.How do you preview the first few rows of the Titanic dataset?

titanic.head()

Survival Analysis by Gender

3. How do you calculate survival counts grouped by gender?

Using groupby(['Sex', 'Survived']).size().unstack()

4. How do you visualize Titanic survival counts by gender using a stacked bar chart?

Using plot(kind='bar', stacked=True) and customizing labels/titles.

Survival Analysis by Passenger Class

5. How do you calculate survival counts grouped by passenger class?

Using groupby(['Pclass', 'Survived']).size().unstack()

6. How do you visualize Titanic survival counts by class using a stacked bar chart?

Again, using plot(kind='bar', stacked=True) and appropriate axis labeling.


Conclusion / Interpretation

7. How do you summarize key findings or tell a story based on Titanic survival
analysis?

Provide a narrative (e.g., using a multiline string) that interprets the plotted results.)

Based on the above points the students have to do their project in the thread file.

Instructions to be followed :--


1. Write the Python codes for the above programs on the ruled page of an interleaf Practical
file (use blue pen only).

2. Take the screenshot of the output and attached with the white page.

>>Practical file Cover Page :


Include the School name with logo.
AISSCE EXAMINATION 2025-26.
Name of the student.
Class and Section.
Roll Number (CBSE board roll no.).
Academic Session.

The last date of submission of your Artificial Intelligence practical file will
be 22nd August,2025.

You might also like