Sample DataFrame : Sales, customer and procuts

We have three CSV files.

customer.csv : Two columns, customer id and customer name
products.csv : Three columns ,p_id( product id) , product ( name) and price
sales.csv Six columns , sale_id, c_id ( customer id ), p_id (product_id), qty ( quantity sold) ,store ( name )

Sample DataFrames are here
my_dict={'sale_id':[1,2,3,4,5,6,7,8,9],
         'c_id':[2,2,1,4,2,3,2,3,2],
         'p_id':[3,4,3,2,3,3,2,2,3],
	 'product':['Monitor','CPU','Monitor','RAM','Monitor','Monitor','RAM','RAM','Monitor'],
         'qty':[2,1,3,2,3,2,3,2,2],
         'store':['ABC','DEF','ABC','DEF','ABC','DEF','ABC','DEF','ABC']}
sales = pd.DataFrame(data=my_dict)

my_dict={'p_id':[1,2,3,4,5,6,7,8],
  'product':['Hard Disk','RAM','Monitor','CPU','Keyboard','Mouse','Motherboard','Power supply'],
  'price':[80,90,75,55,20,10,50,20]}
product = pd.DataFrame(data=my_dict)

my_dict={'c_id':[1,2,3,4,5,6,7,8],
         'Customer':['Rabi','Raju','Alex','Rani','King','Ronn','Jem','Tom']}
customer = pd.DataFrame(data=my_dict)

Sales

import pandas as pd 
my_dict={'sale_id':[1,2,3,4,5,6,7,8,9],
         'c_id':[2,2,1,4,2,3,2,3,2],
         'p_id':[3,4,3,2,3,3,2,2,3],
	 'product':['Monitor','CPU','Monitor','RAM','Monitor','Monitor','RAM','RAM','Monitor'],
         'qty':[2,1,3,2,3,2,3,2,2],
         'store':['ABC','DEF','ABC','DEF','ABC','DEF','ABC','DEF','ABC']}
sales = pd.DataFrame(data=my_dict)
print(sales)

Products

import pandas as pd 
my_dict={'p_id':[1,2,3,4,5,6,7,8],
  'product':['Hard Disk','RAM','Monitor','CPU','Keyboard','Mouse','Motherboard','Power supply'],
  'price':[80,90,75,55,20,10,50,20]}
product = pd.DataFrame(data=my_dict)
print(product)

Customers

import pandas as pd 
my_dict={'c_id':[1,2,3,4,5,6,7,8],
         'Customer':['Rabi','Raju','Alex','Rani','King','Ronn','Jem','Tom']}
customer = pd.DataFrame(data=my_dict)
print(customer)
Pandas Exercise Sales
Pandas Sales Exercise
Pandas DataFrame Pandas merge
Subscribe to our YouTube Channel here


Subscribe

* indicates required
Subscribe to plus2net

    plus2net.com







    Python Video Tutorials
    Python SQLite Video Tutorials
    Python MySQL Video Tutorials
    Python Tkinter Video Tutorials
    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2024 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer