0% found this document useful (0 votes)
12 views3 pages

Python Codes

Erd of assignment

Uploaded by

aqsa riaz
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)
12 views3 pages

Python Codes

Erd of assignment

Uploaded by

aqsa riaz
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
You are on page 1/ 3

Python Codes

import sqlite3

import pandas as pd

# Database and file paths

DATABASE_PATH = 'database.db'

SPREADSHEET_0 = 'spreadsheet_0.csv'

SPREADSHEET_1 = 'spreadsheet_1.csv'

SPREADSHEET_2 = 'spreadsheet_2.csv'

def load_data(file_path):

"""Load a CSV file into a Pandas DataFrame."""

return pd.read_csv(file_path)

def insert_data_to_db(data, table_name, conn):

"""Insert Pandas DataFrame into SQLite database."""

data.to_sql(table_name, conn, if_exists='append', index=False)

def process_spreadsheets():

# Connect to SQLite database

conn = sqlite3.connect(DATABASE_PATH)

# Load spreadsheet 0 and insert directly

data_0 = load_data(SPREADSHEET_0)

insert_data_to_db(data_0, 'table_name_0', conn) # Replace 'table_name_0' with actual table name

# Load spreadsheets 1 and 2

data_1 = load_data(SPREADSHEET_1)

data_2 = load_data(SPREADSHEET_2)
# Merge spreadsheet 1 and 2 on shipping identifier

combined_data = data_1.merge(data_2, on='shipping_identifier')

# Calculate total quantity per shipment

combined_data['total_quantity'] = combined_data.groupby('shipping_identifier')
['quantity'].transform('sum')

# Prepare the final format for insertion

final_data = combined_data[['product', 'origin', 'destination', 'total_quantity']] # Adjust column


names as per schema

# Insert the processed data into the database

insert_data_to_db(final_data, 'table_name_combined', conn) # Replace with actual table name

# Close the connection

conn.close()

if __name__ == "__main__":

process_spreadsheets()

I recently participated in Walmart’s job simulation on Forage and it was


incredibly useful to understand what it might be like to participate in a
software engineering team there.
During the simulation I gained experience and expertise implementing a
novel version of a heap data structure, designing a UML class diagram for a
data processor and creating a database that met a diverse range of
requirements. It was fantastic to experience how working as a software
engineer at Walmart touches and supports various different teams like the
shipping department and the pet department.
Through this experience I validated that I really enjoy working on complex
data-related challenges and working on projects that have real-world impact
at a massive scale. I’d love to apply what I learned in a software engineering
team at Walmart.

You might also like