From 91571fb520dd76ab4f86e4fbf77d60a1a6d0e8cd Mon Sep 17 00:00:00 2001 From: LinlyBoi Date: Tue, 28 Mar 2023 11:23:05 +0200 Subject: [PATCH] Integrating the data in the note book YIPPEEEE --- jupyter-notes/Panda Bamboo.ipynb | 65 ++++++++++++++++++++------------ 1 file changed, 41 insertions(+), 24 deletions(-) diff --git a/jupyter-notes/Panda Bamboo.ipynb b/jupyter-notes/Panda Bamboo.ipynb index 4ee8038..8b3f2db 100644 --- a/jupyter-notes/Panda Bamboo.ipynb +++ b/jupyter-notes/Panda Bamboo.ipynb @@ -36,9 +36,9 @@ "outputs": [], "source": [ "import pandas as pd\n", + "from tkinter.filedialog import askopenfilename\n", "filename = askopenfilename()\n", - "df1= pd.read_csv(filename)\n", - "from tkinter.filedialog import askopenfilename" + "df1= pd.read_csv(filename)" ] }, { @@ -64,27 +64,9 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - " Name\n", - "0 Baldur's Gate 3 Early Access \n", - "1 Control: Ultimate Edition Cloud Version \n", - "2 Doom Eternal: The Ancient Gods Part 1 \n", - "3 Watch Dogs: Legion \n", - "4 Ring Of Pain \n", - "5 Pikmin 3 Deluxe \n", - "6 Ghostrunner \n", - "7 Disc Room \n", - "8 NHL 21 \n", - "9 Noita \n" - ] - } - ], + "outputs": [], "source": [ "# CLeaning\n", "nuke=df1['GameName'].to_list()\n", @@ -121,7 +103,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# Integrating Game Sales with the previous cleaned data set" + "# Integrating Game Datasets together" ] }, { @@ -129,7 +111,42 @@ "execution_count": null, "metadata": {}, "outputs": [], - "source": [] + "source": [ + "\n", + "filename = askopenfilename()\n", + "df2 = pd.read_csv(filename)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# merged = pd.merge(df1,df2, how='inner', sort=True) DOES NOT WORK\n", + "# print(merged.head(10))\n", + "merged = df2.join(df1, lsuffix='merged') #Good\n", + "print(merged.head(10))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "merged2.to_csv('merged_games.csv')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "print(df1[['Name']].head(100))\n", + "print(df2[['Name']].head(100))" + ] } ], "metadata": {