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
5 changes: 5 additions & 0 deletions Big Countries
Original file line number Diff line number Diff line change
@@ -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']]
8 changes: 8 additions & 0 deletions Customers Who Never Order
Original file line number Diff line number Diff line change
@@ -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'})
9 changes: 9 additions & 0 deletions Dataframe from a 2-D list
Original file line number Diff line number Diff line change
@@ -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 )
5 changes: 5 additions & 0 deletions Recyclable and Low Fat Products
Original file line number Diff line number Diff line change
@@ -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']]