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 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