supratik ghosh
supratik ghosh

Reputation: 1

Filtering Items from data tables

I have two datasets, one is Product Data which has store name, available products and their corresponding quantity, other data is Customer Order Data where I have customer name, products they are ordering and their respective quantities. My problem is that I have to find the stores for each customer and each product they are ordering (satisfying the quantity criteria as well).

How can I code it in Python?

Product Data:

product

Customer Order Data:

customer order data

Upvotes: 0

Views: 69

Answers (1)

Hietsh Kumar
Hietsh Kumar

Reputation: 1329

In terms of excel you are looking for vlookup which is done by merging datafrmes, you can explore more about it. Check if below lines can work for you , sample df snap is attached after code lines.

Change column names as per your need.

import pandas as pd

df_customer = pd.read_excel('customer.xlsx')
df_product = pd.read_excel('product.xlsx')

df = pd.merge(df_customer, df_pfoduct[['Product','Storage']], on = 'Product', how = 'left')

print(df)  

enter image description here

Upvotes: 1

Related Questions