From bc491aaad2515d28d850ef2176f9e2b0c9720d37 Mon Sep 17 00:00:00 2001 From: kiran160195 <66009503+kiran160195@users.noreply.github.com> Date: Sun, 8 Jun 2025 19:50:16 -0500 Subject: [PATCH 1/2] assignment1 --- .DS_Store | Bin 0 -> 6148 bytes problem1.py | 8 ++++++++ problem2.py | 9 +++++++++ problem3.py | 9 +++++++++ problem4.py | 0 5 files changed, 26 insertions(+) create mode 100644 .DS_Store create mode 100644 problem1.py create mode 100644 problem2.py create mode 100644 problem3.py create mode 100644 problem4.py diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..c38df0d4313b6534736aecdf30f9055e24f71047 GIT binary patch literal 6148 zcmeHKJ5Iwu5S;-Rk!Vs2~1>8kPDy?DIg_s3Xmwbqu>ghhnoA)@a6-uWrdOg z-bl00J2TH~zry1Y5nVoR79w*InZXU^*_NqU-h5&w8EJrO_tA>P60MLHp-Ei%*1h7~D*e2FML|__JU{Ezj3=KNs zCF|P68W?m@KNDnJGPlmgmx zt8R%`%HBG8IqS6regpq9)OtA pd.DataFrame: + + condition = world[(world['area'] >= 3000000) | (world['population'] >= 25000000)] + df = condition[['name','population','area']] + + return df + diff --git a/problem3.py b/problem3.py new file mode 100644 index 0000000..286e6dc --- /dev/null +++ b/problem3.py @@ -0,0 +1,9 @@ +import pandas as pd + +def find_products(products: pd.DataFrame) -> pd.DataFrame: + '''Simple pandas & condition''' + condition = products[(products['low_fats'] == 'Y') & (products['recyclable'] == 'Y')] + + product_ids = condition[['product_id']] + + return product_ids \ No newline at end of file diff --git a/problem4.py b/problem4.py new file mode 100644 index 0000000..e69de29 From 06e776778948d9a4380317be030f785186729313 Mon Sep 17 00:00:00 2001 From: kiran160195 <66009503+kiran160195@users.noreply.github.com> Date: Sun, 8 Jun 2025 20:27:55 -0500 Subject: [PATCH 2/2] problem 4 --- problem4.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/problem4.py b/problem4.py index e69de29..49cdfb0 100644 --- a/problem4.py +++ b/problem4.py @@ -0,0 +1,5 @@ +import pandas as pd + +def find_customers(customers: pd.DataFrame, orders: pd.DataFrame) -> pd.DataFrame: + condition = customers[~customers['id'].isin(orders['customerId'])] + return condition[['name']].rename(columns={'name': 'Customers'})