{ "cells": [ { "attachments": {}, "cell_type": "markdown", "id": "9f6d9ac9-9e61-4545-b959-37bc91f4d18f", "metadata": { "tags": [] }, "source": [ "# Análise Exploratória de Dados com o Dataset do TMDB 5000" ] }, { "attachments": {}, "cell_type": "markdown", "id": "469046ff-eea3-4032-b21f-a62220b0f2b2", "metadata": { "tags": [] }, "source": [ "## Importação de Bibliotecas" ] }, { "cell_type": "code", "execution_count": 1, "id": "ad99f271-c469-4555-8056-0e27bde902fe", "metadata": {}, "outputs": [], "source": [ "# Importa o numpy com o apelido np\n", "import numpy as np\n", "\n", "# Importa o pandas com o apelido pd\n", "import pandas as pd\n", "\n", "# Importa o pyplot com o apelido plt\n", "import matplotlib.pyplot as plt\n", "\n", "# Importa o seaborn com o apelido sns\n", "import seaborn as sns" ] }, { "cell_type": "markdown", "id": "c136201b-afbe-4621-814a-fa6477dfcce6", "metadata": {}, "source": [ "## Leitura do Conjunto de Dados" ] }, { "cell_type": "code", "execution_count": 2, "id": "cbf5bbe3-fa2a-4cdb-9075-aef8abec961a", "metadata": {}, "outputs": [], "source": [ "# Importa o arquivo ratings.csv\n", "notas = pd.read_csv('ratings.csv')" ] }, { "cell_type": "code", "execution_count": 3, "id": "a1e024ef-a4b6-45cc-be74-b85da621e70c", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | userId | \n", "movieId | \n", "rating | \n", "timestamp | \n", "
---|---|---|---|---|
0 | \n", "1 | \n", "1 | \n", "4.0 | \n", "964982703 | \n", "
1 | \n", "1 | \n", "3 | \n", "4.0 | \n", "964981247 | \n", "
2 | \n", "1 | \n", "6 | \n", "4.0 | \n", "964982224 | \n", "
3 | \n", "1 | \n", "47 | \n", "5.0 | \n", "964983815 | \n", "
4 | \n", "1 | \n", "50 | \n", "5.0 | \n", "964982931 | \n", "
\n", " | usuarioId | \n", "filmeId | \n", "nota | \n", "
---|---|---|---|
0 | \n", "1 | \n", "1 | \n", "4.0 | \n", "
1 | \n", "1 | \n", "3 | \n", "4.0 | \n", "
2 | \n", "1 | \n", "6 | \n", "4.0 | \n", "
3 | \n", "1 | \n", "47 | \n", "5.0 | \n", "
4 | \n", "1 | \n", "50 | \n", "5.0 | \n", "
\n", " | movieId | \n", "title | \n", "genres | \n", "
---|---|---|---|
0 | \n", "1 | \n", "Toy Story (1995) | \n", "Adventure|Animation|Children|Comedy|Fantasy | \n", "
1 | \n", "2 | \n", "Jumanji (1995) | \n", "Adventure|Children|Fantasy | \n", "
2 | \n", "3 | \n", "Grumpier Old Men (1995) | \n", "Comedy|Romance | \n", "
3 | \n", "4 | \n", "Waiting to Exhale (1995) | \n", "Comedy|Drama|Romance | \n", "
4 | \n", "5 | \n", "Father of the Bride Part II (1995) | \n", "Comedy | \n", "
\n", " | filmeId | \n", "titulo | \n", "generos | \n", "
---|---|---|---|
0 | \n", "1 | \n", "Toy Story (1995) | \n", "Adventure|Animation|Children|Comedy|Fantasy | \n", "
1 | \n", "2 | \n", "Jumanji (1995) | \n", "Adventure|Children|Fantasy | \n", "
2 | \n", "3 | \n", "Grumpier Old Men (1995) | \n", "Comedy|Romance | \n", "
3 | \n", "4 | \n", "Waiting to Exhale (1995) | \n", "Comedy|Drama|Romance | \n", "
4 | \n", "5 | \n", "Father of the Bride Part II (1995) | \n", "Comedy | \n", "
\n", " | usuarioId | \n", "filmeId | \n", "nota | \n", "
---|---|---|---|
0 | \n", "1 | \n", "1 | \n", "4.0 | \n", "
516 | \n", "5 | \n", "1 | \n", "4.0 | \n", "
874 | \n", "7 | \n", "1 | \n", "4.5 | \n", "
1434 | \n", "15 | \n", "1 | \n", "2.5 | \n", "
1667 | \n", "17 | \n", "1 | \n", "4.5 | \n", "
... | \n", "... | \n", "... | \n", "... | \n", "
97364 | \n", "606 | \n", "1 | \n", "2.5 | \n", "
98479 | \n", "607 | \n", "1 | \n", "4.0 | \n", "
98666 | \n", "608 | \n", "1 | \n", "2.5 | \n", "
99497 | \n", "609 | \n", "1 | \n", "3.0 | \n", "
99534 | \n", "610 | \n", "1 | \n", "5.0 | \n", "
215 rows × 3 columns
\n", "\n", " | budget | \n", "genres | \n", "homepage | \n", "id | \n", "keywords | \n", "original_language | \n", "original_title | \n", "overview | \n", "popularity | \n", "production_companies | \n", "production_countries | \n", "release_date | \n", "revenue | \n", "runtime | \n", "spoken_languages | \n", "status | \n", "tagline | \n", "title | \n", "vote_average | \n", "vote_count | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | \n", "237000000 | \n", "[{\"id\": 28, \"name\": \"Action\"}, {\"id\": 12, \"nam... | \n", "http://www.avatarmovie.com/ | \n", "19995 | \n", "[{\"id\": 1463, \"name\": \"culture clash\"}, {\"id\":... | \n", "en | \n", "Avatar | \n", "In the 22nd century, a paraplegic Marine is di... | \n", "150.437577 | \n", "[{\"name\": \"Ingenious Film Partners\", \"id\": 289... | \n", "[{\"iso_3166_1\": \"US\", \"name\": \"United States o... | \n", "2009-12-10 | \n", "2787965087 | \n", "162.0 | \n", "[{\"iso_639_1\": \"en\", \"name\": \"English\"}, {\"iso... | \n", "Released | \n", "Enter the World of Pandora. | \n", "Avatar | \n", "7.2 | \n", "11800 | \n", "
1 | \n", "300000000 | \n", "[{\"id\": 12, \"name\": \"Adventure\"}, {\"id\": 14, \"... | \n", "http://disney.go.com/disneypictures/pirates/ | \n", "285 | \n", "[{\"id\": 270, \"name\": \"ocean\"}, {\"id\": 726, \"na... | \n", "en | \n", "Pirates of the Caribbean: At World's End | \n", "Captain Barbossa, long believed to be dead, ha... | \n", "139.082615 | \n", "[{\"name\": \"Walt Disney Pictures\", \"id\": 2}, {\"... | \n", "[{\"iso_3166_1\": \"US\", \"name\": \"United States o... | \n", "2007-05-19 | \n", "961000000 | \n", "169.0 | \n", "[{\"iso_639_1\": \"en\", \"name\": \"English\"}] | \n", "Released | \n", "At the end of the world, the adventure begins. | \n", "Pirates of the Caribbean: At World's End | \n", "6.9 | \n", "4500 | \n", "
2 | \n", "245000000 | \n", "[{\"id\": 28, \"name\": \"Action\"}, {\"id\": 12, \"nam... | \n", "http://www.sonypictures.com/movies/spectre/ | \n", "206647 | \n", "[{\"id\": 470, \"name\": \"spy\"}, {\"id\": 818, \"name... | \n", "en | \n", "Spectre | \n", "A cryptic message from Bond’s past sends him o... | \n", "107.376788 | \n", "[{\"name\": \"Columbia Pictures\", \"id\": 5}, {\"nam... | \n", "[{\"iso_3166_1\": \"GB\", \"name\": \"United Kingdom\"... | \n", "2015-10-26 | \n", "880674609 | \n", "148.0 | \n", "[{\"iso_639_1\": \"fr\", \"name\": \"Fran\\u00e7ais\"},... | \n", "Released | \n", "A Plan No One Escapes | \n", "Spectre | \n", "6.3 | \n", "4466 | \n", "
3 | \n", "250000000 | \n", "[{\"id\": 28, \"name\": \"Action\"}, {\"id\": 80, \"nam... | \n", "http://www.thedarkknightrises.com/ | \n", "49026 | \n", "[{\"id\": 849, \"name\": \"dc comics\"}, {\"id\": 853,... | \n", "en | \n", "The Dark Knight Rises | \n", "Following the death of District Attorney Harve... | \n", "112.312950 | \n", "[{\"name\": \"Legendary Pictures\", \"id\": 923}, {\"... | \n", "[{\"iso_3166_1\": \"US\", \"name\": \"United States o... | \n", "2012-07-16 | \n", "1084939099 | \n", "165.0 | \n", "[{\"iso_639_1\": \"en\", \"name\": \"English\"}] | \n", "Released | \n", "The Legend Ends | \n", "The Dark Knight Rises | \n", "7.6 | \n", "9106 | \n", "
4 | \n", "260000000 | \n", "[{\"id\": 28, \"name\": \"Action\"}, {\"id\": 12, \"nam... | \n", "http://movies.disney.com/john-carter | \n", "49529 | \n", "[{\"id\": 818, \"name\": \"based on novel\"}, {\"id\":... | \n", "en | \n", "John Carter | \n", "John Carter is a war-weary, former military ca... | \n", "43.926995 | \n", "[{\"name\": \"Walt Disney Pictures\", \"id\": 2}] | \n", "[{\"iso_3166_1\": \"US\", \"name\": \"United States o... | \n", "2012-03-07 | \n", "284139100 | \n", "132.0 | \n", "[{\"iso_639_1\": \"en\", \"name\": \"English\"}] | \n", "Released | \n", "Lost in our world, found in another. | \n", "John Carter | \n", "6.1 | \n", "2124 | \n", "
\n", " | count | \n", "
---|---|
original_language | \n", "\n", " |
en | \n", "4505 | \n", "
fr | \n", "70 | \n", "
es | \n", "32 | \n", "
zh | \n", "27 | \n", "
de | \n", "27 | \n", "
hi | \n", "19 | \n", "
ja | \n", "16 | \n", "
it | \n", "14 | \n", "
cn | \n", "12 | \n", "
ru | \n", "11 | \n", "
ko | \n", "11 | \n", "
pt | \n", "9 | \n", "
da | \n", "7 | \n", "
sv | \n", "5 | \n", "
nl | \n", "4 | \n", "
fa | \n", "4 | \n", "
th | \n", "3 | \n", "
he | \n", "3 | \n", "
ta | \n", "2 | \n", "
cs | \n", "2 | \n", "
ro | \n", "2 | \n", "
id | \n", "2 | \n", "
ar | \n", "2 | \n", "
vi | \n", "1 | \n", "
sl | \n", "1 | \n", "
ps | \n", "1 | \n", "
no | \n", "1 | \n", "
ky | \n", "1 | \n", "
hu | \n", "1 | \n", "
pl | \n", "1 | \n", "
af | \n", "1 | \n", "
nb | \n", "1 | \n", "
tr | \n", "1 | \n", "
is | \n", "1 | \n", "
xx | \n", "1 | \n", "
te | \n", "1 | \n", "
el | \n", "1 | \n", "
\n", " | original_language | \n", "count | \n", "
---|---|---|
0 | \n", "en | \n", "4505 | \n", "
1 | \n", "fr | \n", "70 | \n", "
2 | \n", "es | \n", "32 | \n", "
3 | \n", "zh | \n", "27 | \n", "
4 | \n", "de | \n", "27 | \n", "
5 | \n", "hi | \n", "19 | \n", "
6 | \n", "ja | \n", "16 | \n", "
7 | \n", "it | \n", "14 | \n", "
8 | \n", "cn | \n", "12 | \n", "
9 | \n", "ru | \n", "11 | \n", "
10 | \n", "ko | \n", "11 | \n", "
11 | \n", "pt | \n", "9 | \n", "
12 | \n", "da | \n", "7 | \n", "
13 | \n", "sv | \n", "5 | \n", "
14 | \n", "nl | \n", "4 | \n", "
15 | \n", "fa | \n", "4 | \n", "
16 | \n", "th | \n", "3 | \n", "
17 | \n", "he | \n", "3 | \n", "
18 | \n", "ta | \n", "2 | \n", "
19 | \n", "cs | \n", "2 | \n", "
20 | \n", "ro | \n", "2 | \n", "
21 | \n", "id | \n", "2 | \n", "
22 | \n", "ar | \n", "2 | \n", "
23 | \n", "vi | \n", "1 | \n", "
24 | \n", "sl | \n", "1 | \n", "
25 | \n", "ps | \n", "1 | \n", "
26 | \n", "no | \n", "1 | \n", "
27 | \n", "ky | \n", "1 | \n", "
28 | \n", "hu | \n", "1 | \n", "
29 | \n", "pl | \n", "1 | \n", "
30 | \n", "af | \n", "1 | \n", "
31 | \n", "nb | \n", "1 | \n", "
32 | \n", "tr | \n", "1 | \n", "
33 | \n", "is | \n", "1 | \n", "
34 | \n", "xx | \n", "1 | \n", "
35 | \n", "te | \n", "1 | \n", "
36 | \n", "el | \n", "1 | \n", "
\n", " | original_language | \n", "total | \n", "
---|---|---|
0 | \n", "en | \n", "4505 | \n", "
1 | \n", "fr | \n", "70 | \n", "
2 | \n", "es | \n", "32 | \n", "
3 | \n", "zh | \n", "27 | \n", "
4 | \n", "de | \n", "27 | \n", "
\n", " | budget | \n", "genres | \n", "homepage | \n", "id | \n", "keywords | \n", "original_language | \n", "original_title | \n", "overview | \n", "popularity | \n", "production_companies | \n", "production_countries | \n", "release_date | \n", "revenue | \n", "runtime | \n", "spoken_languages | \n", "status | \n", "tagline | \n", "title | \n", "vote_average | \n", "vote_count | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
97 | \n", "15000000 | \n", "[{\"id\": 28, \"name\": \"Action\"}, {\"id\": 12, \"nam... | \n", "NaN | \n", "315011 | \n", "[{\"id\": 1299, \"name\": \"monster\"}, {\"id\": 7671,... | \n", "ja | \n", "シン・ゴジラ | \n", "From the mind behind Evangelion comes a hit la... | \n", "9.476999 | \n", "[{\"name\": \"Cine Bazar\", \"id\": 5896}, {\"name\": ... | \n", "[{\"iso_3166_1\": \"JP\", \"name\": \"Japan\"}] | \n", "2016-07-29 | \n", "77000000 | \n", "120.0 | \n", "[{\"iso_639_1\": \"it\", \"name\": \"Italiano\"}, {\"is... | \n", "Released | \n", "A god incarnate. A city doomed. | \n", "Shin Godzilla | \n", "6.5 | \n", "143 | \n", "
235 | \n", "97250400 | \n", "[{\"id\": 14, \"name\": \"Fantasy\"}, {\"id\": 12, \"na... | \n", "http://www.asterixauxjeuxolympiques.com/index.php | \n", "2395 | \n", "[{\"id\": 271, \"name\": \"competition\"}, {\"id\": 12... | \n", "fr | \n", "Astérix aux Jeux Olympiques | \n", "Astérix and Obélix have to win the Olympic Gam... | \n", "20.344364 | \n", "[{\"name\": \"Constantin Film\", \"id\": 47}, {\"name... | \n", "[{\"iso_3166_1\": \"BE\", \"name\": \"Belgium\"}, {\"is... | \n", "2008-01-13 | \n", "132900000 | \n", "116.0 | \n", "[{\"iso_639_1\": \"fr\", \"name\": \"Fran\\u00e7ais\"},... | \n", "Released | \n", "NaN | \n", "Asterix at the Olympic Games | \n", "5.0 | \n", "471 | \n", "
317 | \n", "94000000 | \n", "[{\"id\": 18, \"name\": \"Drama\"}, {\"id\": 36, \"name... | \n", "http://www.theflowersofwarmovie.com/ | \n", "76758 | \n", "[{\"id\": 173251, \"name\": \"forced prostitution\"}... | \n", "zh | \n", "金陵十三釵 | \n", "A Westerner finds refuge with a group of women... | \n", "12.516546 | \n", "[{\"name\": \"Beijing New Picture Film Co. Ltd.\",... | \n", "[{\"iso_3166_1\": \"CN\", \"name\": \"China\"}, {\"iso_... | \n", "2011-12-15 | \n", "95311434 | \n", "145.0 | \n", "[{\"iso_639_1\": \"zh\", \"name\": \"\\u666e\\u901a\\u8b... | \n", "Released | \n", "NaN | \n", "The Flowers of War | \n", "7.1 | \n", "187 | \n", "
474 | \n", "0 | \n", "[{\"id\": 9648, \"name\": \"Mystery\"}, {\"id\": 18, \"... | \n", "NaN | \n", "330770 | \n", "[{\"id\": 428, \"name\": \"nurse\"}, {\"id\": 658, \"na... | \n", "fr | \n", "Évolution | \n", "11-year-old Nicolas lives with his mother in a... | \n", "3.300061 | \n", "[{\"name\": \"Ex Nihilo\", \"id\": 3307}, {\"name\": \"... | \n", "[{\"iso_3166_1\": \"BE\", \"name\": \"Belgium\"}, {\"is... | \n", "2015-09-14 | \n", "0 | \n", "81.0 | \n", "[{\"iso_639_1\": \"fr\", \"name\": \"Fran\\u00e7ais\"}] | \n", "Released | \n", "NaN | \n", "Evolution | \n", "6.4 | \n", "47 | \n", "
492 | \n", "8000000 | \n", "[{\"id\": 35, \"name\": \"Comedy\"}, {\"id\": 16, \"nam... | \n", "NaN | \n", "293644 | \n", "[{\"id\": 209714, \"name\": \"3d\"}] | \n", "es | \n", "Don Gato: El inicio de la pandilla | \n", "Top Cat has arrived to charm his way into your... | \n", "0.719996 | \n", "[{\"name\": \"Anima Estudios\", \"id\": 9965}, {\"nam... | \n", "[{\"iso_3166_1\": \"IN\", \"name\": \"India\"}, {\"iso_... | \n", "2015-10-30 | \n", "0 | \n", "89.0 | \n", "[] | \n", "Released | \n", "NaN | \n", "Top Cat Begins | \n", "5.3 | \n", "9 | \n", "
... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "
4739 | \n", "0 | \n", "[{\"id\": 35, \"name\": \"Comedy\"}, {\"id\": 10749, \"... | \n", "NaN | \n", "90414 | \n", "[{\"id\": 187056, \"name\": \"woman director\"}] | \n", "fr | \n", "I Love You, Don't Touch Me! | \n", "The story of a 25 year old virgin girl, lookin... | \n", "0.020839 | \n", "[] | \n", "[{\"iso_3166_1\": \"US\", \"name\": \"United States o... | \n", "1997-01-21 | \n", "0 | \n", "86.0 | \n", "[{\"iso_639_1\": \"en\", \"name\": \"English\"}] | \n", "Released | \n", "Just Your Typical Boy-Loves-Girl Who Doesn't L... | \n", "I Love You, Don't Touch Me! | \n", "6.0 | \n", "1 | \n", "
4751 | \n", "0 | \n", "[{\"id\": 18, \"name\": \"Drama\"}, {\"id\": 10749, \"n... | \n", "NaN | \n", "42109 | \n", "[] | \n", "pt | \n", "Gabriela, Cravo e Canela | \n", "In 1925, Gabriela becomes cook, mistress, and ... | \n", "0.557602 | \n", "[{\"name\": \"United Artists\", \"id\": 60}, {\"name\"... | \n", "[{\"iso_3166_1\": \"BR\", \"name\": \"Brazil\"}] | \n", "1983-03-24 | \n", "0 | \n", "99.0 | \n", "[{\"iso_639_1\": \"pt\", \"name\": \"Portugu\\u00eas\"}] | \n", "Released | \n", "NaN | \n", "Gabriela | \n", "6.0 | \n", "2 | \n", "
4790 | \n", "0 | \n", "[{\"id\": 18, \"name\": \"Drama\"}, {\"id\": 10769, \"n... | \n", "NaN | \n", "13898 | \n", "[] | \n", "fa | \n", "دایره | \n", "Various women struggle to function in the oppr... | \n", "1.193779 | \n", "[{\"name\": \"Jafar Panahi Film Productions\", \"id... | \n", "[{\"iso_3166_1\": \"IR\", \"name\": \"Iran\"}] | \n", "2000-09-08 | \n", "0 | \n", "90.0 | \n", "[{\"iso_639_1\": \"fa\", \"name\": \"\\u0641\\u0627\\u06... | \n", "Released | \n", "NaN | \n", "The Circle | \n", "6.6 | \n", "17 | \n", "
4792 | \n", "20000 | \n", "[{\"id\": 80, \"name\": \"Crime\"}, {\"id\": 27, \"name... | \n", "NaN | \n", "36095 | \n", "[{\"id\": 233, \"name\": \"japan\"}, {\"id\": 549, \"na... | \n", "ja | \n", "キュア | \n", "A wave of gruesome murders is sweeping Tokyo. ... | \n", "0.212443 | \n", "[{\"name\": \"Daiei Studios\", \"id\": 881}] | \n", "[{\"iso_3166_1\": \"JP\", \"name\": \"Japan\"}] | \n", "1997-11-06 | \n", "99000 | \n", "111.0 | \n", "[{\"iso_639_1\": \"ja\", \"name\": \"\\u65e5\\u672c\\u8a... | \n", "Released | \n", "Madness. Terror. Murder. | \n", "Cure | \n", "7.4 | \n", "63 | \n", "
4798 | \n", "220000 | \n", "[{\"id\": 28, \"name\": \"Action\"}, {\"id\": 80, \"nam... | \n", "NaN | \n", "9367 | \n", "[{\"id\": 5616, \"name\": \"united states\\u2013mexi... | \n", "es | \n", "El Mariachi | \n", "El Mariachi just wants to play his guitar and ... | \n", "14.269792 | \n", "[{\"name\": \"Columbia Pictures\", \"id\": 5}] | \n", "[{\"iso_3166_1\": \"MX\", \"name\": \"Mexico\"}, {\"iso... | \n", "1992-09-04 | \n", "2040920 | \n", "81.0 | \n", "[{\"iso_639_1\": \"es\", \"name\": \"Espa\\u00f1ol\"}] | \n", "Released | \n", "He didn't come looking for trouble, but troubl... | \n", "El Mariachi | \n", "6.6 | \n", "238 | \n", "
298 rows × 20 columns
\n", "\n", " | filmeId | \n", "titulo | \n", "generos | \n", "
---|---|---|---|
0 | \n", "1 | \n", "Toy Story (1995) | \n", "Adventure|Animation|Children|Comedy|Fantasy | \n", "
1 | \n", "2 | \n", "Jumanji (1995) | \n", "Adventure|Children|Fantasy | \n", "
2 | \n", "3 | \n", "Grumpier Old Men (1995) | \n", "Comedy|Romance | \n", "
3 | \n", "4 | \n", "Waiting to Exhale (1995) | \n", "Comedy|Drama|Romance | \n", "
4 | \n", "5 | \n", "Father of the Bride Part II (1995) | \n", "Comedy | \n", "
\n", " | usuarioId | \n", "filmeId | \n", "nota | \n", "momento | \n", "
---|---|---|---|---|
0 | \n", "1 | \n", "1 | \n", "4.0 | \n", "964982703 | \n", "
1 | \n", "1 | \n", "3 | \n", "4.0 | \n", "964981247 | \n", "
2 | \n", "1 | \n", "6 | \n", "4.0 | \n", "964982224 | \n", "
3 | \n", "1 | \n", "47 | \n", "5.0 | \n", "964983815 | \n", "
4 | \n", "1 | \n", "50 | \n", "5.0 | \n", "964982931 | \n", "