From 79f5bec537e911a4e99e697757fe61516e3c4a22 Mon Sep 17 00:00:00 2001 From: Punya Ira Anand Date: Mon, 24 Feb 2025 20:31:29 -0600 Subject: [PATCH 1/4] Create Big Countries --- Big Countries | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 Big Countries diff --git a/Big Countries b/Big Countries new file mode 100644 index 0000000..15d31c7 --- /dev/null +++ b/Big Countries @@ -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']] From 40911a073ab8391efb102df9ec67dcd05d811a3b Mon Sep 17 00:00:00 2001 From: Punya Ira Anand Date: Mon, 24 Feb 2025 20:32:04 -0600 Subject: [PATCH 2/4] Create Recyclable and Low Fat Products --- Recyclable and Low Fat Products | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 Recyclable and Low Fat Products diff --git a/Recyclable and Low Fat Products b/Recyclable and Low Fat Products new file mode 100644 index 0000000..fda9abd --- /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']] From 54b5bbc7f56435c239a223aa800fc7376673a994 Mon Sep 17 00:00:00 2001 From: Punya Ira Anand Date: Mon, 24 Feb 2025 20:32:36 -0600 Subject: [PATCH 3/4] Create Customers Who Never Order --- Customers Who Never Order | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 Customers Who Never Order diff --git a/Customers Who Never Order b/Customers Who Never Order new file mode 100644 index 0000000..4d47648 --- /dev/null +++ b/Customers Who Never Order @@ -0,0 +1,8 @@ +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'}) + df = customers.merge(orders, left_on="id", right_on ="customerId", how="left") + df = df[df["customerId"].isna()] + return df[['name']].rename(columns={'name':'Customers'}) From d07ab9c527da46d50d66c95fe0d6e713e2782543 Mon Sep 17 00:00:00 2001 From: Punya Ira Anand Date: Thu, 27 Feb 2025 17:48:37 -0600 Subject: [PATCH 4/4] Create Dataframe from a 2-D list --- Dataframe from a 2-D list | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 Dataframe from a 2-D list diff --git a/Dataframe from a 2-D list b/Dataframe from a 2-D list new file mode 100644 index 0000000..85fa7c1 --- /dev/null +++ b/Dataframe from a 2-D list @@ -0,0 +1,9 @@ +# import pandas as pd +import pandas as pd + +# List1 +lst = [['This is', 1], ['a', 2], ['learning', 3], ['program', 4]] + +# creating df object +df = pd.DataFrame(lst, columns =['Tag', 'number']) +print(df )