0% found this document useful (0 votes)
5 views18 pages

IP Practical File

The document outlines various tasks related to data manipulation using pandas, including creating Series and DataFrames from dictionaries and arrays, filtering data, and analyzing student performance. It also covers importing/exporting data, aggregating open-source data, and creating tables with specific attributes. Additionally, it mentions plotting data using Matplotlib and joining tables to create new datasets.
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)
5 views18 pages

IP Practical File

The document outlines various tasks related to data manipulation using pandas, including creating Series and DataFrames from dictionaries and arrays, filtering data, and analyzing student performance. It also covers importing/exporting data, aggregating open-source data, and creating tables with specific attributes. Additionally, it mentions plotting data using Matplotlib and joining tables to create new datasets.
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/ 18

#1 Create a panda’s series from a dictionary of values and a ndarray.

Output:

Series from Dictionary:


A 1
B 2
C 3
D 4
dtype: int64

Series from Array:


A 1
B 2
C 3
D 4
dtype: int64
#2 Given a Series, print all the elements that are above the 75th percentile.

Output:

Elements above 75th percentile:


80
90
100
#3 Create a Data Frame quarterly sales where each row contains the item

category, item name, and expenditure. Group the rows by the category

and print the total expenditure per category.

Output:

Original DataFrame:
Category Item Name Expenditure
0 Electronics Laptop 1000
1 Fashion Shirt 50
2 Electronics Tablet 500
3 Fashion Shoes 100
4 Home Goods Chair 200

Total Expenditure per Category:


Category
Electronics 1500
Fashion 150
Home Goods 200
Name: Expenditure, dtype: int64
#4 Create a data frame for examination result and display row labels,

column labels, data types of each column and the dimensions.

Output:
Row Labels:
RangeIndex(start=0, stop=5, step=1)
Column Labels:
Index(['Student ID', 'Name', 'Maths', 'Science', 'English'], dtype='object')

Data Types:
Student ID int64
Name object
Maths int64
Science int64
English int64
dtype: object

Dimensions:
(5, 5)
#5 Filter out rows based on different criteria such as duplicate rows.

Output:
Name Age
0 John 25
1 Mary 31
3 Emily 42
4 Michael 35

Name Age
0 John 25.0
1 Mary 31.0
4 Michael 35.0

Name Age
1 Mary 31
2 Emily 42
3 Michael 35
#6 Importing and exporting data between pandas and CSV file.

Output:
Name Age
0 John 25
1 Mary 31
#7 Given the school result data, analyses the performance of the students

on different.

Output:

Subject-wise Average Marks:


Maths 84.5
Science 84.0
English 87.5

dtype: float64
Class-wise Average Marks:
Class Maths Science English
X 84.0 85.0 87.0
XI 85.0 83.0 88.0
Top 3 Students with Highest Total Marks:
Name Total
1 Mary 265
9 Olivia 260
5 Sarah 260
#8 For the Data frames created above, analyze, and plot appropriate charts

with title.

Output;
#9 Take data of your interest from an open source (e.g. data.gov.in),

aggregate and summarize it. Then plot it using different plotting

functions of the Matplotlib library.


#10 Create a student table with the student id, name, and marks as

attributes where the student id is the primary key.

+------------+----------+-------+
| Student_ID | Name | Marks |
+------------+----------+-------+
| | | |
+------------+----------+-------+

+------------+--------------+-------+
| Student_ID | Name | Marks |
+------------+--------------+-------+
| 1 | John Doe | 85.50 |
| 2 | Jane Doe | 90.25 |
| 3 | Alice Smith | 78.00 |
| 4 | Bob Johnson | 92.00 |
| 5 | Eve Williams | 88.00 |
+------------+--------------+-------+
+------------+--------------+-------+
| Student_ID | Name | Marks |
+------------+--------------+-------+
| 1 | John Doe | 85.50 |
| 2 | Jane Doe | 90.25 |
| 4 | Bob Johnson | 92.00 |
| 5 | Eve Williams | 88.00 |
+------------+--------------+-------+

+-----------+-----------+-----------+--------------+
| Min_Marks | Max_Marks | Sum_Marks | Average_Marks|
+-----------+-----------+-----------+--------------+
| 78.00 | 92.00 | 434.75 | 86.95 |
+-----------+-----------+-----------+--------------+

+------------+---------------+-------+
| Student_ID | Name | Marks |
+------------+---------------+-------+
| 4 | Bob Johnson | 92.00 |
| 2 | Jane Doe | 90.25 |
| 5 | Eve Williams | 88.00 |
| 1 | John Doe | 85.50 |
| 3 | Alice Smith | 78.00 |
+------------+---------------+-------+
#11 Create a new table (order ID, customer Name, and order Date) by

joining two tables (order ID, customer ID, and order Date).
Output:

| Order_ID | Customer_Name | Order_Date |


|----------|----------------|------------|
| 1 | John Doe | 2022-01-01 |
| 2 | Jane Doe | 2022-01-15 |
| 3 | John Doe | 2022-02-01 |
| 4 | Bob Johnson | 2022-03-01 |
| 5 | Jane Doe | 2022-04-01 |

You might also like