From d77683674f1e0985b9ce554f87acb2c2cdf72d10 Mon Sep 17 00:00:00 2001 From: Arushi Bhambri Date: Wed, 23 Jul 2025 15:33:53 -0700 Subject: [PATCH 1/2] =?UTF-8?q?Added=20Pandas1=20Q1=E2=80=93Q4=20solutions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Big_Countries.ipynb | 0 Customers_Who_Never_Order.ipynb | 0 Recylable_products.ipynb | 0 pandas1.ipynb | 68 +++++++++++++++++++++++++++++++++ 4 files changed, 68 insertions(+) create mode 100644 Big_Countries.ipynb create mode 100644 Customers_Who_Never_Order.ipynb create mode 100644 Recylable_products.ipynb create mode 100644 pandas1.ipynb diff --git a/Big_Countries.ipynb b/Big_Countries.ipynb new file mode 100644 index 0000000..e69de29 diff --git a/Customers_Who_Never_Order.ipynb b/Customers_Who_Never_Order.ipynb new file mode 100644 index 0000000..e69de29 diff --git a/Recylable_products.ipynb b/Recylable_products.ipynb new file mode 100644 index 0000000..e69de29 diff --git a/pandas1.ipynb b/pandas1.ipynb new file mode 100644 index 0000000..2f14c19 --- /dev/null +++ b/pandas1.ipynb @@ -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 +} From 23bdcf5e3dab0d7568db29fee6eb3d06d2928e30 Mon Sep 17 00:00:00 2001 From: Arushi Bhambri Date: Wed, 23 Jul 2025 16:29:11 -0700 Subject: [PATCH 2/2] Added Pandas1 repush solutions --- Big_Countries.ipynb | 40 +++++++++++++++++++++++++++++++ Customers_Who_Never_Order.ipynb | 42 +++++++++++++++++++++++++++++++++ Recylable_products.ipynb | 40 +++++++++++++++++++++++++++++++ 3 files changed, 122 insertions(+) diff --git a/Big_Countries.ipynb b/Big_Countries.ipynb index e69de29..ee451fd 100644 --- a/Big_Countries.ipynb +++ b/Big_Countries.ipynb @@ -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 +} diff --git a/Customers_Who_Never_Order.ipynb b/Customers_Who_Never_Order.ipynb index e69de29..a94b26d 100644 --- a/Customers_Who_Never_Order.ipynb +++ b/Customers_Who_Never_Order.ipynb @@ -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 +} diff --git a/Recylable_products.ipynb b/Recylable_products.ipynb index e69de29..d5f5d16 100644 --- a/Recylable_products.ipynb +++ b/Recylable_products.ipynb @@ -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 +}