From 3b697d80f5fe70ec88a1f6b51a8e2131bf336350 Mon Sep 17 00:00:00 2001 From: Arson Date: Fri, 21 Nov 2025 15:05:58 +0530 Subject: [PATCH 1/2] Fix: encoding parameter to read_csv --- ...ter a Dataframe Based on 1 Condition.ipynb | 18 ++++----- ...nal Column from 2 Choices np.where().ipynb | 39 ++++++++++--------- ...aframe Based on 2 or More Conditions.ipynb | 8 ++-- ...from More Than 2 Choices np.select().ipynb | 8 ++-- 04.Filtering Data/5.The .isin() Method.ipynb | 4 +- ...e Rows with the .duplicated() Method.ipynb | 4 +- ...s with the .drop_duplicates() Method.ipynb | 4 +- ...s The unique() and nunique() methods.ipynb | 4 +- ...ter a Dataframe Based on 1 Condition.ipynb | 2 +- ...nal Column from 2 Choices np.where().ipynb | 2 +- ...from More Than 2 Choices np.select().ipynb | 2 +- ...s with the .drop_duplicates() Method.ipynb | 12 +++++- 12 files changed, 58 insertions(+), 49 deletions(-) diff --git a/04.Filtering Data/1.Filter a Dataframe Based on 1 Condition.ipynb b/04.Filtering Data/1.Filter a Dataframe Based on 1 Condition.ipynb index 4ee9db4..e62de48 100644 --- a/04.Filtering Data/1.Filter a Dataframe Based on 1 Condition.ipynb +++ b/04.Filtering Data/1.Filter a Dataframe Based on 1 Condition.ipynb @@ -2,8 +2,8 @@ "cells": [ { "cell_type": "code", - "execution_count": 9, - "id": "acee6c9f", + "execution_count": null, + "id": "7e1b78c3", "metadata": {}, "outputs": [], "source": [ @@ -12,14 +12,12 @@ }, { "cell_type": "code", - "execution_count": 10, - "id": "5349f28e", - "metadata": { - "scrolled": false - }, + "execution_count": null, + "id": "226ff072", + "metadata": {}, "outputs": [], "source": [ - "df_laptops = pd.read_csv('laptop_price.csv')" + "df_laptops = pd.read_csv('laptop_price.csv', encoding='latin1')" ] }, { @@ -1089,7 +1087,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "base", "language": "python", "name": "python3" }, @@ -1103,7 +1101,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.8" + "version": "3.13.5" }, "toc": { "base_numbering": 1, diff --git a/04.Filtering Data/2.Creating a Conditional Column from 2 Choices np.where().ipynb b/04.Filtering Data/2.Creating a Conditional Column from 2 Choices np.where().ipynb index 9a9668d..75d28a4 100644 --- a/04.Filtering Data/2.Creating a Conditional Column from 2 Choices np.where().ipynb +++ b/04.Filtering Data/2.Creating a Conditional Column from 2 Choices np.where().ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": 2, "id": "932b054d", "metadata": {}, "outputs": [], @@ -12,19 +12,19 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "af2b9d82", "metadata": { "scrolled": false }, "outputs": [], "source": [ - "df_laptops = pd.read_csv('laptop_price.csv')" + "df_laptops = pd.read_csv('laptop_price.csv', encoding='latin1')" ] }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 4, "id": "1d57c715", "metadata": { "scrolled": true @@ -141,7 +141,7 @@ "2 575.00 " ] }, - "execution_count": 3, + "execution_count": 4, "metadata": {}, "output_type": "execute_result" } @@ -160,7 +160,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 5, "id": "25857fac", "metadata": {}, "outputs": [], @@ -178,7 +178,7 @@ "data": { "text/plain": [ "array(['Inexpensive', 'Inexpensive', 'Inexpensive', ..., 'Inexpensive',\n", - " 'Inexpensive', 'Inexpensive'], dtype=' Date: Sat, 22 Nov 2025 14:37:09 +0530 Subject: [PATCH 2/2] fix: update pivot_table for pandas 2.0+ compatibility --- 06.Pivot Table/1.pivot() and pivot_table().ipynb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/06.Pivot Table/1.pivot() and pivot_table().ipynb b/06.Pivot Table/1.pivot() and pivot_table().ipynb index 3f3c2f1..a472c45 100644 --- a/06.Pivot Table/1.pivot() and pivot_table().ipynb +++ b/06.Pivot Table/1.pivot() and pivot_table().ipynb @@ -572,7 +572,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "id": "6b55a187", "metadata": {}, "outputs": [ @@ -664,13 +664,13 @@ ], "source": [ "# make a pivot table and add an aggregate function\n", - "df_sales.pivot_table(index='Gender',\n", + "df_sales.select_dtypes(include='number').pivot_table(index=df_sales['Gender'],\n", " aggfunc='sum').round(1)" ] }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "id": "ae1e8501", "metadata": {}, "outputs": [ @@ -740,7 +740,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "id": "c02b115d", "metadata": {}, "outputs": [ @@ -827,7 +827,8 @@ "df_sales.pivot_table(index='Gender',\n", " columns='Product line',\n", " values='Total',\n", - " aggfunc='sum').round(1)" + " aggfunc='sum',\n", + " numeric_only=True).round(1)" ] } ],