From 96e3f635c437d9b5398dd04659478565fcc33be5 Mon Sep 17 00:00:00 2001 From: Sangeeth Santhosh <73825180+sangeeths29@users.noreply.github.com> Date: Mon, 9 Jun 2025 17:54:35 -0700 Subject: [PATCH] Add files via upload --- 02-BigCountries.py | 6 ++++++ 03-RecyclableandLowFatProducts.py | 6 ++++++ 04-CustomersWhoNeverOrder.py | 6 ++++++ 3 files changed, 18 insertions(+) create mode 100644 02-BigCountries.py create mode 100644 03-RecyclableandLowFatProducts.py create mode 100644 04-CustomersWhoNeverOrder.py diff --git a/02-BigCountries.py b/02-BigCountries.py new file mode 100644 index 0000000..190e826 --- /dev/null +++ b/02-BigCountries.py @@ -0,0 +1,6 @@ +# Problem 2 - Big Countries ( https://leetcode.com/problems/big-countries/ ) +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/03-RecyclableandLowFatProducts.py b/03-RecyclableandLowFatProducts.py new file mode 100644 index 0000000..fd5f36c --- /dev/null +++ b/03-RecyclableandLowFatProducts.py @@ -0,0 +1,6 @@ +# Problem 3 - Recyclable and Low Fat Products ( https://leetcode.com/problems/recyclable-and-low-fat-products/ ) +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 diff --git a/04-CustomersWhoNeverOrder.py b/04-CustomersWhoNeverOrder.py new file mode 100644 index 0000000..09ff112 --- /dev/null +++ b/04-CustomersWhoNeverOrder.py @@ -0,0 +1,6 @@ +# Problem 4 - Customer Who Never Order ( https://leetcode.com/problems/customers-who-never-order/ ) +import pandas as pd + +def find_customers(customers: pd.DataFrame, orders: pd.DataFrame) -> pd.DataFrame: + df = customers[~customers['id'].isin(orders['customerId'])] + return df[['name']].rename(columns = {'name':'Customers'}) \ No newline at end of file