diff --git a/BigCountries.py b/BigCountries.py new file mode 100644 index 0000000..a96406d --- /dev/null +++ b/BigCountries.py @@ -0,0 +1,7 @@ +import pandas as pd + +def big_countries(world: pd.DataFrame) -> pd.DataFrame: + return world.loc[ + (world['area'] >= 3000000) | (world['population'] >= 25000000), + ['name', 'population','area']] + \ No newline at end of file diff --git a/LowFatProduct.py b/LowFatProduct.py new file mode 100644 index 0000000..6d54813 --- /dev/null +++ b/LowFatProduct.py @@ -0,0 +1,4 @@ +import pandas as pd + +def find_products(products: pd.DataFrame) -> pd.DataFrame: + return products.loc[(products['low_fats'] == 'Y') & (products['recyclable'] == 'Y'), ['product_id']] \ No newline at end of file diff --git a/PandasDataFrameFromList.py b/PandasDataFrameFromList.py new file mode 100644 index 0000000..202b808 --- /dev/null +++ b/PandasDataFrameFromList.py @@ -0,0 +1,6 @@ +import pandas as pd +lst = [['Geek', 25], ['is', 30], + ['for', 26], ['GeeksforGeeks', 22]] +df = pd.DataFrame(lst, columns=['Tag', 'number']) +print(df) +