Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions 02-BigCountries.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Problem 2 - Big Countries ( https://leetcode.com/problems/big-countries/ )
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']]
6 changes: 6 additions & 0 deletions 03-RecyclableandLowFatProducts.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Problem 3 - Recyclable and Low Fat Products ( https://leetcode.com/problems/recyclable-and-low-fat-products/ )
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']]
6 changes: 6 additions & 0 deletions 04-CustomersWhoNeverOrder.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Problem 4 - Customer Who Never Order ( https://leetcode.com/problems/customers-who-never-order/ )
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'})