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
40 changes: 40 additions & 0 deletions Big_Countries.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "7523eb55",
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"\n",
"def big_countries(world: pd.DataFrame) -> pd.DataFrame:\n",
" df = world[(world['area'] >= 3000000) | (world['population'] >= 25000000)]\n",
" df = df[['name', 'population', 'area']]\n",
" return df"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "base",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.4"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
42 changes: 42 additions & 0 deletions Customers_Who_Never_Order.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "3fa33433",
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"\n",
"def find_customers(customers: pd.DataFrame, orders: pd.DataFrame) -> pd.DataFrame:\n",
" customers_who_never_order = customers.merge(orders, how = 'left', left_on = 'id', right_on = 'customerId')\n",
"\n",
" result = customers_who_never_order[customers_who_never_order['customerId'].isna()]\n",
"\n",
" return result[['name']].rename(columns = {'name' : 'Customers'})"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "base",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.4"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
40 changes: 40 additions & 0 deletions Recylable_products.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "9f830b61",
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"\n",
"def find_products(products: pd.DataFrame) -> pd.DataFrame:\n",
" products = products[(products['low_fats'] == 'Y') & (products['recyclable'] == 'Y')]\n",
"\n",
" return products[['product_id']]"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "base",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.4"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
68 changes: 68 additions & 0 deletions pandas1.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "dbc756ab",
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "a6393141",
"metadata": {},
"outputs": [],
"source": [
"lstA = [['Geek', 25], ['is', 30], ['for', 26], ['GeeksforGeeks', 22]]"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "9e7317c8",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" Tag Number\n",
"0 Geek 25\n",
"1 is 30\n",
"2 for 26\n",
"3 GeeksforGeeks 22\n"
]
}
],
"source": [
"df = pd.DataFrame(lstA, columns = ['Tag', 'Number'])\n",
"print(df)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "base",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.4"
}
},
"nbformat": 4,
"nbformat_minor": 5
}