From 6956ec0baccffb0f60f74082a0750c80c85f6fb9 Mon Sep 17 00:00:00 2001 From: tejas274 Date: Fri, 6 Jun 2025 17:01:58 -0500 Subject: [PATCH 1/2] problem 2 and 3 added --- problem2-595-big-countries.py | 5 +++++ problem3-1757-recycle-and-low-fat-products.py | 5 +++++ 2 files changed, 10 insertions(+) create mode 100644 problem2-595-big-countries.py create mode 100644 problem3-1757-recycle-and-low-fat-products.py diff --git a/problem2-595-big-countries.py b/problem2-595-big-countries.py new file mode 100644 index 0000000..2958cc0 --- /dev/null +++ b/problem2-595-big-countries.py @@ -0,0 +1,5 @@ +import pandas as pd + + +def big_countries(world: pd.DataFrame) -> pd.DataFrame: + return world[(world['area'] >= 3000000) | (world['population'] >= 25000000)][['name', 'population', 'area']] \ No newline at end of file diff --git a/problem3-1757-recycle-and-low-fat-products.py b/problem3-1757-recycle-and-low-fat-products.py new file mode 100644 index 0000000..72d4744 --- /dev/null +++ b/problem3-1757-recycle-and-low-fat-products.py @@ -0,0 +1,5 @@ +import pandas as pd + + +def find_products(products: pd.DataFrame) -> pd.DataFrame: + return products[(products['low_fats'] == 'Y') & (products['recyclable'] == 'Y')][['product_id']] \ No newline at end of file From 6de15f9d69ee6c97e5068e8173c942158ffec7c7 Mon Sep 17 00:00:00 2001 From: tejas274 Date: Fri, 6 Jun 2025 17:18:36 -0500 Subject: [PATCH 2/2] problem 4 added --- problem4-183-customer-who-never.py | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 problem4-183-customer-who-never.py diff --git a/problem4-183-customer-who-never.py b/problem4-183-customer-who-never.py new file mode 100644 index 0000000..c088e25 --- /dev/null +++ b/problem4-183-customer-who-never.py @@ -0,0 +1,8 @@ +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'].isnull()][['name']].rename(columns={'name': 'Customers'}) + return df \ No newline at end of file