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
9 changes: 9 additions & 0 deletions BigCountries.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
'''
2 Problem 2 :Big Countries ( https://leetcode.com/problems/big-countries/ )
'''

import pandas as pd

def big_countries(world: pd.DataFrame) -> pd.DataFrame:
world = world[(world['population']>=25000000) | (world['area']>=3000000)]
return world[['name', 'population', 'area']]
9 changes: 9 additions & 0 deletions CustomerWhoNeverOrder.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
'''
4 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'})
13 changes: 13 additions & 0 deletions MakeAPandasDataFrameWithTwo-dimensionalList.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
'''Pandas1

1 Problem 1 : Make a Pandas DataFrame with two-dimensional list ( https://www.geeksforgeeks.org/make-a-pandas-dataframe-with-two-dimensional-list-python/)
'''

import pandas as pd

lst = [['Geek', 25], ['is', 30],
['for', 26], ['Geeksforgeeks', 22]]

df = pd.DataFrame(lst, columns =['Tag', 'number'])

print(df)
9 changes: 9 additions & 0 deletions RecyclableAndLowFatProducts.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
'''
3 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:
products = products[(products['low_fats'] == 'Y') & (products['recyclable'] == 'Y')]
return products[['product_id']]