prac1
prac1
Practical – 1
Import a student.csv file and filter the file with scores more than 70 and save
it to a new csv file name high_score.csv
import pandas as pd
Open the Excel file named sales_data.xlsx, which contains the columns: Date,
Product, Quantity, and Revenue. Calculate the total revenue for each product.
Save the results to a new Excel sheet named product_summary.xlsx.
import pandas as pd
Objective: Handle JSON data and convert it to other formats. 1. Open the
JSON file named movies.json. Convert the JSON data into a pandas
DataFrame. Save the DataFrame into a CSV file named movies_table.csv.
import pandas as pd
import json
Import data from the CSV file employee_data.csv, which contains columns:
EmployeeID, Name, Department, and Salary. Create a new SQLite database
named company.db and a table employees. Export the data from the CSV file
into the employees table. Query the database to verify the data has been
stored correctly.
import sqlite3
import pandas as pd
# Connect to SQLite database (it will create the database if it doesn't exist)
conn = sqlite3.connect("company.db")
cursor = conn.cursor()
conn.close()
Rathod Dharm Nitin - 22SE02ML063 Business Analytics
# Step 1: Load the data from the CSV and JSON files
inventory_df = pd.read_csv("inventory.csv") # Replace with your file path
sales_df = pd.read_json("sales.json") # Replace with your file path