{ "cells": [ { "cell_type": "markdown", "id": "005327de", "metadata": {}, "source": [ "# lib & files" ] }, { "cell_type": "code", "execution_count": 170, "id": "50d4f4c3", "metadata": {}, "outputs": [], "source": [ "#Library\n", "import ast\n", "import pandas as pd\n", "import re\n", "\n", "\n", "#Display all columns\n", "pd.options.display.max_columns = 400" ] }, { "cell_type": "markdown", "id": "5a916867", "metadata": {}, "source": [ "---" ] }, { "cell_type": "markdown", "id": "750febde", "metadata": {}, "source": [ "# Animes" ] }, { "cell_type": "code", "execution_count": 171, "id": "588fe03f", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
uidtitlesynopsisgenreairedepisodesmemberspopularityrankedscoreimg_urllink
028891Haikyuu!! Second SeasonFollowing their participation at the Inter-High, the Karasuno High School volleyball team attempts to refocus their efforts, aiming to conquer the Spring tournament instead. \\r\\n \\r\\nWhen they receive an invitation from long-standing rival Nekoma High, Karasuno agrees to take part in a large tr...['Comedy', 'Sports', 'Drama', 'School', 'Shounen']Oct 4, 2015 to Mar 27, 201625.048988814125.08.82https://cdn.myanimelist.net/images/anime/9/76662.jpghttps://myanimelist.net/anime/28891/Haikyuu_Second_Season
123273Shigatsu wa Kimi no UsoMusic accompanies the path of the human metronome, the prodigious pianist Kousei Arima. But after the passing of his mother, Saki Arima, Kousei falls into a downward spiral, rendering him unable to hear the sound of his own piano. \\r\\n \\r\\nTwo years later, Kousei still avoids the piano, leaving...['Drama', 'Music', 'Romance', 'School', 'Shounen']Oct 10, 2014 to Mar 20, 201522.09954732824.08.83https://cdn.myanimelist.net/images/anime/3/67177.jpghttps://myanimelist.net/anime/23273/Shigatsu_wa_Kimi_no_Uso
234599Made in AbyssThe Abyss—a gaping chasm stretching down into the depths of the earth, filled with mysterious creatures and relics from a time long past. How did it come to be? What lies at the bottom? Countless brave individuals, known as Divers, have sought to solve these mysteries of the Abyss, fearlessly de...['Sci-Fi', 'Adventure', 'Mystery', 'Drama', 'Fantasy']Jul 7, 2017 to Sep 29, 201713.05816639823.08.83https://cdn.myanimelist.net/images/anime/6/86733.jpghttps://myanimelist.net/anime/34599/Made_in_Abyss
35114Fullmetal Alchemist: Brotherhood\"In order for something to be obtained, something of equal value must be lost.\" \\r\\n \\r\\nAlchemy is bound by this Law of Equivalent Exchange—something the young brothers Edward and Alphonse Elric only realize after attempting human transmutation: the one forbidden act of alchemy. They pay a terr...['Action', 'Military', 'Adventure', 'Comedy', 'Drama', 'Magic', 'Fantasy', 'Shounen']Apr 5, 2009 to Jul 4, 201064.0161508441.09.23https://cdn.myanimelist.net/images/anime/1223/96541.jpghttps://myanimelist.net/anime/5114/Fullmetal_Alchemist__Brotherhood
431758Kizumonogatari III: Reiketsu-henAfter helping revive the legendary vampire Kiss-shot Acerola-orion Heart-under-blade, Koyomi Araragi has become a vampire himself and her servant. Kiss-shot is certain she can turn him back into a human, but only once regaining her full power. \\r\\n \\r\\nAraragi has hunted down the three vampire ...['Action', 'Mystery', 'Supernatural', 'Vampire']Jan 6, 20171.021462150222.08.83https://cdn.myanimelist.net/images/anime/3/81576.jpghttps://myanimelist.net/anime/31758/Kizumonogatari_III__Reiketsu-hen
\n", "
" ], "text/plain": [ " uid title \\\n", "0 28891 Haikyuu!! Second Season \n", "1 23273 Shigatsu wa Kimi no Uso \n", "2 34599 Made in Abyss \n", "3 5114 Fullmetal Alchemist: Brotherhood \n", "4 31758 Kizumonogatari III: Reiketsu-hen \n", "\n", " synopsis \\\n", "0 Following their participation at the Inter-High, the Karasuno High School volleyball team attempts to refocus their efforts, aiming to conquer the Spring tournament instead. \\r\\n \\r\\nWhen they receive an invitation from long-standing rival Nekoma High, Karasuno agrees to take part in a large tr... \n", "1 Music accompanies the path of the human metronome, the prodigious pianist Kousei Arima. But after the passing of his mother, Saki Arima, Kousei falls into a downward spiral, rendering him unable to hear the sound of his own piano. \\r\\n \\r\\nTwo years later, Kousei still avoids the piano, leaving... \n", "2 The Abyss—a gaping chasm stretching down into the depths of the earth, filled with mysterious creatures and relics from a time long past. How did it come to be? What lies at the bottom? Countless brave individuals, known as Divers, have sought to solve these mysteries of the Abyss, fearlessly de... \n", "3 \"In order for something to be obtained, something of equal value must be lost.\" \\r\\n \\r\\nAlchemy is bound by this Law of Equivalent Exchange—something the young brothers Edward and Alphonse Elric only realize after attempting human transmutation: the one forbidden act of alchemy. They pay a terr... \n", "4 After helping revive the legendary vampire Kiss-shot Acerola-orion Heart-under-blade, Koyomi Araragi has become a vampire himself and her servant. Kiss-shot is certain she can turn him back into a human, but only once regaining her full power. \\r\\n \\r\\nAraragi has hunted down the three vampire ... \n", "\n", " genre \\\n", "0 ['Comedy', 'Sports', 'Drama', 'School', 'Shounen'] \n", "1 ['Drama', 'Music', 'Romance', 'School', 'Shounen'] \n", "2 ['Sci-Fi', 'Adventure', 'Mystery', 'Drama', 'Fantasy'] \n", "3 ['Action', 'Military', 'Adventure', 'Comedy', 'Drama', 'Magic', 'Fantasy', 'Shounen'] \n", "4 ['Action', 'Mystery', 'Supernatural', 'Vampire'] \n", "\n", " aired episodes members popularity ranked score \\\n", "0 Oct 4, 2015 to Mar 27, 2016 25.0 489888 141 25.0 8.82 \n", "1 Oct 10, 2014 to Mar 20, 2015 22.0 995473 28 24.0 8.83 \n", "2 Jul 7, 2017 to Sep 29, 2017 13.0 581663 98 23.0 8.83 \n", "3 Apr 5, 2009 to Jul 4, 2010 64.0 1615084 4 1.0 9.23 \n", "4 Jan 6, 2017 1.0 214621 502 22.0 8.83 \n", "\n", " img_url \\\n", "0 https://cdn.myanimelist.net/images/anime/9/76662.jpg \n", "1 https://cdn.myanimelist.net/images/anime/3/67177.jpg \n", "2 https://cdn.myanimelist.net/images/anime/6/86733.jpg \n", "3 https://cdn.myanimelist.net/images/anime/1223/96541.jpg \n", "4 https://cdn.myanimelist.net/images/anime/3/81576.jpg \n", "\n", " link \n", "0 https://myanimelist.net/anime/28891/Haikyuu_Second_Season \n", "1 https://myanimelist.net/anime/23273/Shigatsu_wa_Kimi_no_Uso \n", "2 https://myanimelist.net/anime/34599/Made_in_Abyss \n", "3 https://myanimelist.net/anime/5114/Fullmetal_Alchemist__Brotherhood \n", "4 https://myanimelist.net/anime/31758/Kizumonogatari_III__Reiketsu-hen " ] }, "execution_count": 171, "metadata": {}, "output_type": "execute_result" } ], "source": [ "#files \n", "data = pd.read_csv('https://anime-recommendation-engine.s3.eu-west-3.amazonaws.com/data/animes.csv')\n", "data.head()" ] }, { "cell_type": "code", "execution_count": 172, "id": "a4a50747", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Number of rows : 19311\n", "Number of columns : 12\n", "Basics statistics: \n" ] }, { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
uidtitlesynopsisgenreairedepisodesmemberspopularityrankedscoreimg_urllink
count19311.0000001931118336193111931118605.0000001.931100e+0419311.00000016099.00000018732.0000001913119311
uniqueNaN1621415194485111127NaNNaNNaNNaNNaN1605116216
topNaNHakkenden: Touhou Hakken Ibun 2nd SeasonNo synopsis has been added for this series yet. \\r\\n \\r\\n Click here to update this information.['Hentai']Not availableNaNNaNNaNNaNNaNhttps://cdn.myanimelist.net/images/anime/1071/94957.jpghttps://myanimelist.net/anime/18055/Hakkenden__Touhou_Hakken_Ibun_2nd_Season
freqNaN3461837372NaNNaNNaNNaNNaN33
mean19358.904096NaNNaNNaNNaN11.4604143.472609e+047720.8303046866.5241946.436107NaNNaN
std14271.446515NaNNaNNaNNaN47.9503861.121772e+054676.7861044390.0187681.007941NaNNaN
min1.000000NaNNaNNaNNaN1.0000002.500000e+011.0000001.0000001.250000NaNNaN
25%4833.500000NaNNaNNaNNaN1.0000003.880000e+023725.0000002895.5000005.770000NaNNaN
50%18327.000000NaNNaNNaNNaN2.0000002.389000e+037539.0000006963.0000006.410000NaNNaN
75%33896.500000NaNNaNNaNNaN12.0000001.450150e+0411613.00000010601.5000007.150000NaNNaN
max40960.000000NaNNaNNaNNaN3057.0000001.871043e+0616338.00000014675.0000009.230000NaNNaN
\n", "
" ], "text/plain": [ " uid title \\\n", "count 19311.000000 19311 \n", "unique NaN 16214 \n", "top NaN Hakkenden: Touhou Hakken Ibun 2nd Season \n", "freq NaN 3 \n", "mean 19358.904096 NaN \n", "std 14271.446515 NaN \n", "min 1.000000 NaN \n", "25% 4833.500000 NaN \n", "50% 18327.000000 NaN \n", "75% 33896.500000 NaN \n", "max 40960.000000 NaN \n", "\n", " synopsis \\\n", "count 18336 \n", "unique 15194 \n", "top No synopsis has been added for this series yet. \\r\\n \\r\\n Click here to update this information. \n", "freq 46 \n", "mean NaN \n", "std NaN \n", "min NaN \n", "25% NaN \n", "50% NaN \n", "75% NaN \n", "max NaN \n", "\n", " genre aired episodes members popularity \\\n", "count 19311 19311 18605.000000 1.931100e+04 19311.000000 \n", "unique 4851 11127 NaN NaN NaN \n", "top ['Hentai'] Not available NaN NaN NaN \n", "freq 1837 372 NaN NaN NaN \n", "mean NaN NaN 11.460414 3.472609e+04 7720.830304 \n", "std NaN NaN 47.950386 1.121772e+05 4676.786104 \n", "min NaN NaN 1.000000 2.500000e+01 1.000000 \n", "25% NaN NaN 1.000000 3.880000e+02 3725.000000 \n", "50% NaN NaN 2.000000 2.389000e+03 7539.000000 \n", "75% NaN NaN 12.000000 1.450150e+04 11613.000000 \n", "max NaN NaN 3057.000000 1.871043e+06 16338.000000 \n", "\n", " ranked score \\\n", "count 16099.000000 18732.000000 \n", "unique NaN NaN \n", "top NaN NaN \n", "freq NaN NaN \n", "mean 6866.524194 6.436107 \n", "std 4390.018768 1.007941 \n", "min 1.000000 1.250000 \n", "25% 2895.500000 5.770000 \n", "50% 6963.000000 6.410000 \n", "75% 10601.500000 7.150000 \n", "max 14675.000000 9.230000 \n", "\n", " img_url \\\n", "count 19131 \n", "unique 16051 \n", "top https://cdn.myanimelist.net/images/anime/1071/94957.jpg \n", "freq 3 \n", "mean NaN \n", "std NaN \n", "min NaN \n", "25% NaN \n", "50% NaN \n", "75% NaN \n", "max NaN \n", "\n", " link \n", "count 19311 \n", "unique 16216 \n", "top https://myanimelist.net/anime/18055/Hakkenden__Touhou_Hakken_Ibun_2nd_Season \n", "freq 3 \n", "mean NaN \n", "std NaN \n", "min NaN \n", "25% NaN \n", "50% NaN \n", "75% NaN \n", "max NaN " ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "Percentage of missing values: \n", "uid 0.000000\n", "title 0.000000\n", "synopsis 0.050489\n", "genre 0.000000\n", "aired 0.000000\n", "episodes 0.036559\n", "members 0.000000\n", "popularity 0.000000\n", "ranked 0.166330\n", "score 0.029983\n", "img_url 0.009321\n", "link 0.000000\n", "dtype: float64\n" ] } ], "source": [ "# Basic stats\n", "print(f\"Number of rows : {data.shape[0]}\")\n", "print(f\"Number of columns : {data.shape[1]}\")\n", "\n", "print(\"Basics statistics: \")\n", "display(data.describe(include='all'))\n", "\n", "print(\"Percentage of missing values: \")\n", "print(data.isna() .sum() / data.shape[0])" ] }, { "cell_type": "markdown", "id": "9e6f951f", "metadata": {}, "source": [ "### EDA" ] }, { "cell_type": "markdown", "id": "d1ba9515", "metadata": {}, "source": [ "##### UID" ] }, { "cell_type": "code", "execution_count": 173, "id": "6dbe5933", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "uid\n", "18055 3\n", "150 3\n", "40269 3\n", "1293 3\n", "2405 3\n", " ..\n", "32778 1\n", "9509 1\n", "34422 1\n", "30404 1\n", "16934 1\n", "Name: count, Length: 16216, dtype: int64" ] }, "execution_count": 173, "metadata": {}, "output_type": "execute_result" } ], "source": [ "data['uid'].value_counts()" ] }, { "cell_type": "code", "execution_count": 174, "id": "f36a222e", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "16216" ] }, "execution_count": 174, "metadata": {}, "output_type": "execute_result" } ], "source": [ "data['uid'].nunique()" ] }, { "cell_type": "markdown", "id": "7ce31b74", "metadata": {}, "source": [ "##### synopsis" ] }, { "cell_type": "code", "execution_count": 175, "id": "8585a0cc", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "414.40930410122166" ] }, "execution_count": 175, "metadata": {}, "output_type": "execute_result" } ], "source": [ "data['synopsis'].str.len().mean()" ] }, { "cell_type": "code", "execution_count": 176, "id": "8c7101b7", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "\"Music accompanies the path of the human metronome, the prodigious pianist Kousei Arima. But after the passing of his mother, Saki Arima, Kousei falls into a downward spiral, rendering him unable to hear the sound of his own piano. \\r\\n \\r\\nTwo years later, Kousei still avoids the piano, leaving behind his admirers and rivals, and lives a colorless life alongside his friends Tsubaki Sawabe and Ryouta Watari. However, everything changes when he meets a beautiful violinist, Kaori Miyazono, who stirs up his world and sets him on a journey to face music again. \\r\\n \\r\\nBased on the manga series of the same name, Shigatsu wa Kimi no Uso approaches the story of Kousei's recovery as he discovers that music is more than playing each note perfectly, and a single melody can bring in the fresh spring air of April. \\r\\n \\r\\n[Written by MAL Rewrite]\"" ] }, "execution_count": 176, "metadata": {}, "output_type": "execute_result" } ], "source": [ "data['synopsis'][1]" ] }, { "cell_type": "markdown", "id": "ae68374e", "metadata": {}, "source": [ "episode" ] }, { "cell_type": "code", "execution_count": 177, "id": "c9aa592b", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "numpy.float64" ] }, "execution_count": 177, "metadata": {}, "output_type": "execute_result" } ], "source": [ "type(data['episodes'][0])" ] }, { "cell_type": "code", "execution_count": 178, "id": "2fefe9d7", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "episodes\n", "1.0 8807\n", "2.0 1943\n", "12.0 1436\n", "13.0 825\n", "3.0 784\n", " ... \n", "3057.0 1\n", "224.0 1\n", "431.0 1\n", "1565.0 1\n", "146.0 1\n", "Name: count, Length: 199, dtype: int64" ] }, "execution_count": 178, "metadata": {}, "output_type": "execute_result" } ], "source": [ "data['episodes'].value_counts()" ] }, { "cell_type": "code", "execution_count": 179, "id": "104a9f00", "metadata": {}, "outputs": [], "source": [ "data[\"episodes\"] = data[\"episodes\"].astype(\"Int64\")" ] }, { "cell_type": "code", "execution_count": 180, "id": "c4731aba", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "episodes\n", "1 8807\n", "2 1943\n", "12 1436\n", "13 825\n", "3 784\n", " ... \n", "3057 1\n", "224 1\n", "431 1\n", "1565 1\n", "146 1\n", "Name: count, Length: 199, dtype: Int64" ] }, "execution_count": 180, "metadata": {}, "output_type": "execute_result" } ], "source": [ "data['episodes'].value_counts()" ] }, { "cell_type": "markdown", "id": "cab421ca", "metadata": {}, "source": [ "##### genre" ] }, { "cell_type": "code", "execution_count": 181, "id": "deed1a5e", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "genre\n", "['Hentai'] 1837\n", "['Music'] 728\n", "['Comedy'] 642\n", "['Kids'] 412\n", "['Dementia'] 202\n", " ... \n", "['Drama', 'Fantasy', 'Mystery', 'Romance', 'School'] 1\n", "['Action', 'Comedy', 'Magic', 'Shounen', 'Super Power', 'Supernatural'] 1\n", "['Parody', 'Mecha', 'Sci-Fi'] 1\n", "['Action', 'Adventure', 'Fantasy', 'Comedy', 'Super Power', 'Shounen'] 1\n", "['Music', 'Romance', 'Super Power', 'Supernatural'] 1\n", "Name: count, Length: 4851, dtype: int64" ] }, "execution_count": 181, "metadata": {}, "output_type": "execute_result" } ], "source": [ "data['genre'].value_counts()" ] }, { "cell_type": "code", "execution_count": 182, "id": "417defec", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "str" ] }, "execution_count": 182, "metadata": {}, "output_type": "execute_result" } ], "source": [ "type(data['genre'][0])" ] }, { "cell_type": "code", "execution_count": 183, "id": "e579bd72", "metadata": {}, "outputs": [], "source": [ "data['genre'] = data['genre'].apply(ast.literal_eval)\n", "df_exploded = data.explode('genre')" ] }, { "cell_type": "code", "execution_count": 184, "id": "3a87e2dc", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "genre\n", "Comedy 6461\n", "Action 4215\n", "Fantasy 3466\n", "Adventure 3143\n", "Drama 3004\n", "Sci-Fi 2832\n", "Hentai 2574\n", "Kids 2549\n", "Shounen 2322\n", "Romance 2152\n", "Slice of Life 2056\n", "Music 1993\n", "School 1912\n", "Supernatural 1719\n", "Historical 1218\n", "Mecha 1197\n", "Magic 1174\n", "Seinen 982\n", "Mystery 874\n", "Sports 811\n", "Ecchi 805\n", "Shoujo 788\n", "Super Power 716\n", "Parody 702\n", "Military 678\n", "Demons 605\n", "Space 564\n", "Horror 511\n", "Harem 435\n", "Martial Arts 424\n", "Dementia 419\n", "Psychological 415\n", "Game 395\n", "Police 301\n", "Samurai 238\n", "Vampire 165\n", "Thriller 161\n", "Cars 133\n", "Josei 115\n", "Shounen Ai 113\n", "Shoujo Ai 87\n", "Yuri 79\n", "Yaoi 78\n", "Name: count, dtype: int64" ] }, "execution_count": 184, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_exploded['genre'].value_counts()" ] }, { "cell_type": "code", "execution_count": 185, "id": "8208c5a1", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "43" ] }, "execution_count": 185, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_exploded['genre'].nunique()" ] }, { "cell_type": "code", "execution_count": 186, "id": "88443d54", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
uidtitlesynopsisgenreairedepisodesmemberspopularityrankedscoreimg_urllink
028891Haikyuu!! Second SeasonFollowing their participation at the Inter-High, the Karasuno High School volleyball team attempts to refocus their efforts, aiming to conquer the Spring tournament instead. \\r\\n \\r\\nWhen they receive an invitation from long-standing rival Nekoma High, Karasuno agrees to take part in a large tr...ComedyOct 4, 2015 to Mar 27, 20162548988814125.08.82https://cdn.myanimelist.net/images/anime/9/76662.jpghttps://myanimelist.net/anime/28891/Haikyuu_Second_Season
028891Haikyuu!! Second SeasonFollowing their participation at the Inter-High, the Karasuno High School volleyball team attempts to refocus their efforts, aiming to conquer the Spring tournament instead. \\r\\n \\r\\nWhen they receive an invitation from long-standing rival Nekoma High, Karasuno agrees to take part in a large tr...SportsOct 4, 2015 to Mar 27, 20162548988814125.08.82https://cdn.myanimelist.net/images/anime/9/76662.jpghttps://myanimelist.net/anime/28891/Haikyuu_Second_Season
028891Haikyuu!! Second SeasonFollowing their participation at the Inter-High, the Karasuno High School volleyball team attempts to refocus their efforts, aiming to conquer the Spring tournament instead. \\r\\n \\r\\nWhen they receive an invitation from long-standing rival Nekoma High, Karasuno agrees to take part in a large tr...DramaOct 4, 2015 to Mar 27, 20162548988814125.08.82https://cdn.myanimelist.net/images/anime/9/76662.jpghttps://myanimelist.net/anime/28891/Haikyuu_Second_Season
028891Haikyuu!! Second SeasonFollowing their participation at the Inter-High, the Karasuno High School volleyball team attempts to refocus their efforts, aiming to conquer the Spring tournament instead. \\r\\n \\r\\nWhen they receive an invitation from long-standing rival Nekoma High, Karasuno agrees to take part in a large tr...SchoolOct 4, 2015 to Mar 27, 20162548988814125.08.82https://cdn.myanimelist.net/images/anime/9/76662.jpghttps://myanimelist.net/anime/28891/Haikyuu_Second_Season
028891Haikyuu!! Second SeasonFollowing their participation at the Inter-High, the Karasuno High School volleyball team attempts to refocus their efforts, aiming to conquer the Spring tournament instead. \\r\\n \\r\\nWhen they receive an invitation from long-standing rival Nekoma High, Karasuno agrees to take part in a large tr...ShounenOct 4, 2015 to Mar 27, 20162548988814125.08.82https://cdn.myanimelist.net/images/anime/9/76662.jpghttps://myanimelist.net/anime/28891/Haikyuu_Second_Season
\n", "
" ], "text/plain": [ " uid title \\\n", "0 28891 Haikyuu!! Second Season \n", "0 28891 Haikyuu!! Second Season \n", "0 28891 Haikyuu!! Second Season \n", "0 28891 Haikyuu!! Second Season \n", "0 28891 Haikyuu!! Second Season \n", "\n", " synopsis \\\n", "0 Following their participation at the Inter-High, the Karasuno High School volleyball team attempts to refocus their efforts, aiming to conquer the Spring tournament instead. \\r\\n \\r\\nWhen they receive an invitation from long-standing rival Nekoma High, Karasuno agrees to take part in a large tr... \n", "0 Following their participation at the Inter-High, the Karasuno High School volleyball team attempts to refocus their efforts, aiming to conquer the Spring tournament instead. \\r\\n \\r\\nWhen they receive an invitation from long-standing rival Nekoma High, Karasuno agrees to take part in a large tr... \n", "0 Following their participation at the Inter-High, the Karasuno High School volleyball team attempts to refocus their efforts, aiming to conquer the Spring tournament instead. \\r\\n \\r\\nWhen they receive an invitation from long-standing rival Nekoma High, Karasuno agrees to take part in a large tr... \n", "0 Following their participation at the Inter-High, the Karasuno High School volleyball team attempts to refocus their efforts, aiming to conquer the Spring tournament instead. \\r\\n \\r\\nWhen they receive an invitation from long-standing rival Nekoma High, Karasuno agrees to take part in a large tr... \n", "0 Following their participation at the Inter-High, the Karasuno High School volleyball team attempts to refocus their efforts, aiming to conquer the Spring tournament instead. \\r\\n \\r\\nWhen they receive an invitation from long-standing rival Nekoma High, Karasuno agrees to take part in a large tr... \n", "\n", " genre aired episodes members popularity \\\n", "0 Comedy Oct 4, 2015 to Mar 27, 2016 25 489888 141 \n", "0 Sports Oct 4, 2015 to Mar 27, 2016 25 489888 141 \n", "0 Drama Oct 4, 2015 to Mar 27, 2016 25 489888 141 \n", "0 School Oct 4, 2015 to Mar 27, 2016 25 489888 141 \n", "0 Shounen Oct 4, 2015 to Mar 27, 2016 25 489888 141 \n", "\n", " ranked score img_url \\\n", "0 25.0 8.82 https://cdn.myanimelist.net/images/anime/9/76662.jpg \n", "0 25.0 8.82 https://cdn.myanimelist.net/images/anime/9/76662.jpg \n", "0 25.0 8.82 https://cdn.myanimelist.net/images/anime/9/76662.jpg \n", "0 25.0 8.82 https://cdn.myanimelist.net/images/anime/9/76662.jpg \n", "0 25.0 8.82 https://cdn.myanimelist.net/images/anime/9/76662.jpg \n", "\n", " link \n", "0 https://myanimelist.net/anime/28891/Haikyuu_Second_Season \n", "0 https://myanimelist.net/anime/28891/Haikyuu_Second_Season \n", "0 https://myanimelist.net/anime/28891/Haikyuu_Second_Season \n", "0 https://myanimelist.net/anime/28891/Haikyuu_Second_Season \n", "0 https://myanimelist.net/anime/28891/Haikyuu_Second_Season " ] }, "execution_count": 186, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_exploded.head()" ] }, { "cell_type": "markdown", "id": "ede01438", "metadata": {}, "source": [ "### Cleaning Dataset" ] }, { "cell_type": "code", "execution_count": 187, "id": "69a5f2f8", "metadata": {}, "outputs": [], "source": [ "df = data.drop_duplicates('uid')\n", "#df = df.dropna(subset='synopsis')" ] }, { "cell_type": "code", "execution_count": 188, "id": "a7a11de3", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
uidtitlesynopsisgenreairedepisodesmemberspopularityrankedscoreimg_urllink
028891Haikyuu!! Second SeasonFollowing their participation at the Inter-High, the Karasuno High School volleyball team attempts to refocus their efforts, aiming to conquer the Spring tournament instead. \\r\\n \\r\\nWhen they receive an invitation from long-standing rival Nekoma High, Karasuno agrees to take part in a large tr...[Comedy, Sports, Drama, School, Shounen]Oct 4, 2015 to Mar 27, 20162548988814125.08.82https://cdn.myanimelist.net/images/anime/9/76662.jpghttps://myanimelist.net/anime/28891/Haikyuu_Second_Season
123273Shigatsu wa Kimi no UsoMusic accompanies the path of the human metronome, the prodigious pianist Kousei Arima. But after the passing of his mother, Saki Arima, Kousei falls into a downward spiral, rendering him unable to hear the sound of his own piano. \\r\\n \\r\\nTwo years later, Kousei still avoids the piano, leaving...[Drama, Music, Romance, School, Shounen]Oct 10, 2014 to Mar 20, 2015229954732824.08.83https://cdn.myanimelist.net/images/anime/3/67177.jpghttps://myanimelist.net/anime/23273/Shigatsu_wa_Kimi_no_Uso
234599Made in AbyssThe Abyss—a gaping chasm stretching down into the depths of the earth, filled with mysterious creatures and relics from a time long past. How did it come to be? What lies at the bottom? Countless brave individuals, known as Divers, have sought to solve these mysteries of the Abyss, fearlessly de...[Sci-Fi, Adventure, Mystery, Drama, Fantasy]Jul 7, 2017 to Sep 29, 2017135816639823.08.83https://cdn.myanimelist.net/images/anime/6/86733.jpghttps://myanimelist.net/anime/34599/Made_in_Abyss
35114Fullmetal Alchemist: Brotherhood\"In order for something to be obtained, something of equal value must be lost.\" \\r\\n \\r\\nAlchemy is bound by this Law of Equivalent Exchange—something the young brothers Edward and Alphonse Elric only realize after attempting human transmutation: the one forbidden act of alchemy. They pay a terr...[Action, Military, Adventure, Comedy, Drama, Magic, Fantasy, Shounen]Apr 5, 2009 to Jul 4, 201064161508441.09.23https://cdn.myanimelist.net/images/anime/1223/96541.jpghttps://myanimelist.net/anime/5114/Fullmetal_Alchemist__Brotherhood
431758Kizumonogatari III: Reiketsu-henAfter helping revive the legendary vampire Kiss-shot Acerola-orion Heart-under-blade, Koyomi Araragi has become a vampire himself and her servant. Kiss-shot is certain she can turn him back into a human, but only once regaining her full power. \\r\\n \\r\\nAraragi has hunted down the three vampire ...[Action, Mystery, Supernatural, Vampire]Jan 6, 2017121462150222.08.83https://cdn.myanimelist.net/images/anime/3/81576.jpghttps://myanimelist.net/anime/31758/Kizumonogatari_III__Reiketsu-hen
\n", "
" ], "text/plain": [ " uid title \\\n", "0 28891 Haikyuu!! Second Season \n", "1 23273 Shigatsu wa Kimi no Uso \n", "2 34599 Made in Abyss \n", "3 5114 Fullmetal Alchemist: Brotherhood \n", "4 31758 Kizumonogatari III: Reiketsu-hen \n", "\n", " synopsis \\\n", "0 Following their participation at the Inter-High, the Karasuno High School volleyball team attempts to refocus their efforts, aiming to conquer the Spring tournament instead. \\r\\n \\r\\nWhen they receive an invitation from long-standing rival Nekoma High, Karasuno agrees to take part in a large tr... \n", "1 Music accompanies the path of the human metronome, the prodigious pianist Kousei Arima. But after the passing of his mother, Saki Arima, Kousei falls into a downward spiral, rendering him unable to hear the sound of his own piano. \\r\\n \\r\\nTwo years later, Kousei still avoids the piano, leaving... \n", "2 The Abyss—a gaping chasm stretching down into the depths of the earth, filled with mysterious creatures and relics from a time long past. How did it come to be? What lies at the bottom? Countless brave individuals, known as Divers, have sought to solve these mysteries of the Abyss, fearlessly de... \n", "3 \"In order for something to be obtained, something of equal value must be lost.\" \\r\\n \\r\\nAlchemy is bound by this Law of Equivalent Exchange—something the young brothers Edward and Alphonse Elric only realize after attempting human transmutation: the one forbidden act of alchemy. They pay a terr... \n", "4 After helping revive the legendary vampire Kiss-shot Acerola-orion Heart-under-blade, Koyomi Araragi has become a vampire himself and her servant. Kiss-shot is certain she can turn him back into a human, but only once regaining her full power. \\r\\n \\r\\nAraragi has hunted down the three vampire ... \n", "\n", " genre \\\n", "0 [Comedy, Sports, Drama, School, Shounen] \n", "1 [Drama, Music, Romance, School, Shounen] \n", "2 [Sci-Fi, Adventure, Mystery, Drama, Fantasy] \n", "3 [Action, Military, Adventure, Comedy, Drama, Magic, Fantasy, Shounen] \n", "4 [Action, Mystery, Supernatural, Vampire] \n", "\n", " aired episodes members popularity ranked score \\\n", "0 Oct 4, 2015 to Mar 27, 2016 25 489888 141 25.0 8.82 \n", "1 Oct 10, 2014 to Mar 20, 2015 22 995473 28 24.0 8.83 \n", "2 Jul 7, 2017 to Sep 29, 2017 13 581663 98 23.0 8.83 \n", "3 Apr 5, 2009 to Jul 4, 2010 64 1615084 4 1.0 9.23 \n", "4 Jan 6, 2017 1 214621 502 22.0 8.83 \n", "\n", " img_url \\\n", "0 https://cdn.myanimelist.net/images/anime/9/76662.jpg \n", "1 https://cdn.myanimelist.net/images/anime/3/67177.jpg \n", "2 https://cdn.myanimelist.net/images/anime/6/86733.jpg \n", "3 https://cdn.myanimelist.net/images/anime/1223/96541.jpg \n", "4 https://cdn.myanimelist.net/images/anime/3/81576.jpg \n", "\n", " link \n", "0 https://myanimelist.net/anime/28891/Haikyuu_Second_Season \n", "1 https://myanimelist.net/anime/23273/Shigatsu_wa_Kimi_no_Uso \n", "2 https://myanimelist.net/anime/34599/Made_in_Abyss \n", "3 https://myanimelist.net/anime/5114/Fullmetal_Alchemist__Brotherhood \n", "4 https://myanimelist.net/anime/31758/Kizumonogatari_III__Reiketsu-hen " ] }, "execution_count": 188, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df.head()" ] }, { "cell_type": "markdown", "id": "9fa3c567", "metadata": {}, "source": [ "### stats after cleaning" ] }, { "cell_type": "code", "execution_count": 189, "id": "6f48478d", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Number of rows : 16216\n", "Number of columns : 12\n", "Basics statistics: \n" ] }, { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
uidtitlesynopsisgenreairedepisodesmemberspopularityrankedscoreimg_urllink
count16216.0000001621615453162161621615724.01.621600e+0416216.00000014553.00000015875.0000001605116216
uniqueNaN1621415194485111127<NA>NaNNaNNaNNaN1605116216
topNaNHinamatsuriNo synopsis has been added for this series yet. \\r\\n \\r\\n Click here to update this information.[Hentai]Not available<NA>NaNNaNNaNNaNhttps://cdn.myanimelist.net/images/anime/9/76662.jpghttps://myanimelist.net/anime/28891/Haikyuu_Second_Season
freqNaN237923273<NA>NaNNaNNaNNaN11
mean19858.979588NaNNaNNaNNaN11.6579752.759189e+048161.1716217332.3753186.346466NaNNaN
std14197.712860NaNNaNNaNNaN48.9731259.388251e+044714.3174894235.7591340.972700NaNNaN
min1.000000NaNNaNNaNNaN1.02.500000e+011.0000001.0000001.250000NaNNaN
25%5303.750000NaNNaNNaNNaN1.02.920000e+024082.0000003659.0000005.700000NaNNaN
50%19856.000000NaNNaNNaNNaN2.01.839500e+038158.5000007337.0000006.370000NaNNaN
75%34086.500000NaNNaNNaNNaN12.01.160000e+0412243.25000010993.0000007.040000NaNNaN
max40960.000000NaNNaNNaNNaN3057.01.871043e+0616338.00000014675.0000009.230000NaNNaN
\n", "
" ], "text/plain": [ " uid title \\\n", "count 16216.000000 16216 \n", "unique NaN 16214 \n", "top NaN Hinamatsuri \n", "freq NaN 2 \n", "mean 19858.979588 NaN \n", "std 14197.712860 NaN \n", "min 1.000000 NaN \n", "25% 5303.750000 NaN \n", "50% 19856.000000 NaN \n", "75% 34086.500000 NaN \n", "max 40960.000000 NaN \n", "\n", " synopsis \\\n", "count 15453 \n", "unique 15194 \n", "top No synopsis has been added for this series yet. \\r\\n \\r\\n Click here to update this information. \n", "freq 37 \n", "mean NaN \n", "std NaN \n", "min NaN \n", "25% NaN \n", "50% NaN \n", "75% NaN \n", "max NaN \n", "\n", " genre aired episodes members popularity \\\n", "count 16216 16216 15724.0 1.621600e+04 16216.000000 \n", "unique 4851 11127 NaN NaN \n", "top [Hentai] Not available NaN NaN \n", "freq 923 273 NaN NaN \n", "mean NaN NaN 11.657975 2.759189e+04 8161.171621 \n", "std NaN NaN 48.973125 9.388251e+04 4714.317489 \n", "min NaN NaN 1.0 2.500000e+01 1.000000 \n", "25% NaN NaN 1.0 2.920000e+02 4082.000000 \n", "50% NaN NaN 2.0 1.839500e+03 8158.500000 \n", "75% NaN NaN 12.0 1.160000e+04 12243.250000 \n", "max NaN NaN 3057.0 1.871043e+06 16338.000000 \n", "\n", " ranked score \\\n", "count 14553.000000 15875.000000 \n", "unique NaN NaN \n", "top NaN NaN \n", "freq NaN NaN \n", "mean 7332.375318 6.346466 \n", "std 4235.759134 0.972700 \n", "min 1.000000 1.250000 \n", "25% 3659.000000 5.700000 \n", "50% 7337.000000 6.370000 \n", "75% 10993.000000 7.040000 \n", "max 14675.000000 9.230000 \n", "\n", " img_url \\\n", "count 16051 \n", "unique 16051 \n", "top https://cdn.myanimelist.net/images/anime/9/76662.jpg \n", "freq 1 \n", "mean NaN \n", "std NaN \n", "min NaN \n", "25% NaN \n", "50% NaN \n", "75% NaN \n", "max NaN \n", "\n", " link \n", "count 16216 \n", "unique 16216 \n", "top https://myanimelist.net/anime/28891/Haikyuu_Second_Season \n", "freq 1 \n", "mean NaN \n", "std NaN \n", "min NaN \n", "25% NaN \n", "50% NaN \n", "75% NaN \n", "max NaN " ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "Percentage of missing values: \n", "uid 0.000000\n", "title 0.000000\n", "synopsis 0.047052\n", "genre 0.000000\n", "aired 0.000000\n", "episodes 0.030340\n", "members 0.000000\n", "popularity 0.000000\n", "ranked 0.102553\n", "score 0.021029\n", "img_url 0.010175\n", "link 0.000000\n", "dtype: float64\n" ] } ], "source": [ "# Basic stats\n", "print(f\"Number of rows : {df.shape[0]}\")\n", "print(f\"Number of columns : {df.shape[1]}\")\n", "\n", "print(\"Basics statistics: \")\n", "display(df.describe(include='all'))\n", "\n", "print(\"Percentage of missing values: \")\n", "print(df.isna() .sum() / df.shape[0])" ] }, { "cell_type": "code", "execution_count": 190, "id": "bfa371d8", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "Index: 16216 entries, 0 to 19006\n", "Data columns (total 12 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 uid 16216 non-null int64 \n", " 1 title 16216 non-null object \n", " 2 synopsis 15453 non-null object \n", " 3 genre 16216 non-null object \n", " 4 aired 16216 non-null object \n", " 5 episodes 15724 non-null Int64 \n", " 6 members 16216 non-null int64 \n", " 7 popularity 16216 non-null int64 \n", " 8 ranked 14553 non-null float64\n", " 9 score 15875 non-null float64\n", " 10 img_url 16051 non-null object \n", " 11 link 16216 non-null object \n", "dtypes: Int64(1), float64(2), int64(3), object(6)\n", "memory usage: 1.6+ MB\n" ] } ], "source": [ "df.info()" ] }, { "cell_type": "code", "execution_count": 191, "id": "4583dfd3", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "int64\n" ] } ], "source": [ "print(df[\"uid\"].dtype) # Type de la colonne\n" ] }, { "cell_type": "code", "execution_count": 192, "id": "e2e5baf2", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " uid title \\\n", "1572 39518 Vampire in the Garden \n", "\n", " synopsis \\\n", "1572 Two girls, Momo and Fine, from different backgrounds who meet by chance. A story about an unlikely friendship between the human and vampire race that intertwines with the power of music. \\r\\n \\r\\n(Source: Netflix) \n", "\n", " genre aired episodes members popularity ranked score \\\n", "1572 [Vampire] Not available 445 11381 NaN NaN \n", "\n", " img_url link \n", "1572 NaN https://myanimelist.net/anime/39518/Vampire_in_the_Garden \n" ] } ], "source": [ "print(df[df[\"uid\"] == 39518.0])" ] }, { "cell_type": "code", "execution_count": 193, "id": "234a3e2c", "metadata": {}, "outputs": [], "source": [ "df.to_csv('../data/animes_clean.csv', index=False)" ] }, { "cell_type": "markdown", "id": "b6e381bb", "metadata": {}, "source": [ "---" ] }, { "cell_type": "markdown", "id": "403533c2", "metadata": {}, "source": [ "# Profiles" ] }, { "cell_type": "code", "execution_count": 194, "id": "c9196f57", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
profilegenderbirthdayfavorites_animelink
0DesolatePsycheMaleOct 2, 1994['33352', '25013', '5530', '33674', '1482', '269', '18245', '2904', '27899', '17074', '12291', '226', '28851', '8525', '6594', '4981', '1698', '457', '235', '34618']https://myanimelist.net/profile/DesolatePsyche
1baekbeansFemaleNov 10, 2000['11061', '31964', '853', '20583', '918', '9253', '34599', '3588', '13601', '6956']https://myanimelist.net/profile/baekbeans
2skrnNaNNaN['918', '2904', '11741', '17074', '23273', '32281', '9989', '1943', '512']https://myanimelist.net/profile/skrn
3edgewalker00MaleSep 5['5680', '849', '2904', '3588', '37349']https://myanimelist.net/profile/edgewalker00
4aManOfCulture99MaleOct 30, 1999['4181', '7791', '9617', '5680', '2167', '4382', '849', '235', '35180', '31646']https://myanimelist.net/profile/aManOfCulture99
\n", "
" ], "text/plain": [ " profile gender birthday \\\n", "0 DesolatePsyche Male Oct 2, 1994 \n", "1 baekbeans Female Nov 10, 2000 \n", "2 skrn NaN NaN \n", "3 edgewalker00 Male Sep 5 \n", "4 aManOfCulture99 Male Oct 30, 1999 \n", "\n", " favorites_anime \\\n", "0 ['33352', '25013', '5530', '33674', '1482', '269', '18245', '2904', '27899', '17074', '12291', '226', '28851', '8525', '6594', '4981', '1698', '457', '235', '34618'] \n", "1 ['11061', '31964', '853', '20583', '918', '9253', '34599', '3588', '13601', '6956'] \n", "2 ['918', '2904', '11741', '17074', '23273', '32281', '9989', '1943', '512'] \n", "3 ['5680', '849', '2904', '3588', '37349'] \n", "4 ['4181', '7791', '9617', '5680', '2167', '4382', '849', '235', '35180', '31646'] \n", "\n", " link \n", "0 https://myanimelist.net/profile/DesolatePsyche \n", "1 https://myanimelist.net/profile/baekbeans \n", "2 https://myanimelist.net/profile/skrn \n", "3 https://myanimelist.net/profile/edgewalker00 \n", "4 https://myanimelist.net/profile/aManOfCulture99 " ] }, "execution_count": 194, "metadata": {}, "output_type": "execute_result" } ], "source": [ "#files \n", "data = pd.read_csv(\"https://anime-recommendation-engine.s3.eu-west-3.amazonaws.com/data/profiles.csv\")\n", "data.head()" ] }, { "cell_type": "code", "execution_count": 195, "id": "d2392159", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Number of rows : 81727\n", "Number of columns : 5\n", "Basics statistics: \n" ] }, { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
profilegenderbirthdayfavorites_animelink
count8172753856468078172781727
unique47885377083539547885
topVoivodianMale1995[]https://myanimelist.net/profile/Voivodian
freq637096211166026
\n", "
" ], "text/plain": [ " profile gender birthday favorites_anime \\\n", "count 81727 53856 46807 81727 \n", "unique 47885 3 7708 35395 \n", "top Voivodian Male 1995 [] \n", "freq 6 37096 211 16602 \n", "\n", " link \n", "count 81727 \n", "unique 47885 \n", "top https://myanimelist.net/profile/Voivodian \n", "freq 6 " ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "Percentage of missing values: \n", "profile 0.000000\n", "gender 0.341026\n", "birthday 0.427276\n", "favorites_anime 0.000000\n", "link 0.000000\n", "dtype: float64\n" ] } ], "source": [ "# Basic stats\n", "print(f\"Number of rows : {data.shape[0]}\")\n", "print(f\"Number of columns : {data.shape[1]}\")\n", "\n", "print(\"Basics statistics: \")\n", "display(data.describe(include='all'))\n", "\n", "print(\"Percentage of missing values: \")\n", "print(data.isna() .sum() / data.shape[0])" ] }, { "cell_type": "markdown", "id": "b0549595", "metadata": {}, "source": [ "### EDA" ] }, { "cell_type": "code", "execution_count": 196, "id": "5cc9194e", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
profilegenderbirthdayfavorites_animelinkage
0DesolatePsycheMaleOct 2, 1994['33352', '25013', '5530', '33674', '1482', '269', '18245', '2904', '27899', '17074', '12291', '226', '28851', '8525', '6594', '4981', '1698', '457', '235', '34618']https://myanimelist.net/profile/DesolatePsyche26
1baekbeansFemaleNov 10, 2000['11061', '31964', '853', '20583', '918', '9253', '34599', '3588', '13601', '6956']https://myanimelist.net/profile/baekbeans20
2skrnNaNNaN['918', '2904', '11741', '17074', '23273', '32281', '9989', '1943', '512']https://myanimelist.net/profile/skrn
3edgewalker00MaleSep 5['5680', '849', '2904', '3588', '37349']https://myanimelist.net/profile/edgewalker00
4aManOfCulture99MaleOct 30, 1999['4181', '7791', '9617', '5680', '2167', '4382', '849', '235', '35180', '31646']https://myanimelist.net/profile/aManOfCulture9921
.....................
81722lovelessxdFemaleAug 6, 1992['853', '5114']https://myanimelist.net/profile/lovelessxd28
81723Shattered_AngelFemaleSep 6, 1994['150', '27', '1520', '121', '31452', '32995', '877', '14713', '129', '11111']https://myanimelist.net/profile/Shattered_Angel26
81724FluffyWalrusMaleNaN['121', '43', '237', '202', '205']https://myanimelist.net/profile/FluffyWalrus
81725camcoFemaleSep 23['199', '4224', '7054', '13601', '14713']https://myanimelist.net/profile/camco
81726nyja-chanFemaleNov 13['39195', '38000', '440', '457', '34599', '2251', '37779', '13125', '35180', '10721']https://myanimelist.net/profile/nyja-chan
\n", "

81727 rows × 6 columns

\n", "
" ], "text/plain": [ " profile gender birthday \\\n", "0 DesolatePsyche Male Oct 2, 1994 \n", "1 baekbeans Female Nov 10, 2000 \n", "2 skrn NaN NaN \n", "3 edgewalker00 Male Sep 5 \n", "4 aManOfCulture99 Male Oct 30, 1999 \n", "... ... ... ... \n", "81722 lovelessxd Female Aug 6, 1992 \n", "81723 Shattered_Angel Female Sep 6, 1994 \n", "81724 FluffyWalrus Male NaN \n", "81725 camco Female Sep 23 \n", "81726 nyja-chan Female Nov 13 \n", "\n", " favorites_anime \\\n", "0 ['33352', '25013', '5530', '33674', '1482', '269', '18245', '2904', '27899', '17074', '12291', '226', '28851', '8525', '6594', '4981', '1698', '457', '235', '34618'] \n", "1 ['11061', '31964', '853', '20583', '918', '9253', '34599', '3588', '13601', '6956'] \n", "2 ['918', '2904', '11741', '17074', '23273', '32281', '9989', '1943', '512'] \n", "3 ['5680', '849', '2904', '3588', '37349'] \n", "4 ['4181', '7791', '9617', '5680', '2167', '4382', '849', '235', '35180', '31646'] \n", "... ... \n", "81722 ['853', '5114'] \n", "81723 ['150', '27', '1520', '121', '31452', '32995', '877', '14713', '129', '11111'] \n", "81724 ['121', '43', '237', '202', '205'] \n", "81725 ['199', '4224', '7054', '13601', '14713'] \n", "81726 ['39195', '38000', '440', '457', '34599', '2251', '37779', '13125', '35180', '10721'] \n", "\n", " link age \n", "0 https://myanimelist.net/profile/DesolatePsyche 26 \n", "1 https://myanimelist.net/profile/baekbeans 20 \n", "2 https://myanimelist.net/profile/skrn \n", "3 https://myanimelist.net/profile/edgewalker00 \n", "4 https://myanimelist.net/profile/aManOfCulture99 21 \n", "... ... .. \n", "81722 https://myanimelist.net/profile/lovelessxd 28 \n", "81723 https://myanimelist.net/profile/Shattered_Angel 26 \n", "81724 https://myanimelist.net/profile/FluffyWalrus \n", "81725 https://myanimelist.net/profile/camco \n", "81726 https://myanimelist.net/profile/nyja-chan \n", "\n", "[81727 rows x 6 columns]" ] }, "execution_count": 196, "metadata": {}, "output_type": "execute_result" } ], "source": [ "data['age'] = data[\"birthday\"].apply(lambda x : \"\".join(re.findall(\"[0-9]{4}\", x)) if pd.notnull(x) else \"\")\n", "data['age'] = data['age'].replace(\"\", \"0\")\n", "data['age'] = data['age'].apply(lambda x : 2020-int(x) if 2020-int(x)<2020 else \"\")\n", "data" ] }, { "cell_type": "markdown", "id": "a378b187", "metadata": {}, "source": [ "### profile" ] }, { "cell_type": "code", "execution_count": 197, "id": "9e9e7ad9", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "profile\n", "Voivodian 6\n", "Luquillo 6\n", "cjdstruction 6\n", "Skadi 6\n", "WhoCanPeliCan 6\n", " ..\n", "Rukyu100 1\n", "StarChenko 1\n", "NiazelTephias 1\n", "ggesus 1\n", "srry4apologizng 1\n", "Name: count, Length: 47885, dtype: int64" ] }, "execution_count": 197, "metadata": {}, "output_type": "execute_result" } ], "source": [ "data['profile'].value_counts()" ] }, { "cell_type": "code", "execution_count": 198, "id": "93facd1b", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
profilegenderbirthdayfavorites_animelinkage
19347VoivodianMale1997['820', '324', '2451', '967', '1488', '424', '486', '1352', '2582', '35838']https://myanimelist.net/profile/Voivodian23
27641VoivodianMale1997['820', '324', '2451', '967', '1488', '424', '486', '1352', '2582', '35838']https://myanimelist.net/profile/Voivodian23
29989VoivodianMale1997['820', '324', '2451', '967', '1488', '424', '486', '1352', '2582', '35838']https://myanimelist.net/profile/Voivodian23
30876VoivodianMale1997['820', '324', '2451', '967', '1488', '424', '486', '1352', '2582', '35838']https://myanimelist.net/profile/Voivodian23
35398VoivodianMale1997['820', '324', '2451', '967', '1488', '424', '486', '1352', '2582', '35838']https://myanimelist.net/profile/Voivodian23
\n", "
" ], "text/plain": [ " profile gender birthday \\\n", "19347 Voivodian Male 1997 \n", "27641 Voivodian Male 1997 \n", "29989 Voivodian Male 1997 \n", "30876 Voivodian Male 1997 \n", "35398 Voivodian Male 1997 \n", "\n", " favorites_anime \\\n", "19347 ['820', '324', '2451', '967', '1488', '424', '486', '1352', '2582', '35838'] \n", "27641 ['820', '324', '2451', '967', '1488', '424', '486', '1352', '2582', '35838'] \n", "29989 ['820', '324', '2451', '967', '1488', '424', '486', '1352', '2582', '35838'] \n", "30876 ['820', '324', '2451', '967', '1488', '424', '486', '1352', '2582', '35838'] \n", "35398 ['820', '324', '2451', '967', '1488', '424', '486', '1352', '2582', '35838'] \n", "\n", " link age \n", "19347 https://myanimelist.net/profile/Voivodian 23 \n", "27641 https://myanimelist.net/profile/Voivodian 23 \n", "29989 https://myanimelist.net/profile/Voivodian 23 \n", "30876 https://myanimelist.net/profile/Voivodian 23 \n", "35398 https://myanimelist.net/profile/Voivodian 23 " ] }, "execution_count": 198, "metadata": {}, "output_type": "execute_result" } ], "source": [ "data[data['profile']==\"Voivodian\"].head()" ] }, { "cell_type": "code", "execution_count": 199, "id": "eb5e65af", "metadata": {}, "outputs": [], "source": [ "df = data.drop_duplicates('profile')" ] }, { "cell_type": "markdown", "id": "7323db8d", "metadata": {}, "source": [ "### stats after cleaning" ] }, { "cell_type": "code", "execution_count": 200, "id": "7be9adbf", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Number of rows : 47885\n", "Number of columns : 6\n", "Basics statistics: \n" ] }, { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
profilegenderbirthdayfavorites_animelinkage
count478853087826848478854788547885
unique4788537708353814788590
topDesolatePsycheMale1993[]https://myanimelist.net/profile/DesolatePsyche
freq12118811610422125309
\n", "
" ], "text/plain": [ " profile gender birthday favorites_anime \\\n", "count 47885 30878 26848 47885 \n", "unique 47885 3 7708 35381 \n", "top DesolatePsyche Male 1993 [] \n", "freq 1 21188 116 10422 \n", "\n", " link age \n", "count 47885 47885 \n", "unique 47885 90 \n", "top https://myanimelist.net/profile/DesolatePsyche \n", "freq 1 25309 " ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "Percentage of missing values: \n", "profile 0.000000\n", "gender 0.355163\n", "birthday 0.439323\n", "favorites_anime 0.000000\n", "link 0.000000\n", "age 0.000000\n", "dtype: float64\n" ] } ], "source": [ "# Basic stats\n", "print(f\"Number of rows : {df.shape[0]}\")\n", "print(f\"Number of columns : {df.shape[1]}\")\n", "\n", "print(\"Basics statistics: \")\n", "display(df.describe(include='all'))\n", "\n", "print(\"Percentage of missing values: \")\n", "print(df.isna() .sum() / df.shape[0])" ] }, { "cell_type": "code", "execution_count": 201, "id": "0893795f", "metadata": {}, "outputs": [], "source": [ "df.to_csv('../data/profiles_clean.csv', index=False)" ] }, { "cell_type": "markdown", "id": "fc85ddd0", "metadata": {}, "source": [ "---" ] }, { "cell_type": "markdown", "id": "4126888d", "metadata": {}, "source": [ "# Reviews" ] }, { "cell_type": "code", "execution_count": 202, "id": "e1bbf7c8", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
uidprofileanime_uidtextscorescoreslink
0255938DesolatePsyche34096\\n \\n \\n \\n \\n \\n \\n \\n more pics \\n \\n \\n \\n \\n \\n Overall \\n 8 \\n \\n \\n Story \\n 8 \\n \\n \\n ...8{'Overall': '8', 'Story': '8', 'Animation': '8', 'Sound': '10', 'Character': '9', 'Enjoyment': '8'}https://myanimelist.net/reviews.php?id=255938
1259117baekbeans34599\\n \\n \\n \\n \\n \\n \\n \\n more pics \\n \\n \\n \\n \\n \\n Overall \\n 10 \\n \\n \\n Story \\n 10 \\n \\n \\n ...10{'Overall': '10', 'Story': '10', 'Animation': '10', 'Sound': '10', 'Character': '10', 'Enjoyment': '10'}https://myanimelist.net/reviews.php?id=259117
2253664skrn28891\\n \\n \\n \\n \\n \\n \\n \\n more pics \\n \\n \\n \\n \\n \\n Overall \\n 7 \\n \\n \\n Story \\n 7 \\n \\n \\n ...7{'Overall': '7', 'Story': '7', 'Animation': '9', 'Sound': '8', 'Character': '8', 'Enjoyment': '8'}https://myanimelist.net/reviews.php?id=253664
38254edgewalker002904\\n \\n \\n \\n \\n \\n \\n \\n more pics \\n \\n \\n \\n \\n \\n Overall \\n 9 \\n \\n \\n Story \\n 9 \\n \\n \\n ...9{'Overall': '9', 'Story': '9', 'Animation': '9', 'Sound': '10', 'Character': '10', 'Enjoyment': '9'}https://myanimelist.net/reviews.php?id=8254
4291149aManOfCulture994181\\n \\n \\n \\n \\n \\n \\n \\n more pics \\n \\n \\n \\n \\n \\n Overall \\n 10 \\n \\n \\n Story \\n 10 \\n \\n \\n ...10{'Overall': '10', 'Story': '10', 'Animation': '8', 'Sound': '9', 'Character': '10', 'Enjoyment': '10'}https://myanimelist.net/reviews.php?id=291149
\n", "
" ], "text/plain": [ " uid profile anime_uid \\\n", "0 255938 DesolatePsyche 34096 \n", "1 259117 baekbeans 34599 \n", "2 253664 skrn 28891 \n", "3 8254 edgewalker00 2904 \n", "4 291149 aManOfCulture99 4181 \n", "\n", " text \\\n", "0 \\n \\n \\n \\n \\n \\n \\n \\n more pics \\n \\n \\n \\n \\n \\n Overall \\n 8 \\n \\n \\n Story \\n 8 \\n \\n \\n ... \n", "1 \\n \\n \\n \\n \\n \\n \\n \\n more pics \\n \\n \\n \\n \\n \\n Overall \\n 10 \\n \\n \\n Story \\n 10 \\n \\n \\n ... \n", "2 \\n \\n \\n \\n \\n \\n \\n \\n more pics \\n \\n \\n \\n \\n \\n Overall \\n 7 \\n \\n \\n Story \\n 7 \\n \\n \\n ... \n", "3 \\n \\n \\n \\n \\n \\n \\n \\n more pics \\n \\n \\n \\n \\n \\n Overall \\n 9 \\n \\n \\n Story \\n 9 \\n \\n \\n ... \n", "4 \\n \\n \\n \\n \\n \\n \\n \\n more pics \\n \\n \\n \\n \\n \\n Overall \\n 10 \\n \\n \\n Story \\n 10 \\n \\n \\n ... \n", "\n", " score \\\n", "0 8 \n", "1 10 \n", "2 7 \n", "3 9 \n", "4 10 \n", "\n", " scores \\\n", "0 {'Overall': '8', 'Story': '8', 'Animation': '8', 'Sound': '10', 'Character': '9', 'Enjoyment': '8'} \n", "1 {'Overall': '10', 'Story': '10', 'Animation': '10', 'Sound': '10', 'Character': '10', 'Enjoyment': '10'} \n", "2 {'Overall': '7', 'Story': '7', 'Animation': '9', 'Sound': '8', 'Character': '8', 'Enjoyment': '8'} \n", "3 {'Overall': '9', 'Story': '9', 'Animation': '9', 'Sound': '10', 'Character': '10', 'Enjoyment': '9'} \n", "4 {'Overall': '10', 'Story': '10', 'Animation': '8', 'Sound': '9', 'Character': '10', 'Enjoyment': '10'} \n", "\n", " link \n", "0 https://myanimelist.net/reviews.php?id=255938 \n", "1 https://myanimelist.net/reviews.php?id=259117 \n", "2 https://myanimelist.net/reviews.php?id=253664 \n", "3 https://myanimelist.net/reviews.php?id=8254 \n", "4 https://myanimelist.net/reviews.php?id=291149 " ] }, "execution_count": 202, "metadata": {}, "output_type": "execute_result" } ], "source": [ "#files \n", "data = pd.read_csv('https://anime-recommendation-engine.s3.eu-west-3.amazonaws.com/data/reviews.csv')\n", "data.head()" ] }, { "cell_type": "code", "execution_count": 203, "id": "89a875ac", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Number of rows : 192112\n", "Number of columns : 7\n", "Basics statistics: \n" ] }, { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
uidprofileanime_uidtextscorescoreslink
count192112.000000192112192112.000000192112192112.000000192112192112
uniqueNaN47885NaN130440NaN29837130519
topNaNSidewinder51NaN\\n \\n \\n \\n \\n \\n \\n \\n more pics \\n \\n \\n \\n \\n \\n Overall \\n 10 \\n \\n \\n Story \\n 10 \\n \\n \\n ...NaN{'Overall': '10', 'Story': '10', 'Animation': '10', 'Sound': '10', 'Character': '10', 'Enjoyment': '10'}https://myanimelist.net/reviews.php?id=321183
freqNaN762NaN8NaN139004
mean187648.127525NaN15273.300283NaN7.570235NaNNaN
std98748.902397NaN13480.565379NaN2.255167NaNNaN
min1.000000NaN1.000000NaN0.000000NaNNaN
25%101779.500000NaN2167.000000NaN6.000000NaNNaN
50%210913.500000NaN10793.000000NaN8.000000NaNNaN
75%270383.000000NaN30205.000000NaN9.000000NaNNaN
max325747.000000NaN40807.000000NaN11.000000NaNNaN
\n", "
" ], "text/plain": [ " uid profile anime_uid \\\n", "count 192112.000000 192112 192112.000000 \n", "unique NaN 47885 NaN \n", "top NaN Sidewinder51 NaN \n", "freq NaN 762 NaN \n", "mean 187648.127525 NaN 15273.300283 \n", "std 98748.902397 NaN 13480.565379 \n", "min 1.000000 NaN 1.000000 \n", "25% 101779.500000 NaN 2167.000000 \n", "50% 210913.500000 NaN 10793.000000 \n", "75% 270383.000000 NaN 30205.000000 \n", "max 325747.000000 NaN 40807.000000 \n", "\n", " text \\\n", "count 192112 \n", "unique 130440 \n", "top \\n \\n \\n \\n \\n \\n \\n \\n more pics \\n \\n \\n \\n \\n \\n Overall \\n 10 \\n \\n \\n Story \\n 10 \\n \\n \\n ... \n", "freq 8 \n", "mean NaN \n", "std NaN \n", "min NaN \n", "25% NaN \n", "50% NaN \n", "75% NaN \n", "max NaN \n", "\n", " score \\\n", "count 192112.000000 \n", "unique NaN \n", "top NaN \n", "freq NaN \n", "mean 7.570235 \n", "std 2.255167 \n", "min 0.000000 \n", "25% 6.000000 \n", "50% 8.000000 \n", "75% 9.000000 \n", "max 11.000000 \n", "\n", " scores \\\n", "count 192112 \n", "unique 29837 \n", "top {'Overall': '10', 'Story': '10', 'Animation': '10', 'Sound': '10', 'Character': '10', 'Enjoyment': '10'} \n", "freq 13900 \n", "mean NaN \n", "std NaN \n", "min NaN \n", "25% NaN \n", "50% NaN \n", "75% NaN \n", "max NaN \n", "\n", " link \n", "count 192112 \n", "unique 130519 \n", "top https://myanimelist.net/reviews.php?id=321183 \n", "freq 4 \n", "mean NaN \n", "std NaN \n", "min NaN \n", "25% NaN \n", "50% NaN \n", "75% NaN \n", "max NaN " ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "Percentage of missing values: \n", "uid 0.0\n", "profile 0.0\n", "anime_uid 0.0\n", "text 0.0\n", "score 0.0\n", "scores 0.0\n", "link 0.0\n", "dtype: float64\n" ] } ], "source": [ "# Basic stats\n", "print(f\"Number of rows : {data.shape[0]}\")\n", "print(f\"Number of columns : {data.shape[1]}\")\n", "\n", "print(\"Basics statistics: \")\n", "display(data.describe(include='all'))\n", "\n", "print(\"Percentage of missing values: \")\n", "print(data.isna() .sum() / data.shape[0])" ] }, { "cell_type": "markdown", "id": "a292d67d", "metadata": {}, "source": [ "### EDA" ] }, { "cell_type": "markdown", "id": "0975d92f", "metadata": {}, "source": [ "##### UID" ] }, { "cell_type": "code", "execution_count": 204, "id": "662a6c98", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "uid\n", "321183 4\n", "321837 4\n", "321498 4\n", "321144 4\n", "321148 4\n", " ..\n", "46599 1\n", "211503 1\n", "156351 1\n", "198366 1\n", "193145 1\n", "Name: count, Length: 130519, dtype: int64" ] }, "execution_count": 204, "metadata": {}, "output_type": "execute_result" } ], "source": [ "data['uid'].value_counts()" ] }, { "cell_type": "code", "execution_count": 205, "id": "e77fb876", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "130519" ] }, "execution_count": 205, "metadata": {}, "output_type": "execute_result" } ], "source": [ "data['uid'].nunique()" ] }, { "cell_type": "code", "execution_count": 206, "id": "1b716d8a", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
uidprofileanime_uidtextscorescoreslink
49298321183Zaky143540269\\n \\n \\n \\n \\n \\n \\n \\n more pics \\n \\n \\n \\n \\n \\n Overall \\n 9 \\n \\n \\n Story \\n 9 \\n \\n \\n ...9{'Overall': '9', 'Story': '9', 'Animation': '8', 'Sound': '9', 'Character': '9', 'Enjoyment': '10'}https://myanimelist.net/reviews.php?id=321183
54270321183Zaky143540269\\n \\n \\n \\n \\n \\n \\n \\n more pics \\n \\n \\n \\n \\n \\n Overall \\n 9 \\n \\n \\n Story \\n 9 \\n \\n \\n ...9{'Overall': '9', 'Story': '9', 'Animation': '8', 'Sound': '9', 'Character': '9', 'Enjoyment': '10'}https://myanimelist.net/reviews.php?id=321183
184572321183Zaky143540269\\n \\n \\n \\n \\n \\n \\n \\n more pics \\n \\n \\n \\n \\n \\n Overall \\n 9 \\n \\n \\n Story \\n 9 \\n \\n \\n ...9{'Overall': '9', 'Story': '9', 'Animation': '8', 'Sound': '9', 'Character': '9', 'Enjoyment': '10'}https://myanimelist.net/reviews.php?id=321183
189544321183Zaky143540269\\n \\n \\n \\n \\n \\n \\n \\n more pics \\n \\n \\n \\n \\n \\n Overall \\n 9 \\n \\n \\n Story \\n 9 \\n \\n \\n ...9{'Overall': '9', 'Story': '9', 'Animation': '8', 'Sound': '9', 'Character': '9', 'Enjoyment': '10'}https://myanimelist.net/reviews.php?id=321183
\n", "
" ], "text/plain": [ " uid profile anime_uid \\\n", "49298 321183 Zaky1435 40269 \n", "54270 321183 Zaky1435 40269 \n", "184572 321183 Zaky1435 40269 \n", "189544 321183 Zaky1435 40269 \n", "\n", " text \\\n", "49298 \\n \\n \\n \\n \\n \\n \\n \\n more pics \\n \\n \\n \\n \\n \\n Overall \\n 9 \\n \\n \\n Story \\n 9 \\n \\n \\n ... \n", "54270 \\n \\n \\n \\n \\n \\n \\n \\n more pics \\n \\n \\n \\n \\n \\n Overall \\n 9 \\n \\n \\n Story \\n 9 \\n \\n \\n ... \n", "184572 \\n \\n \\n \\n \\n \\n \\n \\n more pics \\n \\n \\n \\n \\n \\n Overall \\n 9 \\n \\n \\n Story \\n 9 \\n \\n \\n ... \n", "189544 \\n \\n \\n \\n \\n \\n \\n \\n more pics \\n \\n \\n \\n \\n \\n Overall \\n 9 \\n \\n \\n Story \\n 9 \\n \\n \\n ... \n", "\n", " score \\\n", "49298 9 \n", "54270 9 \n", "184572 9 \n", "189544 9 \n", "\n", " scores \\\n", "49298 {'Overall': '9', 'Story': '9', 'Animation': '8', 'Sound': '9', 'Character': '9', 'Enjoyment': '10'} \n", "54270 {'Overall': '9', 'Story': '9', 'Animation': '8', 'Sound': '9', 'Character': '9', 'Enjoyment': '10'} \n", "184572 {'Overall': '9', 'Story': '9', 'Animation': '8', 'Sound': '9', 'Character': '9', 'Enjoyment': '10'} \n", "189544 {'Overall': '9', 'Story': '9', 'Animation': '8', 'Sound': '9', 'Character': '9', 'Enjoyment': '10'} \n", "\n", " link \n", "49298 https://myanimelist.net/reviews.php?id=321183 \n", "54270 https://myanimelist.net/reviews.php?id=321183 \n", "184572 https://myanimelist.net/reviews.php?id=321183 \n", "189544 https://myanimelist.net/reviews.php?id=321183 " ] }, "execution_count": 206, "metadata": {}, "output_type": "execute_result" } ], "source": [ "pd.set_option('display.max_colwidth', 300)\n", "data[data[\"uid\"]==321183].head()" ] }, { "cell_type": "markdown", "id": "c40c7c58", "metadata": {}, "source": [ "### Cleaning Dataset" ] }, { "cell_type": "code", "execution_count": 207, "id": "2a8659d1", "metadata": {}, "outputs": [], "source": [ "df = data.drop_duplicates('uid')" ] }, { "cell_type": "code", "execution_count": 208, "id": "bec7ab47", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
uidprofileanime_uidtextscorescoreslink
0255938DesolatePsyche34096\\n \\n \\n \\n \\n \\n \\n \\n more pics \\n \\n \\n \\n \\n \\n Overall \\n 8 \\n \\n \\n Story \\n 8 \\n \\n \\n ...8{'Overall': '8', 'Story': '8', 'Animation': '8', 'Sound': '10', 'Character': '9', 'Enjoyment': '8'}https://myanimelist.net/reviews.php?id=255938
1259117baekbeans34599\\n \\n \\n \\n \\n \\n \\n \\n more pics \\n \\n \\n \\n \\n \\n Overall \\n 10 \\n \\n \\n Story \\n 10 \\n \\n \\n ...10{'Overall': '10', 'Story': '10', 'Animation': '10', 'Sound': '10', 'Character': '10', 'Enjoyment': '10'}https://myanimelist.net/reviews.php?id=259117
2253664skrn28891\\n \\n \\n \\n \\n \\n \\n \\n more pics \\n \\n \\n \\n \\n \\n Overall \\n 7 \\n \\n \\n Story \\n 7 \\n \\n \\n ...7{'Overall': '7', 'Story': '7', 'Animation': '9', 'Sound': '8', 'Character': '8', 'Enjoyment': '8'}https://myanimelist.net/reviews.php?id=253664
38254edgewalker002904\\n \\n \\n \\n \\n \\n \\n \\n more pics \\n \\n \\n \\n \\n \\n Overall \\n 9 \\n \\n \\n Story \\n 9 \\n \\n \\n ...9{'Overall': '9', 'Story': '9', 'Animation': '9', 'Sound': '10', 'Character': '10', 'Enjoyment': '9'}https://myanimelist.net/reviews.php?id=8254
4291149aManOfCulture994181\\n \\n \\n \\n \\n \\n \\n \\n more pics \\n \\n \\n \\n \\n \\n Overall \\n 10 \\n \\n \\n Story \\n 10 \\n \\n \\n ...10{'Overall': '10', 'Story': '10', 'Animation': '8', 'Sound': '9', 'Character': '10', 'Enjoyment': '10'}https://myanimelist.net/reviews.php?id=291149
\n", "
" ], "text/plain": [ " uid profile anime_uid \\\n", "0 255938 DesolatePsyche 34096 \n", "1 259117 baekbeans 34599 \n", "2 253664 skrn 28891 \n", "3 8254 edgewalker00 2904 \n", "4 291149 aManOfCulture99 4181 \n", "\n", " text \\\n", "0 \\n \\n \\n \\n \\n \\n \\n \\n more pics \\n \\n \\n \\n \\n \\n Overall \\n 8 \\n \\n \\n Story \\n 8 \\n \\n \\n ... \n", "1 \\n \\n \\n \\n \\n \\n \\n \\n more pics \\n \\n \\n \\n \\n \\n Overall \\n 10 \\n \\n \\n Story \\n 10 \\n \\n \\n ... \n", "2 \\n \\n \\n \\n \\n \\n \\n \\n more pics \\n \\n \\n \\n \\n \\n Overall \\n 7 \\n \\n \\n Story \\n 7 \\n \\n \\n ... \n", "3 \\n \\n \\n \\n \\n \\n \\n \\n more pics \\n \\n \\n \\n \\n \\n Overall \\n 9 \\n \\n \\n Story \\n 9 \\n \\n \\n ... \n", "4 \\n \\n \\n \\n \\n \\n \\n \\n more pics \\n \\n \\n \\n \\n \\n Overall \\n 10 \\n \\n \\n Story \\n 10 \\n \\n \\n ... \n", "\n", " score \\\n", "0 8 \n", "1 10 \n", "2 7 \n", "3 9 \n", "4 10 \n", "\n", " scores \\\n", "0 {'Overall': '8', 'Story': '8', 'Animation': '8', 'Sound': '10', 'Character': '9', 'Enjoyment': '8'} \n", "1 {'Overall': '10', 'Story': '10', 'Animation': '10', 'Sound': '10', 'Character': '10', 'Enjoyment': '10'} \n", "2 {'Overall': '7', 'Story': '7', 'Animation': '9', 'Sound': '8', 'Character': '8', 'Enjoyment': '8'} \n", "3 {'Overall': '9', 'Story': '9', 'Animation': '9', 'Sound': '10', 'Character': '10', 'Enjoyment': '9'} \n", "4 {'Overall': '10', 'Story': '10', 'Animation': '8', 'Sound': '9', 'Character': '10', 'Enjoyment': '10'} \n", "\n", " link \n", "0 https://myanimelist.net/reviews.php?id=255938 \n", "1 https://myanimelist.net/reviews.php?id=259117 \n", "2 https://myanimelist.net/reviews.php?id=253664 \n", "3 https://myanimelist.net/reviews.php?id=8254 \n", "4 https://myanimelist.net/reviews.php?id=291149 " ] }, "execution_count": 208, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df.head()" ] }, { "cell_type": "markdown", "id": "20d455e6", "metadata": {}, "source": [ "### stats after cleaning" ] }, { "cell_type": "code", "execution_count": 209, "id": "fe2b7bd1", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Number of rows : 130519\n", "Number of columns : 7\n", "Basics statistics: \n" ] }, { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
uidprofileanime_uidtextscorescoreslink
count130519.000000130519130519.000000130519130519.000000130519130519
uniqueNaN47885NaN130440NaN29837130519
topNaNSidewinder51NaN\\n \\n \\n \\n \\n \\n \\n \\n more pics \\n \\n \\n \\n \\n \\n Overall \\n 7 \\n \\n \\n Story \\n 7 \\n \\n \\n ...NaN{'Overall': '10', 'Story': '10', 'Animation': '10', 'Sound': '10', 'Character': '10', 'Enjoyment': '10'}https://myanimelist.net/reviews.php?id=255938
freqNaN611NaN6NaN81441
mean186880.155839NaN15696.469855NaN7.329737NaNNaN
std99244.778774NaN13479.395334NaN2.321337NaNNaN
min1.000000NaN1.000000NaN0.000000NaNNaN
25%99189.000000NaN2476.000000NaN6.000000NaNNaN
50%210512.000000NaN11755.000000NaN8.000000NaNNaN
75%270414.500000NaN30484.000000NaN9.000000NaNNaN
max325747.000000NaN40807.000000NaN11.000000NaNNaN
\n", "
" ], "text/plain": [ " uid profile anime_uid \\\n", "count 130519.000000 130519 130519.000000 \n", "unique NaN 47885 NaN \n", "top NaN Sidewinder51 NaN \n", "freq NaN 611 NaN \n", "mean 186880.155839 NaN 15696.469855 \n", "std 99244.778774 NaN 13479.395334 \n", "min 1.000000 NaN 1.000000 \n", "25% 99189.000000 NaN 2476.000000 \n", "50% 210512.000000 NaN 11755.000000 \n", "75% 270414.500000 NaN 30484.000000 \n", "max 325747.000000 NaN 40807.000000 \n", "\n", " text \\\n", "count 130519 \n", "unique 130440 \n", "top \\n \\n \\n \\n \\n \\n \\n \\n more pics \\n \\n \\n \\n \\n \\n Overall \\n 7 \\n \\n \\n Story \\n 7 \\n \\n \\n ... \n", "freq 6 \n", "mean NaN \n", "std NaN \n", "min NaN \n", "25% NaN \n", "50% NaN \n", "75% NaN \n", "max NaN \n", "\n", " score \\\n", "count 130519.000000 \n", "unique NaN \n", "top NaN \n", "freq NaN \n", "mean 7.329737 \n", "std 2.321337 \n", "min 0.000000 \n", "25% 6.000000 \n", "50% 8.000000 \n", "75% 9.000000 \n", "max 11.000000 \n", "\n", " scores \\\n", "count 130519 \n", "unique 29837 \n", "top {'Overall': '10', 'Story': '10', 'Animation': '10', 'Sound': '10', 'Character': '10', 'Enjoyment': '10'} \n", "freq 8144 \n", "mean NaN \n", "std NaN \n", "min NaN \n", "25% NaN \n", "50% NaN \n", "75% NaN \n", "max NaN \n", "\n", " link \n", "count 130519 \n", "unique 130519 \n", "top https://myanimelist.net/reviews.php?id=255938 \n", "freq 1 \n", "mean NaN \n", "std NaN \n", "min NaN \n", "25% NaN \n", "50% NaN \n", "75% NaN \n", "max NaN " ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "Percentage of missing values: \n", "uid 0.0\n", "profile 0.0\n", "anime_uid 0.0\n", "text 0.0\n", "score 0.0\n", "scores 0.0\n", "link 0.0\n", "dtype: float64\n" ] } ], "source": [ "# Basic stats\n", "print(f\"Number of rows : {df.shape[0]}\")\n", "print(f\"Number of columns : {df.shape[1]}\")\n", "\n", "print(\"Basics statistics: \")\n", "display(df.describe(include='all'))\n", "\n", "print(\"Percentage of missing values: \")\n", "print(df.isna() .sum() / df.shape[0])" ] }, { "cell_type": "code", "execution_count": 210, "id": "dc8b2219", "metadata": {}, "outputs": [], "source": [ "df.to_csv('../data/reviews_clean.csv', index=False)" ] } ], "metadata": { "kernelspec": { "display_name": "DataScience", "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.12.9" } }, "nbformat": 4, "nbformat_minor": 5 }