0% found this document useful (0 votes)
3 views15 pages

Pandas and SQL Data Handling Guide

The document contains a series of programming and database management questions related to data handling using Pandas and SQL. It includes tasks such as creating a Pandas Series and DataFrame, filtering data, and performing group operations. Additionally, it covers SQL operations like creating tables, inserting, deleting records, and querying data based on specific criteria.

Uploaded by

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

Pandas and SQL Data Handling Guide

The document contains a series of programming and database management questions related to data handling using Pandas and SQL. It includes tasks such as creating a Pandas Series and DataFrame, filtering data, and performing group operations. Additionally, it covers SQL operations like creating tables, inserting, deleting records, and querying data based on specific criteria.

Uploaded by

devilanooj
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

DATA

HANDLIN
G
Question 1: Create a Pandas Series from a dictionary of values
and a NumPy ndarray. Also provide the output.
Question 2: Given a Series, print all the elements that are
above the 75th percentile.
Question 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.
import pandas as pd

# Create the quarterly sales DataFrame

sales_data = [Link] ({'Category': ['Electronics', 'Electronics', 'Furniture', 'Furniture',


'Stationery', 'Stationery'], 'Item': ['Laptop', 'Smartphone', 'Chair', 'Table', 'Pen', 'Notebook'],

'Expenditure': [75000, 50000, 12000, 15000, 500, 1200]})

# Group by category and calculate total expenditure

total_expenditure = sales_data.groupby('Category')['Expenditure'].sum()

# Display the result

print("Total Expenditure per Category:")

print(total_expenditure)

Question 4: Create a data frame for examination result and


display row labels, column labels data types of each column
and the dimensions.
Question 5: Filter out rows based on different criteria such as
duplicate rows.
Question 6: Importing and exporting data between pandas and
CSV file .
DATA
MANAGEMEN
T
Question 1: Create a student table with the student id, name,
and marks as attributes where the student id is the primary
key.

Question 2: Insert the details of a new student in the above


table.
Question 3: Delete the details of a student in the above table.
Question 4: 4. Use the select command to get the details of
the students with marks more than 80.
Question 5: Find the min, max, sum, and average of the
marks in a student marks table.
Question 6: Find the total number of customers from each
country in the table (customer ID, customer Name, country)
using group by.
Question 7: Write a SQL query to order the (student ID,
marks) table in descending order of the marks.

You might also like