From 89f81cdaf6e97ba3d69d7d2b3c3469db5591937e Mon Sep 17 00:00:00 2001 From: Dhruv Parashar Date: Fri, 6 Jun 2025 00:11:56 -0400 Subject: [PATCH] Done Pandas1 --- Big Countries | 6 ++++++ Customer Who Never Order | 7 +++++++ Recyclable and Low Fat Products | 5 +++++ 3 files changed, 18 insertions(+) create mode 100644 Big Countries create mode 100644 Customer Who Never Order create mode 100644 Recyclable and Low Fat Products diff --git a/Big Countries b/Big Countries new file mode 100644 index 0000000..af3aef6 --- /dev/null +++ b/Big Countries @@ -0,0 +1,6 @@ +import pandas as pd + +def big_countries(world: pd.DataFrame) -> pd.DataFrame: + df = world[(world['area'] >= 3000000) | (world['population'] >= 25000000)] + return df[['name', 'population', 'area']] + \ No newline at end of file diff --git a/Customer Who Never Order b/Customer Who Never Order new file mode 100644 index 0000000..d0ec5b1 --- /dev/null +++ b/Customer Who Never Order @@ -0,0 +1,7 @@ +import pandas as pd + +def find_customers(customers: pd.DataFrame, orders: pd.DataFrame) -> pd.DataFrame: + df = customers.merge(orders, left_on = 'id', right_on = 'customerId', how = 'left') + df = df[df['customerId'].isna()] + return df[['name']].rename(columns={'name': 'Customers'}) + \ No newline at end of file diff --git a/Recyclable and Low Fat Products b/Recyclable and Low Fat Products new file mode 100644 index 0000000..4e658fc --- /dev/null +++ b/Recyclable and Low Fat Products @@ -0,0 +1,5 @@ +import pandas as pd + +def find_products(products: pd.DataFrame) -> pd.DataFrame: + df = products[(products['low_fats'] == 'Y') & (products['recyclable'] == 'Y')] + return df[['product_id']] \ No newline at end of file