diff --git a/BigCountries.py b/BigCountries.py new file mode 100644 index 0000000..a36536e --- /dev/null +++ b/BigCountries.py @@ -0,0 +1,7 @@ +import pandas as pd + +def big_countries(world: pd.DataFrame) -> pd.DataFrame: + big_count= world[(world['population'] >= 25000000) | (world['area'] >= 3000000)] + return big_count[['name', 'population', 'area']] + + \ No newline at end of file diff --git a/CustomerWhoNeverOrder.py b/CustomerWhoNeverOrder.py new file mode 100644 index 0000000..3acb02b --- /dev/null +++ b/CustomerWhoNeverOrder.py @@ -0,0 +1,6 @@ +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'].isna()] + return df[['name']].rename(columns = {'name' : 'Customers'}) \ No newline at end of file diff --git a/MakeAPandasDataFrameWithTwo-dimensionalList.py b/MakeAPandasDataFrameWithTwo-dimensionalList.py new file mode 100644 index 0000000..0c2050f --- /dev/null +++ b/MakeAPandasDataFrameWithTwo-dimensionalList.py @@ -0,0 +1,10 @@ +# import pandas as pd +import pandas as pd + +# List1 +lst = [['Geek', 25], ['is', 30], + ['for', 26], ['Geeksforgeeks', 22]] + +# creating df object with columns specified +df = pd.DataFrame(lst, columns =['Tag', 'number']) +print(df ) \ No newline at end of file diff --git a/RecyclableAndLowFatProducts.py b/RecyclableAndLowFatProducts.py new file mode 100644 index 0000000..59a805a --- /dev/null +++ b/RecyclableAndLowFatProducts.py @@ -0,0 +1,6 @@ +import pandas as pd + +def find_products(products: pd.DataFrame) -> pd.DataFrame: + prod= products[(products["low_fats"]=="Y")& (products["recyclable"]=="Y")] + return prod[['product_id']] + \ No newline at end of file