From dbe6cf8eb129fad49444693c8e008994e0d00e83 Mon Sep 17 00:00:00 2001 From: SukeshSrinivas <123338848+SukeshSrinivas@users.noreply.github.com> Date: Sun, 2 Mar 2025 13:06:38 -0600 Subject: [PATCH 1/2] Done --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a51355c..a781f87 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Pandas1 -1 Problem 1 : Make a Pandas DataFrame with two-dimensional list ( https://www.geeksforgeeks.org/make-a-pandas-dataframe-with-two-dimensional-list-python/) +1 Problem 1 : Make a Pandas DataFrame with two-dimensional list ( https://www.geeksfor geeks.org/make-a-pandas-dataframe-with-two-dimensional-list-python/) 2 Problem 2 :Big Countries ( https://leetcode.com/problems/big-countries/ ) From 3c7d0010844fc9b86d6899464036ee716734222a Mon Sep 17 00:00:00 2001 From: SukeshSrinivas <123338848+SukeshSrinivas@users.noreply.github.com> Date: Sun, 2 Mar 2025 13:10:57 -0600 Subject: [PATCH 2/2] Done --- Problem 2 BigCountries.py | 5 +++++ Problem 3 Recyclable and Low Fat Products.py | 4 ++++ Problem 4 Customer Who Never Order.py | 5 +++++ 3 files changed, 14 insertions(+) create mode 100644 Problem 2 BigCountries.py create mode 100644 Problem 3 Recyclable and Low Fat Products.py create mode 100644 Problem 4 Customer Who Never Order.py diff --git a/Problem 2 BigCountries.py b/Problem 2 BigCountries.py new file mode 100644 index 0000000..25a3b94 --- /dev/null +++ b/Problem 2 BigCountries.py @@ -0,0 +1,5 @@ +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/Problem 3 Recyclable and Low Fat Products.py b/Problem 3 Recyclable and Low Fat Products.py new file mode 100644 index 0000000..77d7111 --- /dev/null +++ b/Problem 3 Recyclable and Low Fat Products.py @@ -0,0 +1,4 @@ +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 diff --git a/Problem 4 Customer Who Never Order.py b/Problem 4 Customer Who Never Order.py new file mode 100644 index 0000000..5527024 --- /dev/null +++ b/Problem 4 Customer Who Never Order.py @@ -0,0 +1,5 @@ +import pandas as pd + +def find_customers(customers: pd.DataFrame, orders: pd.DataFrame) -> pd.DataFrame: + return customers[~customers['id'].isin(orders['customerId'])][['name']].rename(columns ={'name':'Customers'}) + \ No newline at end of file