diff --git "a/tmdb/tmdb_fetcher.ipynb" "b/tmdb/tmdb_fetcher.ipynb"
new file mode 100644--- /dev/null
+++ "b/tmdb/tmdb_fetcher.ipynb"
@@ -0,0 +1,5830 @@
+{
+ "nbformat": 4,
+ "nbformat_minor": 0,
+ "metadata": {
+ "colab": {
+ "provenance": [],
+ "authorship_tag": "ABX9TyOiIly2Sbqke2mc5VEtbooQ"
+ },
+ "kernelspec": {
+ "name": "python3",
+ "display_name": "Python 3"
+ },
+ "language_info": {
+ "name": "python"
+ }
+ },
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "source": [
+ "# TMDB Dataset\n",
+ "\n",
+ "This notebook contains recipe to fetch raw data from tmdb API and convert it into useful Dataset.\n",
+ "\n",
+ "Date: 05.31, 2024\n",
+ "\n",
+ "Dataset Source: [The Movie Database (TMDB)](https://www.themoviedb.org/)\n",
+ "\n",
+ "API Documents: [TMDB API](https://developer.themoviedb.org/docs)\n",
+ "\n",
+ "Reference Notebook: [Creating dataset using tmdb API | Kaggle](https://www.kaggle.com/code/ursmaheshj/creating-dataset-using-tmdb-api/notebook)."
+ ],
+ "metadata": {
+ "id": "gFA3c2WvcgKj"
+ }
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "from google.colab import drive\n",
+ "drive.mount('/content/drive/')"
+ ],
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/"
+ },
+ "id": "WpoKbmq7cqms",
+ "executionInfo": {
+ "status": "ok",
+ "timestamp": 1717164311115,
+ "user_tz": -480,
+ "elapsed": 24007,
+ "user": {
+ "displayName": "Yunhui Liu",
+ "userId": "17327062528746877694"
+ }
+ },
+ "outputId": "ba1ae029-ae38-4cf6-c473-676595437619"
+ },
+ "execution_count": 1,
+ "outputs": [
+ {
+ "output_type": "stream",
+ "name": "stdout",
+ "text": [
+ "Mounted at /content/drive/\n"
+ ]
+ }
+ ]
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "import os\n",
+ "path=\"/content/drive/MyDrive/TMDB\"\n",
+ "os.chdir(path)\n",
+ "os.listdir(path)"
+ ],
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/"
+ },
+ "id": "_YNkB4M9cwxZ",
+ "executionInfo": {
+ "status": "ok",
+ "timestamp": 1717164314809,
+ "user_tz": -480,
+ "elapsed": 398,
+ "user": {
+ "displayName": "Yunhui Liu",
+ "userId": "17327062528746877694"
+ }
+ },
+ "outputId": "1aa83767-1219-4f46-8eb9-afcba19c6df1"
+ },
+ "execution_count": 2,
+ "outputs": [
+ {
+ "output_type": "execute_result",
+ "data": {
+ "text/plain": [
+ "['TMDB_Dataset_Fetcher.ipynb',\n",
+ " 'ARTA.csv',\n",
+ " 'ARTA_en.csv',\n",
+ " 'credits.csv',\n",
+ " 'Movies.csv',\n",
+ " 'TMDB_Fetcher.ipynb',\n",
+ " 'TMDB_Builder.ipynb']"
+ ]
+ },
+ "metadata": {},
+ "execution_count": 2
+ }
+ ]
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "import pandas as pd\n",
+ "import requests"
+ ],
+ "metadata": {
+ "id": "PQ6rnhXTc1JG",
+ "executionInfo": {
+ "status": "ok",
+ "timestamp": 1717164317964,
+ "user_tz": -480,
+ "elapsed": 991,
+ "user": {
+ "displayName": "Yunhui Liu",
+ "userId": "17327062528746877694"
+ }
+ }
+ },
+ "execution_count": 3,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "# Your API Key\n",
+ "api_key = ''"
+ ],
+ "metadata": {
+ "id": "wkupFljNc3ZJ",
+ "executionInfo": {
+ "status": "ok",
+ "timestamp": 1717165357017,
+ "user_tz": -480,
+ "elapsed": 2,
+ "user": {
+ "displayName": "Yunhui Liu",
+ "userId": "17327062528746877694"
+ }
+ }
+ },
+ "execution_count": 29,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "## Movies\n",
+ "\n",
+ "Selected genres and corresponding genre_ids.\n",
+ "\n",
+ "| Id | Genre |\n",
+ "| ----- | :-------- |\n",
+ "| 28 | Action |\n",
+ "| 10749 | Romance |\n",
+ "| 53 | Thriller |\n",
+ "| 16 | Animation |\n"
+ ],
+ "metadata": {
+ "id": "6fIoGB_idPnp"
+ }
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "url = f\"https://api.themoviedb.org/3/discover/movie?include_adult=false\\\n",
+ "&include_video=false&language=en-US&page=1&sort_by=popularity.desc\\\n",
+ "&with_genres=28&without_genres=10749%2C53%2C16\\\n",
+ "&api_key={api_key}\"\n",
+ "response = requests.get(url)\n",
+ "print(f\"Action {response.json()['total_pages']}pages, {response.json()['total_results']} results\")\n",
+ "\n",
+ "url = f\"https://api.themoviedb.org/3/discover/movie?include_adult=false\\\n",
+ "&include_video=false&language=en-US&page=1&sort_by=popularity.desc\\\n",
+ "&with_genres=10749&without_genres=28%2C53%2C16\\\n",
+ "&api_key={api_key}\"\n",
+ "response = requests.get(url)\n",
+ "print(f\"Romance {response.json()['total_pages']}pages, {response.json()['total_results']} results\")\n",
+ "\n",
+ "url = f\"https://api.themoviedb.org/3/discover/movie?include_adult=false\\\n",
+ "&include_video=false&language=en-US&page=1&sort_by=popularity.desc\\\n",
+ "&with_genres=53&without_genres=10749%2C28%2C16\\\n",
+ "&api_key={api_key}\"\n",
+ "response = requests.get(url)\n",
+ "print(f\"Thriller {response.json()['total_pages']}pages, {response.json()['total_results']} results\")\n",
+ "\n",
+ "url = f\"https://api.themoviedb.org/3/discover/movie?include_adult=false\\\n",
+ "&include_video=false&language=en-US&page=1&sort_by=popularity.desc\\\n",
+ "&with_genres=16&without_genres=10749%2C53%2C28\\\n",
+ "&api_key={api_key}\"\n",
+ "response = requests.get(url)\n",
+ "print(f\"Animation {response.json()['total_pages']}pages, {response.json()['total_results']} results\")"
+ ],
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/"
+ },
+ "id": "UvOTuT_7h1FO",
+ "executionInfo": {
+ "status": "ok",
+ "timestamp": 1717134670721,
+ "user_tz": -480,
+ "elapsed": 1786,
+ "user": {
+ "displayName": "Yunhui Liu",
+ "userId": "17327062528746877694"
+ }
+ },
+ "outputId": "8b9e0284-5b53-44bf-a59a-7e1021d606e2"
+ },
+ "execution_count": null,
+ "outputs": [
+ {
+ "output_type": "stream",
+ "name": "stdout",
+ "text": [
+ "Action 1399pages, 27972 results\n",
+ "Romance 2267pages, 45325 results\n",
+ "Thriller 1768pages, 35354 results\n",
+ "Animation 2509pages, 50178 results\n"
+ ]
+ }
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "### Data Collection\n"
+ ],
+ "metadata": {
+ "id": "MxhK_wiShx9t"
+ }
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "#### Action\n",
+ "\n",
+ "Action: 140 pages"
+ ],
+ "metadata": {
+ "id": "lB1_w50Am0pO"
+ }
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "%%time\n",
+ "# We will first create an empty dataframe to store all the movie detail\n",
+ "actions = pd.DataFrame()\n",
+ "\n",
+ "# Our for loop will iterate through each page, get json data convert it into dataframe and append it to original dataframe\n",
+ "for i in range(1,141):\n",
+ " url = f\"https://api.themoviedb.org/3/discover/movie?include_adult=false\\\n",
+ "&include_video=false&language=en-US&page={i}&sort_by=popularity.desc\\\n",
+ "&with_genres=28&without_genres=10749%2C53%2C16\\\n",
+ "&api_key={api_key}\"\n",
+ " response = requests.get(url)\n",
+ " temporary_df = pd.DataFrame(response.json()['results'])\n",
+ "\n",
+ " actions = pd.concat([actions,temporary_df],ignore_index=True)\n",
+ "actions.shape"
+ ],
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/"
+ },
+ "id": "WmPwn-Fkj-VK",
+ "executionInfo": {
+ "status": "ok",
+ "timestamp": 1717134825902,
+ "user_tz": -480,
+ "elapsed": 40535,
+ "user": {
+ "displayName": "Yunhui Liu",
+ "userId": "17327062528746877694"
+ }
+ },
+ "outputId": "c2809233-936d-48f1-e19c-d0bf5ee91068"
+ },
+ "execution_count": null,
+ "outputs": [
+ {
+ "output_type": "stream",
+ "name": "stdout",
+ "text": [
+ "CPU times: user 12.1 s, sys: 181 ms, total: 12.3 s\n",
+ "Wall time: 40.2 s\n"
+ ]
+ },
+ {
+ "output_type": "execute_result",
+ "data": {
+ "text/plain": [
+ "(2800, 14)"
+ ]
+ },
+ "metadata": {},
+ "execution_count": 7
+ }
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "#### Romance\n",
+ "\n",
+ "Romance: 227 pages"
+ ],
+ "metadata": {
+ "id": "oNz-T_TakU_q"
+ }
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "%%time\n",
+ "# We will first create an empty dataframe to store all the movie detail\n",
+ "romances = pd.DataFrame()\n",
+ "\n",
+ "# Our for loop will iterate through each page, get json data convert it into dataframe and append it to original dataframe\n",
+ "for i in range(1,228):\n",
+ " url = f\"https://api.themoviedb.org/3/discover/movie?include_adult=false\\\n",
+ "&include_video=false&language=en-US&page={i}&sort_by=popularity.desc\\\n",
+ "&with_genres=10749&without_genres=28%2C53%2C16\\\n",
+ "&api_key={api_key}\"\n",
+ " response = requests.get(url)\n",
+ " temporary_df = pd.DataFrame(response.json()['results'])\n",
+ "\n",
+ " romances = pd.concat([romances,temporary_df],ignore_index=True)\n",
+ "romances.shape"
+ ],
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/"
+ },
+ "id": "0E26TM_gkihj",
+ "executionInfo": {
+ "status": "ok",
+ "timestamp": 1717134901817,
+ "user_tz": -480,
+ "elapsed": 69491,
+ "user": {
+ "displayName": "Yunhui Liu",
+ "userId": "17327062528746877694"
+ }
+ },
+ "outputId": "39af37ca-66a1-47e1-9308-3ab5ceaec78f"
+ },
+ "execution_count": null,
+ "outputs": [
+ {
+ "output_type": "stream",
+ "name": "stdout",
+ "text": [
+ "CPU times: user 19.9 s, sys: 322 ms, total: 20.2 s\n",
+ "Wall time: 1min 8s\n"
+ ]
+ },
+ {
+ "output_type": "execute_result",
+ "data": {
+ "text/plain": [
+ "(4540, 14)"
+ ]
+ },
+ "metadata": {},
+ "execution_count": 8
+ }
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "#### Thriller\n",
+ "\n",
+ "Thriller: 177 pages"
+ ],
+ "metadata": {
+ "id": "W6I4GWtAk9Ii"
+ }
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "%%time\n",
+ "# We will first create an empty dataframe to store all the movie detail\n",
+ "thrillers = pd.DataFrame()\n",
+ "\n",
+ "# Our for loop will iterate through each page, get json data convert it into dataframe and append it to original dataframe\n",
+ "for i in range(1,178):\n",
+ " url = f\"https://api.themoviedb.org/3/discover/movie?include_adult=false\\\n",
+ "&include_video=false&language=en-US&page={i}&sort_by=popularity.desc\\\n",
+ "&with_genres=53&without_genres=28%2C10749%2C16\\\n",
+ "&api_key={api_key}\"\n",
+ " response = requests.get(url)\n",
+ " temporary_df = pd.DataFrame(response.json()['results'])\n",
+ "\n",
+ " thrillers = pd.concat([thrillers,temporary_df],ignore_index=True)\n",
+ "thrillers.shape"
+ ],
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/"
+ },
+ "id": "UNTe3ibjk9u7",
+ "executionInfo": {
+ "status": "ok",
+ "timestamp": 1717134976745,
+ "user_tz": -480,
+ "elapsed": 51897,
+ "user": {
+ "displayName": "Yunhui Liu",
+ "userId": "17327062528746877694"
+ }
+ },
+ "outputId": "adad773c-6b2f-443f-8202-d0e2b5e1d270"
+ },
+ "execution_count": null,
+ "outputs": [
+ {
+ "output_type": "stream",
+ "name": "stdout",
+ "text": [
+ "CPU times: user 15.5 s, sys: 273 ms, total: 15.8 s\n",
+ "Wall time: 51.5 s\n"
+ ]
+ },
+ {
+ "output_type": "execute_result",
+ "data": {
+ "text/plain": [
+ "(3540, 14)"
+ ]
+ },
+ "metadata": {},
+ "execution_count": 9
+ }
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "#### Animation\n",
+ "\n",
+ "Animation: 251 pages"
+ ],
+ "metadata": {
+ "id": "VIImiIUIlKnj"
+ }
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "%%time\n",
+ "# We will first create an empty dataframe to store all the movie detail\n",
+ "animations = pd.DataFrame()\n",
+ "\n",
+ "# Our for loop will iterate through each page, get json data convert it into dataframe and append it to original dataframe\n",
+ "for i in range(1,252):\n",
+ " url = f\"https://api.themoviedb.org/3/discover/movie?include_adult=false\\\n",
+ "&include_video=false&language=en-US&page={i}&sort_by=popularity.desc\\\n",
+ "&with_genres=16&without_genres=28%2C10749%2C53\\\n",
+ "&api_key={api_key}\"\n",
+ " response = requests.get(url)\n",
+ " temporary_df = pd.DataFrame(response.json()['results'])\n",
+ "\n",
+ " animations = pd.concat([animations,temporary_df],ignore_index=True)\n",
+ "animations.shape"
+ ],
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/"
+ },
+ "id": "nHFaxH5RlT16",
+ "executionInfo": {
+ "status": "ok",
+ "timestamp": 1717135053509,
+ "user_tz": -480,
+ "elapsed": 76766,
+ "user": {
+ "displayName": "Yunhui Liu",
+ "userId": "17327062528746877694"
+ }
+ },
+ "outputId": "ce2d0847-2992-417d-cfb0-e4fa9cedb5bb"
+ },
+ "execution_count": null,
+ "outputs": [
+ {
+ "output_type": "stream",
+ "name": "stdout",
+ "text": [
+ "CPU times: user 21.4 s, sys: 387 ms, total: 21.8 s\n",
+ "Wall time: 1min 16s\n"
+ ]
+ },
+ {
+ "output_type": "execute_result",
+ "data": {
+ "text/plain": [
+ "(5020, 14)"
+ ]
+ },
+ "metadata": {},
+ "execution_count": 10
+ }
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "### Data Preprocessing"
+ ],
+ "metadata": {
+ "id": "HU8zlHnqm5BE"
+ }
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "actions.head(2)"
+ ],
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/",
+ "height": 271
+ },
+ "id": "1MS4qpXXOY6r",
+ "executionInfo": {
+ "status": "ok",
+ "timestamp": 1717135066622,
+ "user_tz": -480,
+ "elapsed": 505,
+ "user": {
+ "displayName": "Yunhui Liu",
+ "userId": "17327062528746877694"
+ }
+ },
+ "outputId": "a0e89df8-3998-4825-adce-2e8167751356"
+ },
+ "execution_count": null,
+ "outputs": [
+ {
+ "output_type": "execute_result",
+ "data": {
+ "text/plain": [
+ " adult backdrop_path genre_ids id \\\n",
+ "0 False /fqv8v6AycXKsivp1T5yKtLbGXce.jpg [878, 12, 28] 653346 \n",
+ "1 False /z121dSTR7PY9KxKuvwiIFSYW8cf.jpg [10752, 28, 18] 929590 \n",
+ "\n",
+ " original_language original_title \\\n",
+ "0 en Kingdom of the Planet of the Apes \n",
+ "1 en Civil War \n",
+ "\n",
+ " overview popularity \\\n",
+ "0 Several generations in the future following Ca... 7113.603 \n",
+ "1 In the near future, a group of war journalists... 3151.038 \n",
+ "\n",
+ " poster_path release_date \\\n",
+ "0 /gKkl37BQuKTanygYQG1pyYgLVgf.jpg 2024-05-08 \n",
+ "1 /sh7Rg8Er3tFcN9BpKIPOMvALgZd.jpg 2024-04-10 \n",
+ "\n",
+ " title video vote_average vote_count \n",
+ "0 Kingdom of the Planet of the Apes False 7.012 694 \n",
+ "1 Civil War False 7.205 1062 "
+ ],
+ "text/html": [
+ "\n",
+ "
\n",
+ "
\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " adult | \n",
+ " backdrop_path | \n",
+ " genre_ids | \n",
+ " id | \n",
+ " original_language | \n",
+ " original_title | \n",
+ " overview | \n",
+ " popularity | \n",
+ " poster_path | \n",
+ " release_date | \n",
+ " title | \n",
+ " video | \n",
+ " vote_average | \n",
+ " vote_count | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | 0 | \n",
+ " False | \n",
+ " /fqv8v6AycXKsivp1T5yKtLbGXce.jpg | \n",
+ " [878, 12, 28] | \n",
+ " 653346 | \n",
+ " en | \n",
+ " Kingdom of the Planet of the Apes | \n",
+ " Several generations in the future following Ca... | \n",
+ " 7113.603 | \n",
+ " /gKkl37BQuKTanygYQG1pyYgLVgf.jpg | \n",
+ " 2024-05-08 | \n",
+ " Kingdom of the Planet of the Apes | \n",
+ " False | \n",
+ " 7.012 | \n",
+ " 694 | \n",
+ "
\n",
+ " \n",
+ " | 1 | \n",
+ " False | \n",
+ " /z121dSTR7PY9KxKuvwiIFSYW8cf.jpg | \n",
+ " [10752, 28, 18] | \n",
+ " 929590 | \n",
+ " en | \n",
+ " Civil War | \n",
+ " In the near future, a group of war journalists... | \n",
+ " 3151.038 | \n",
+ " /sh7Rg8Er3tFcN9BpKIPOMvALgZd.jpg | \n",
+ " 2024-04-10 | \n",
+ " Civil War | \n",
+ " False | \n",
+ " 7.205 | \n",
+ " 1062 | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
\n",
+ "
\n",
+ "
\n"
+ ],
+ "application/vnd.google.colaboratory.intrinsic+json": {
+ "type": "dataframe",
+ "variable_name": "actions",
+ "summary": "{\n \"name\": \"actions\",\n \"rows\": 2800,\n \"fields\": [\n {\n \"column\": \"adult\",\n \"properties\": {\n \"dtype\": \"boolean\",\n \"num_unique_values\": 1,\n \"samples\": [\n false\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"backdrop_path\",\n \"properties\": {\n \"dtype\": \"string\",\n \"num_unique_values\": 2726,\n \"samples\": [\n \"/7pcS8bltNCczNHz8o60GV8Qfb3w.jpg\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"genre_ids\",\n \"properties\": {\n \"dtype\": \"object\",\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"id\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 307920,\n \"min\": 11,\n \"max\": 1292801,\n \"num_unique_values\": 2800,\n \"samples\": [\n 598413\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"original_language\",\n \"properties\": {\n \"dtype\": \"category\",\n \"num_unique_values\": 40,\n \"samples\": [\n \"ta\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"original_title\",\n \"properties\": {\n \"dtype\": \"string\",\n \"num_unique_values\": 2752,\n \"samples\": [\n \"Death Race 2050\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"overview\",\n \"properties\": {\n \"dtype\": \"string\",\n \"num_unique_values\": 2792,\n \"samples\": [\n \"Taking place 4 years after the events of the Uchu Sentai Kyuranger TV series, the universe is at peace. But that changes when Hammie (Chameleon Green) attacks the Rebellion and steals the newly developed Neo Kyutama! Fearing its possible misuse once it falls into the wrong hands, Space Federation President Tsurugi Ohtori (Houou Soldier) declares Hammie wanted all across the universe. Lucky (Shishi Red) and some of the Kyurangers believe in Hammie, fighting against Tsurugi's decision, causing a rift amongst the Kyurangers. And where do Space Sheriff Gavan and Space Sheriff Shaider fit onto all this?\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"popularity\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 169.0615398088141,\n \"min\": 6.887,\n \"max\": 7113.603,\n \"num_unique_values\": 2636,\n \"samples\": [\n 8.003\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"poster_path\",\n \"properties\": {\n \"dtype\": \"string\",\n \"num_unique_values\": 2789,\n \"samples\": [\n \"/9iZjVn6Q5FJa92SQLcFMrskpES9.jpg\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"release_date\",\n \"properties\": {\n \"dtype\": \"object\",\n \"num_unique_values\": 2431,\n \"samples\": [\n \"2022-08-05\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"title\",\n \"properties\": {\n \"dtype\": \"string\",\n \"num_unique_values\": 2744,\n \"samples\": [\n \"Here Comes the Boom\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"video\",\n \"properties\": {\n \"dtype\": \"boolean\",\n \"num_unique_values\": 1,\n \"samples\": [\n false\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"vote_average\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 1.2666812183599805,\n \"min\": 0.0,\n \"max\": 9.5,\n \"num_unique_values\": 1418,\n \"samples\": [\n 7.119\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"vote_count\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 3548,\n \"min\": 0,\n \"max\": 35776,\n \"num_unique_values\": 1183,\n \"samples\": [\n 876\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}"
+ }
+ },
+ "metadata": {},
+ "execution_count": 11
+ }
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "#### Merge DataFrames"
+ ],
+ "metadata": {
+ "id": "JddlznsRn3EM"
+ }
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "actions['genre'] = 'Action'\n",
+ "romances['genre'] = 'Romance'\n",
+ "thrillers['genre'] = 'Thriller'\n",
+ "animations['genre'] = 'Animation'\n",
+ "\n",
+ "movies = pd.concat([actions, romances, thrillers, animations], ignore_index=True)\n",
+ "movies.to_csv('ARTA.csv',index=False)\n",
+ "movies.shape"
+ ],
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/"
+ },
+ "id": "BUKSYLnPn8jy",
+ "executionInfo": {
+ "status": "ok",
+ "timestamp": 1717135148061,
+ "user_tz": -480,
+ "elapsed": 1744,
+ "user": {
+ "displayName": "Yunhui Liu",
+ "userId": "17327062528746877694"
+ }
+ },
+ "outputId": "e45c5d37-eb5e-4500-f53f-a6b0b422d4cc"
+ },
+ "execution_count": null,
+ "outputs": [
+ {
+ "output_type": "execute_result",
+ "data": {
+ "text/plain": [
+ "(15900, 15)"
+ ]
+ },
+ "metadata": {},
+ "execution_count": 12
+ }
+ ]
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "movies = pd.read_csv('ARTA.csv', lineterminator=\"\\n\")\n",
+ "movies.head(2)"
+ ],
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/",
+ "height": 271
+ },
+ "id": "9TTf0JzHSUmd",
+ "executionInfo": {
+ "status": "ok",
+ "timestamp": 1717136414056,
+ "user_tz": -480,
+ "elapsed": 857,
+ "user": {
+ "displayName": "Yunhui Liu",
+ "userId": "17327062528746877694"
+ }
+ },
+ "outputId": "4e816529-6936-4d8e-b179-27e1f9377a19"
+ },
+ "execution_count": null,
+ "outputs": [
+ {
+ "output_type": "execute_result",
+ "data": {
+ "text/plain": [
+ " adult backdrop_path genre_ids id \\\n",
+ "0 False /fqv8v6AycXKsivp1T5yKtLbGXce.jpg [878, 12, 28] 653346 \n",
+ "1 False /z121dSTR7PY9KxKuvwiIFSYW8cf.jpg [10752, 28, 18] 929590 \n",
+ "\n",
+ " original_language original_title \\\n",
+ "0 en Kingdom of the Planet of the Apes \n",
+ "1 en Civil War \n",
+ "\n",
+ " overview popularity \\\n",
+ "0 Several generations in the future following Ca... 7113.603 \n",
+ "1 In the near future, a group of war journalists... 3151.038 \n",
+ "\n",
+ " poster_path release_date \\\n",
+ "0 /gKkl37BQuKTanygYQG1pyYgLVgf.jpg 2024-05-08 \n",
+ "1 /sh7Rg8Er3tFcN9BpKIPOMvALgZd.jpg 2024-04-10 \n",
+ "\n",
+ " title video vote_average vote_count genre \n",
+ "0 Kingdom of the Planet of the Apes False 7.012 694 Action \n",
+ "1 Civil War False 7.205 1062 Action "
+ ],
+ "text/html": [
+ "\n",
+ " \n",
+ "
\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " adult | \n",
+ " backdrop_path | \n",
+ " genre_ids | \n",
+ " id | \n",
+ " original_language | \n",
+ " original_title | \n",
+ " overview | \n",
+ " popularity | \n",
+ " poster_path | \n",
+ " release_date | \n",
+ " title | \n",
+ " video | \n",
+ " vote_average | \n",
+ " vote_count | \n",
+ " genre | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | 0 | \n",
+ " False | \n",
+ " /fqv8v6AycXKsivp1T5yKtLbGXce.jpg | \n",
+ " [878, 12, 28] | \n",
+ " 653346 | \n",
+ " en | \n",
+ " Kingdom of the Planet of the Apes | \n",
+ " Several generations in the future following Ca... | \n",
+ " 7113.603 | \n",
+ " /gKkl37BQuKTanygYQG1pyYgLVgf.jpg | \n",
+ " 2024-05-08 | \n",
+ " Kingdom of the Planet of the Apes | \n",
+ " False | \n",
+ " 7.012 | \n",
+ " 694 | \n",
+ " Action | \n",
+ "
\n",
+ " \n",
+ " | 1 | \n",
+ " False | \n",
+ " /z121dSTR7PY9KxKuvwiIFSYW8cf.jpg | \n",
+ " [10752, 28, 18] | \n",
+ " 929590 | \n",
+ " en | \n",
+ " Civil War | \n",
+ " In the near future, a group of war journalists... | \n",
+ " 3151.038 | \n",
+ " /sh7Rg8Er3tFcN9BpKIPOMvALgZd.jpg | \n",
+ " 2024-04-10 | \n",
+ " Civil War | \n",
+ " False | \n",
+ " 7.205 | \n",
+ " 1062 | \n",
+ " Action | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
\n",
+ "
\n",
+ "
\n"
+ ],
+ "application/vnd.google.colaboratory.intrinsic+json": {
+ "type": "dataframe",
+ "variable_name": "movies",
+ "summary": "{\n \"name\": \"movies\",\n \"rows\": 15900,\n \"fields\": [\n {\n \"column\": \"adult\",\n \"properties\": {\n \"dtype\": \"boolean\",\n \"num_unique_values\": 1,\n \"samples\": [\n false\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"backdrop_path\",\n \"properties\": {\n \"dtype\": \"string\",\n \"num_unique_values\": 14808,\n \"samples\": [\n \"/tQRmI2spaR2kAJocbGfBxzCtQGp.jpg\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"genre_ids\",\n \"properties\": {\n \"dtype\": \"category\",\n \"num_unique_values\": 2289,\n \"samples\": [\n \"[16, 35, 10751, 10770, 12, 14]\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"id\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 336124,\n \"min\": 2,\n \"max\": 1295043,\n \"num_unique_values\": 15900,\n \"samples\": [\n 192\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"original_language\",\n \"properties\": {\n \"dtype\": \"category\",\n \"num_unique_values\": 68,\n \"samples\": [\n \"ca\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"original_title\",\n \"properties\": {\n \"dtype\": \"string\",\n \"num_unique_values\": 15351,\n \"samples\": [\n \"Terror Train\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"overview\",\n \"properties\": {\n \"dtype\": \"string\",\n \"num_unique_values\": 15752,\n \"samples\": [\n \"Elsa, Anna, Kristoff and Olaf head far into the forest to learn the truth about an ancient mystery of their kingdom.\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"popularity\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 75.70525926381225,\n \"min\": 2.362,\n \"max\": 7113.603,\n \"num_unique_values\": 11585,\n \"samples\": [\n 9.703\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"poster_path\",\n \"properties\": {\n \"dtype\": \"string\",\n \"num_unique_values\": 15681,\n \"samples\": [\n \"/q9fohCRpQ7m8OTyi82fxa3B86te.jpg\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"release_date\",\n \"properties\": {\n \"dtype\": \"object\",\n \"num_unique_values\": 9292,\n \"samples\": [\n \"1976-08-01\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"title\",\n \"properties\": {\n \"dtype\": \"string\",\n \"num_unique_values\": 15153,\n \"samples\": [\n \"The Invisible Guest\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"video\",\n \"properties\": {\n \"dtype\": \"boolean\",\n \"num_unique_values\": 1,\n \"samples\": [\n false\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"vote_average\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 1.663127034870564,\n \"min\": 0.0,\n \"max\": 10.0,\n \"num_unique_values\": 3037,\n \"samples\": [\n 6.421\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"vote_count\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 2084,\n \"min\": 0,\n \"max\": 35776,\n \"num_unique_values\": 2630,\n \"samples\": [\n 841\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"genre\",\n \"properties\": {\n \"dtype\": \"category\",\n \"num_unique_values\": 4,\n \"samples\": [\n \"Romance\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}"
+ }
+ },
+ "metadata": {},
+ "execution_count": 32
+ }
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "#### Filter Rows\n",
+ "\n",
+ "We select out only English movies."
+ ],
+ "metadata": {
+ "id": "I3962J2Ym_Js"
+ }
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "movies = movies[movies['original_language']=='en']\n",
+ "movies.shape"
+ ],
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/"
+ },
+ "id": "2vMuf4OOtK5X",
+ "executionInfo": {
+ "status": "ok",
+ "timestamp": 1717136416216,
+ "user_tz": -480,
+ "elapsed": 340,
+ "user": {
+ "displayName": "Yunhui Liu",
+ "userId": "17327062528746877694"
+ }
+ },
+ "outputId": "05d66d7c-ac80-49aa-c8a3-3b9cd91e1eaa"
+ },
+ "execution_count": null,
+ "outputs": [
+ {
+ "output_type": "execute_result",
+ "data": {
+ "text/plain": [
+ "(10770, 15)"
+ ]
+ },
+ "metadata": {},
+ "execution_count": 33
+ }
+ ]
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "movies = movies[movies['original_title'] == movies['title']]\n",
+ "movies.shape"
+ ],
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/"
+ },
+ "id": "GVbdCqLHtgTY",
+ "executionInfo": {
+ "status": "ok",
+ "timestamp": 1717136417492,
+ "user_tz": -480,
+ "elapsed": 2,
+ "user": {
+ "displayName": "Yunhui Liu",
+ "userId": "17327062528746877694"
+ }
+ },
+ "outputId": "98d4d0f5-b2a7-4bb0-9290-6ec57285411e"
+ },
+ "execution_count": null,
+ "outputs": [
+ {
+ "output_type": "execute_result",
+ "data": {
+ "text/plain": [
+ "(10691, 15)"
+ ]
+ },
+ "metadata": {},
+ "execution_count": 34
+ }
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "#### Remove Columns\n"
+ ],
+ "metadata": {
+ "id": "oINbo6hkuT_U"
+ }
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "movies = movies[['id', 'title', 'overview', 'genre', 'release_date']]\n",
+ "movies.shape"
+ ],
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/"
+ },
+ "id": "mXbJYHrJuZkF",
+ "executionInfo": {
+ "status": "ok",
+ "timestamp": 1717136421184,
+ "user_tz": -480,
+ "elapsed": 343,
+ "user": {
+ "displayName": "Yunhui Liu",
+ "userId": "17327062528746877694"
+ }
+ },
+ "outputId": "3b34b578-a1fe-48fb-9633-f3cefa84f235"
+ },
+ "execution_count": null,
+ "outputs": [
+ {
+ "output_type": "execute_result",
+ "data": {
+ "text/plain": [
+ "(10691, 5)"
+ ]
+ },
+ "metadata": {},
+ "execution_count": 35
+ }
+ ]
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "movies = movies[movies['release_date'].notna()]\n",
+ "movies = movies[movies['overview'].notna()]\n",
+ "movies.to_csv('ARTA_en.csv',index=False)\n",
+ "movies.head(2)"
+ ],
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/",
+ "height": 112
+ },
+ "id": "V-YurcWCudFL",
+ "executionInfo": {
+ "status": "ok",
+ "timestamp": 1717136422977,
+ "user_tz": -480,
+ "elapsed": 495,
+ "user": {
+ "displayName": "Yunhui Liu",
+ "userId": "17327062528746877694"
+ }
+ },
+ "outputId": "54138598-d063-4b02-fce8-4266e96bd1bb"
+ },
+ "execution_count": null,
+ "outputs": [
+ {
+ "output_type": "execute_result",
+ "data": {
+ "text/plain": [
+ " id title \\\n",
+ "0 653346 Kingdom of the Planet of the Apes \n",
+ "1 929590 Civil War \n",
+ "\n",
+ " overview genre release_date \n",
+ "0 Several generations in the future following Ca... Action 2024-05-08 \n",
+ "1 In the near future, a group of war journalists... Action 2024-04-10 "
+ ],
+ "text/html": [
+ "\n",
+ " \n",
+ "
\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " id | \n",
+ " title | \n",
+ " overview | \n",
+ " genre | \n",
+ " release_date | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | 0 | \n",
+ " 653346 | \n",
+ " Kingdom of the Planet of the Apes | \n",
+ " Several generations in the future following Ca... | \n",
+ " Action | \n",
+ " 2024-05-08 | \n",
+ "
\n",
+ " \n",
+ " | 1 | \n",
+ " 929590 | \n",
+ " Civil War | \n",
+ " In the near future, a group of war journalists... | \n",
+ " Action | \n",
+ " 2024-04-10 | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
\n",
+ "
\n",
+ "
\n"
+ ],
+ "application/vnd.google.colaboratory.intrinsic+json": {
+ "type": "dataframe",
+ "variable_name": "movies",
+ "summary": "{\n \"name\": \"movies\",\n \"rows\": 10691,\n \"fields\": [\n {\n \"column\": \"id\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 318510,\n \"min\": 11,\n \"max\": 1293461,\n \"num_unique_values\": 10691,\n \"samples\": [\n 666277,\n 559969,\n 1017335\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"title\",\n \"properties\": {\n \"dtype\": \"string\",\n \"num_unique_values\": 10245,\n \"samples\": [\n \"The Quest\",\n \"Music Box\",\n \"Howard Lovecraft & the Frozen Kingdom\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"overview\",\n \"properties\": {\n \"dtype\": \"string\",\n \"num_unique_values\": 10650,\n \"samples\": [\n \"A young writer begins an affair with an older woman from France whose open marriage to a diplomat dictates that they can meet only between the hours of 5 p.m. to 7 p.m.\",\n \"A deranged prison warden with a nasty habit of killing escapees forces the boyfriends of his teenage twin daughters into a shotgun wedding, after they claim to be pregnant. All hope seems lost, until the husbands hatch a madcap plan to rob a money train to freedom.\",\n \"A fussy celebrity caterer, a blind woman, a tour-bus guide and an inexperienced wedding planner search for love.\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"genre\",\n \"properties\": {\n \"dtype\": \"category\",\n \"num_unique_values\": 4,\n \"samples\": [\n \"Romance\",\n \"Animation\",\n \"Action\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"release_date\",\n \"properties\": {\n \"dtype\": \"object\",\n \"num_unique_values\": 7322,\n \"samples\": [\n \"2018-05-13\",\n \"1980-05-09\",\n \"1988-04-01\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}"
+ }
+ },
+ "metadata": {},
+ "execution_count": 36
+ }
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "## Credits"
+ ],
+ "metadata": {
+ "id": "5Pnmn_g_5XE4"
+ }
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "### Data Collection"
+ ],
+ "metadata": {
+ "id": "yJn-yasFXtp6"
+ }
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "from time import sleep\n",
+ "import traceback\n",
+ "import logging"
+ ],
+ "metadata": {
+ "id": "Q9r3MTQEB6Gg"
+ },
+ "execution_count": null,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "%%time\n",
+ "# Creating an empty database with required columns\n",
+ "credits = pd.DataFrame(columns=['id','cast','crew'])\n",
+ "\n",
+ "counter_to_sleep=1\n",
+ "\n",
+ "# We are using try,catch block to catch exceptions if anything goes wrong.\n",
+ "try:\n",
+ " for i in movies.id.values:\n",
+ " url = f\"https://api.themoviedb.org/3/movie/{i}/credits?language=en-US&api_key={api_key}\"\n",
+ " response = requests.get(url)\n",
+ " new_row = response.json()\n",
+ " credits.loc[len(credits)] = new_row\n",
+ "\n",
+ " counter_to_sleep+=1\n",
+ "\n",
+ " # we ask thread to sleep after every 40 iterations\n",
+ " if counter_to_sleep%40==0: sleep(1)\n",
+ "\n",
+ "except Exception as e:\n",
+ " logging.error(traceback.format_exc())\n",
+ "\n",
+ "credits.head(2)"
+ ],
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/",
+ "height": 146
+ },
+ "id": "csYjvhEhCBcA",
+ "executionInfo": {
+ "status": "ok",
+ "timestamp": 1717138878764,
+ "user_tz": -480,
+ "elapsed": 2451065,
+ "user": {
+ "displayName": "Yunhui Liu",
+ "userId": "17327062528746877694"
+ }
+ },
+ "outputId": "e6a58970-5b6e-4cdc-e541-ee35fafe123e"
+ },
+ "execution_count": null,
+ "outputs": [
+ {
+ "output_type": "stream",
+ "name": "stdout",
+ "text": [
+ "CPU times: user 16min 40s, sys: 16.9 s, total: 16min 57s\n",
+ "Wall time: 40min 50s\n"
+ ]
+ },
+ {
+ "output_type": "execute_result",
+ "data": {
+ "text/plain": [
+ " id cast \\\n",
+ "0 653346 [{'adult': False, 'gender': 2, 'id': 1586047, ... \n",
+ "1 929590 [{'adult': False, 'gender': 1, 'id': 205, 'kno... \n",
+ "\n",
+ " crew \n",
+ "0 [{'adult': False, 'gender': 2, 'id': 1179066, ... \n",
+ "1 [{'adult': False, 'gender': 2, 'id': 2035, 'kn... "
+ ],
+ "text/html": [
+ "\n",
+ " \n",
+ "
\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " id | \n",
+ " cast | \n",
+ " crew | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | 0 | \n",
+ " 653346 | \n",
+ " [{'adult': False, 'gender': 2, 'id': 1586047, ... | \n",
+ " [{'adult': False, 'gender': 2, 'id': 1179066, ... | \n",
+ "
\n",
+ " \n",
+ " | 1 | \n",
+ " 929590 | \n",
+ " [{'adult': False, 'gender': 1, 'id': 205, 'kno... | \n",
+ " [{'adult': False, 'gender': 2, 'id': 2035, 'kn... | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
\n",
+ "
\n",
+ "
\n"
+ ],
+ "application/vnd.google.colaboratory.intrinsic+json": {
+ "type": "dataframe",
+ "summary": "{\n \"name\": \"get_ipython()\",\n \"rows\": 2,\n \"fields\": [\n {\n \"column\": \"id\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 195334,\n \"min\": 653346,\n \"max\": 929590,\n \"num_unique_values\": 2,\n \"samples\": [\n 929590,\n 653346\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"cast\",\n \"properties\": {\n \"dtype\": \"object\",\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"crew\",\n \"properties\": {\n \"dtype\": \"object\",\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}"
+ }
+ },
+ "metadata": {},
+ "execution_count": 38
+ }
+ ]
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "credits.to_csv('credits.csv', index=False)"
+ ],
+ "metadata": {
+ "id": "RtFNqhz5WLme",
+ "executionInfo": {
+ "status": "ok",
+ "timestamp": 1717165233755,
+ "user_tz": -480,
+ "elapsed": 7004,
+ "user": {
+ "displayName": "Yunhui Liu",
+ "userId": "17327062528746877694"
+ }
+ }
+ },
+ "execution_count": 19,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "### EDA & Processing\n",
+ "\n",
+ "Exploratory Data Analysis and Processing"
+ ],
+ "metadata": {
+ "id": "tRNPzec3XzvT"
+ }
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "credits = pd.read_csv('credits.csv')"
+ ],
+ "metadata": {
+ "id": "0zqklXGh-7Mu",
+ "executionInfo": {
+ "status": "ok",
+ "timestamp": 1717165277948,
+ "user_tz": -480,
+ "elapsed": 4159,
+ "user": {
+ "displayName": "Yunhui Liu",
+ "userId": "17327062528746877694"
+ }
+ }
+ },
+ "execution_count": 21,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "credits.shape"
+ ],
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/"
+ },
+ "id": "rE4TTXrb-7Pf",
+ "executionInfo": {
+ "status": "ok",
+ "timestamp": 1717165284346,
+ "user_tz": -480,
+ "elapsed": 3,
+ "user": {
+ "displayName": "Yunhui Liu",
+ "userId": "17327062528746877694"
+ }
+ },
+ "outputId": "dbaeab29-a81f-4c2f-a900-d5293c69856c"
+ },
+ "execution_count": 22,
+ "outputs": [
+ {
+ "output_type": "execute_result",
+ "data": {
+ "text/plain": [
+ "(10621, 3)"
+ ]
+ },
+ "metadata": {},
+ "execution_count": 22
+ }
+ ]
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "credits['cast'] = credits['cast'].apply(eval)\n",
+ "credits['crew'] = credits['crew'].apply(eval)\n",
+ "credits.head(2)"
+ ],
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/",
+ "height": 112
+ },
+ "id": "HfBiwoi4Wv58",
+ "executionInfo": {
+ "status": "ok",
+ "timestamp": 1717165327725,
+ "user_tz": -480,
+ "elapsed": 31474,
+ "user": {
+ "displayName": "Yunhui Liu",
+ "userId": "17327062528746877694"
+ }
+ },
+ "outputId": "9fbd4b08-19e5-423a-e3cd-8137dcba35e5"
+ },
+ "execution_count": 24,
+ "outputs": [
+ {
+ "output_type": "execute_result",
+ "data": {
+ "text/plain": [
+ " id cast \\\n",
+ "0 653346 [{'adult': False, 'gender': 2, 'id': 1586047, ... \n",
+ "1 929590 [{'adult': False, 'gender': 1, 'id': 205, 'kno... \n",
+ "\n",
+ " crew \n",
+ "0 [{'adult': False, 'gender': 2, 'id': 1179066, ... \n",
+ "1 [{'adult': False, 'gender': 2, 'id': 2035, 'kn... "
+ ],
+ "text/html": [
+ "\n",
+ " \n",
+ "
\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " id | \n",
+ " cast | \n",
+ " crew | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | 0 | \n",
+ " 653346 | \n",
+ " [{'adult': False, 'gender': 2, 'id': 1586047, ... | \n",
+ " [{'adult': False, 'gender': 2, 'id': 1179066, ... | \n",
+ "
\n",
+ " \n",
+ " | 1 | \n",
+ " 929590 | \n",
+ " [{'adult': False, 'gender': 1, 'id': 205, 'kno... | \n",
+ " [{'adult': False, 'gender': 2, 'id': 2035, 'kn... | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
\n",
+ "
\n",
+ "
\n"
+ ],
+ "application/vnd.google.colaboratory.intrinsic+json": {
+ "type": "dataframe",
+ "variable_name": "credits",
+ "summary": "{\n \"name\": \"credits\",\n \"rows\": 10621,\n \"fields\": [\n {\n \"column\": \"id\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 315046,\n \"min\": 11,\n \"max\": 1293461,\n \"num_unique_values\": 10621,\n \"samples\": [\n 407445,\n 54179,\n 238713\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"cast\",\n \"properties\": {\n \"dtype\": \"object\",\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"crew\",\n \"properties\": {\n \"dtype\": \"object\",\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}"
+ }
+ },
+ "metadata": {},
+ "execution_count": 24
+ }
+ ]
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "credits['cast_len'] = credits['cast'].apply(len)\n",
+ "credits['crew_len'] = credits['crew'].apply(len)"
+ ],
+ "metadata": {
+ "id": "Wm4Rr-DifyMm",
+ "executionInfo": {
+ "status": "ok",
+ "timestamp": 1717165331397,
+ "user_tz": -480,
+ "elapsed": 307,
+ "user": {
+ "displayName": "Yunhui Liu",
+ "userId": "17327062528746877694"
+ }
+ }
+ },
+ "execution_count": 25,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "#### Drop movies without casts or crews"
+ ],
+ "metadata": {
+ "id": "ZwC8HHIspkfz"
+ }
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "credits = credits[(credits['cast_len']!=0) & (credits['crew_len']!=0)]\n",
+ "credits.shape"
+ ],
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/"
+ },
+ "id": "Zcq3oJlwpt5F",
+ "executionInfo": {
+ "status": "ok",
+ "timestamp": 1717165333460,
+ "user_tz": -480,
+ "elapsed": 301,
+ "user": {
+ "displayName": "Yunhui Liu",
+ "userId": "17327062528746877694"
+ }
+ },
+ "outputId": "a071a7cf-f163-47a9-9df4-b08a3314df9b"
+ },
+ "execution_count": 26,
+ "outputs": [
+ {
+ "output_type": "execute_result",
+ "data": {
+ "text/plain": [
+ "(10309, 5)"
+ ]
+ },
+ "metadata": {},
+ "execution_count": 26
+ }
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "#### Crew Statistics\n",
+ "\n",
+ "Get the list of the departments used on TMDB."
+ ],
+ "metadata": {
+ "id": "aw4PSGFpaoWy"
+ }
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "response = requests.get(f'https://api.themoviedb.org/3/configuration/jobs?api_key={api_key}')\n",
+ "departments = [e['department'] for e in response.json()]\n",
+ "departments"
+ ],
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/"
+ },
+ "id": "rTZTb0J2aozC",
+ "executionInfo": {
+ "status": "ok",
+ "timestamp": 1717165361353,
+ "user_tz": -480,
+ "elapsed": 348,
+ "user": {
+ "displayName": "Yunhui Liu",
+ "userId": "17327062528746877694"
+ }
+ },
+ "outputId": "839f1bde-baa2-4b00-a3bb-2bbd2d5e9c16"
+ },
+ "execution_count": 30,
+ "outputs": [
+ {
+ "output_type": "execute_result",
+ "data": {
+ "text/plain": [
+ "['Crew',\n",
+ " 'Lighting',\n",
+ " 'Camera',\n",
+ " 'Visual Effects',\n",
+ " 'Writing',\n",
+ " 'Sound',\n",
+ " 'Production',\n",
+ " 'Costume & Make-Up',\n",
+ " 'Actors',\n",
+ " 'Directing',\n",
+ " 'Art',\n",
+ " 'Editing']"
+ ]
+ },
+ "metadata": {},
+ "execution_count": 30
+ }
+ ]
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "def crew_statistics(crews):\n",
+ " statistic = dict.fromkeys(departments, 0)\n",
+ " for crew in crews:\n",
+ " statistic[crew['department']] +=1\n",
+ " return statistic"
+ ],
+ "metadata": {
+ "id": "kxTGnseXc5Zt",
+ "executionInfo": {
+ "status": "ok",
+ "timestamp": 1717165363135,
+ "user_tz": -480,
+ "elapsed": 352,
+ "user": {
+ "displayName": "Yunhui Liu",
+ "userId": "17327062528746877694"
+ }
+ }
+ },
+ "execution_count": 31,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "credits[departments] = credits['crew'].apply(crew_statistics).apply(pd.Series)\n",
+ "credits.head(2)"
+ ],
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/",
+ "height": 199
+ },
+ "id": "vYEUuz5AfZUD",
+ "executionInfo": {
+ "status": "ok",
+ "timestamp": 1717165368260,
+ "user_tz": -480,
+ "elapsed": 3873,
+ "user": {
+ "displayName": "Yunhui Liu",
+ "userId": "17327062528746877694"
+ }
+ },
+ "outputId": "d0f33c3e-9686-4ff5-810a-40f32f355ef3"
+ },
+ "execution_count": 32,
+ "outputs": [
+ {
+ "output_type": "execute_result",
+ "data": {
+ "text/plain": [
+ " id cast \\\n",
+ "0 653346 [{'adult': False, 'gender': 2, 'id': 1586047, ... \n",
+ "1 929590 [{'adult': False, 'gender': 1, 'id': 205, 'kno... \n",
+ "\n",
+ " crew cast_len crew_len \\\n",
+ "0 [{'adult': False, 'gender': 2, 'id': 1179066, ... 29 26 \n",
+ "1 [{'adult': False, 'gender': 2, 'id': 2035, 'kn... 30 209 \n",
+ "\n",
+ " Crew Lighting Camera Visual Effects Writing Sound Production \\\n",
+ "0 1 0 1 3 3 1 10 \n",
+ "1 41 17 22 9 1 22 37 \n",
+ "\n",
+ " Costume & Make-Up Actors Directing Art Editing \n",
+ "0 1 0 3 1 2 \n",
+ "1 21 0 6 22 11 "
+ ],
+ "text/html": [
+ "\n",
+ " \n",
+ "
\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " id | \n",
+ " cast | \n",
+ " crew | \n",
+ " cast_len | \n",
+ " crew_len | \n",
+ " Crew | \n",
+ " Lighting | \n",
+ " Camera | \n",
+ " Visual Effects | \n",
+ " Writing | \n",
+ " Sound | \n",
+ " Production | \n",
+ " Costume & Make-Up | \n",
+ " Actors | \n",
+ " Directing | \n",
+ " Art | \n",
+ " Editing | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | 0 | \n",
+ " 653346 | \n",
+ " [{'adult': False, 'gender': 2, 'id': 1586047, ... | \n",
+ " [{'adult': False, 'gender': 2, 'id': 1179066, ... | \n",
+ " 29 | \n",
+ " 26 | \n",
+ " 1 | \n",
+ " 0 | \n",
+ " 1 | \n",
+ " 3 | \n",
+ " 3 | \n",
+ " 1 | \n",
+ " 10 | \n",
+ " 1 | \n",
+ " 0 | \n",
+ " 3 | \n",
+ " 1 | \n",
+ " 2 | \n",
+ "
\n",
+ " \n",
+ " | 1 | \n",
+ " 929590 | \n",
+ " [{'adult': False, 'gender': 1, 'id': 205, 'kno... | \n",
+ " [{'adult': False, 'gender': 2, 'id': 2035, 'kn... | \n",
+ " 30 | \n",
+ " 209 | \n",
+ " 41 | \n",
+ " 17 | \n",
+ " 22 | \n",
+ " 9 | \n",
+ " 1 | \n",
+ " 22 | \n",
+ " 37 | \n",
+ " 21 | \n",
+ " 0 | \n",
+ " 6 | \n",
+ " 22 | \n",
+ " 11 | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
\n",
+ "
\n",
+ "
\n"
+ ],
+ "application/vnd.google.colaboratory.intrinsic+json": {
+ "type": "dataframe",
+ "variable_name": "credits",
+ "summary": "{\n \"name\": \"credits\",\n \"rows\": 10309,\n \"fields\": [\n {\n \"column\": \"id\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 311347,\n \"min\": 11,\n \"max\": 1292801,\n \"num_unique_values\": 10309,\n \"samples\": [\n 57233,\n 242606,\n 365177\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"cast\",\n \"properties\": {\n \"dtype\": \"object\",\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"crew\",\n \"properties\": {\n \"dtype\": \"object\",\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"cast_len\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 22,\n \"min\": 1,\n \"max\": 451,\n \"num_unique_values\": 158,\n \"samples\": [\n 3,\n 39,\n 194\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"crew_len\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 62,\n \"min\": 1,\n \"max\": 980,\n \"num_unique_values\": 367,\n \"samples\": [\n 13,\n 510,\n 601\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Crew\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 16,\n \"min\": 0,\n \"max\": 288,\n \"num_unique_values\": 143,\n \"samples\": [\n 185,\n 75,\n 32\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Lighting\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 3,\n \"min\": 0,\n \"max\": 99,\n \"num_unique_values\": 49,\n \"samples\": [\n 15,\n 20,\n 99\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Camera\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 5,\n \"min\": 0,\n \"max\": 75,\n \"num_unique_values\": 58,\n \"samples\": [\n 1,\n 10,\n 0\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Visual Effects\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 13,\n \"min\": 0,\n \"max\": 355,\n \"num_unique_values\": 130,\n \"samples\": [\n 203,\n 18,\n 26\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Writing\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 2,\n \"min\": 0,\n \"max\": 31,\n \"num_unique_values\": 29,\n \"samples\": [\n 27,\n 29,\n 9\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Sound\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 8,\n \"min\": 0,\n \"max\": 94,\n \"num_unique_values\": 62,\n \"samples\": [\n 49,\n 54,\n 1\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Production\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 9,\n \"min\": 0,\n \"max\": 117,\n \"num_unique_values\": 72,\n \"samples\": [\n 9,\n 117,\n 31\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Costume & Make-Up\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 6,\n \"min\": 0,\n \"max\": 161,\n \"num_unique_values\": 70,\n \"samples\": [\n 50,\n 1,\n 105\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Actors\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 0,\n \"min\": 0,\n \"max\": 0,\n \"num_unique_values\": 1,\n \"samples\": [\n 0\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Directing\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 2,\n \"min\": 0,\n \"max\": 47,\n \"num_unique_values\": 35,\n \"samples\": [\n 34\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Art\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 7,\n \"min\": 0,\n \"max\": 110,\n \"num_unique_values\": 81,\n \"samples\": [\n 4\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Editing\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 2,\n \"min\": 0,\n \"max\": 31,\n \"num_unique_values\": 24,\n \"samples\": [\n 20\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}"
+ }
+ },
+ "metadata": {},
+ "execution_count": 32
+ }
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "#### Person-level Frequency"
+ ],
+ "metadata": {
+ "id": "wHlKexpG-kAe"
+ }
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "from collections import Counter"
+ ],
+ "metadata": {
+ "id": "At4FfgcPzbxW",
+ "executionInfo": {
+ "status": "ok",
+ "timestamp": 1717165372715,
+ "user_tz": -480,
+ "elapsed": 350,
+ "user": {
+ "displayName": "Yunhui Liu",
+ "userId": "17327062528746877694"
+ }
+ }
+ },
+ "execution_count": 33,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "person_department_map = {}"
+ ],
+ "metadata": {
+ "id": "wY5A0CGDienO",
+ "executionInfo": {
+ "status": "ok",
+ "timestamp": 1717165373809,
+ "user_tz": -480,
+ "elapsed": 648,
+ "user": {
+ "displayName": "Yunhui Liu",
+ "userId": "17327062528746877694"
+ }
+ }
+ },
+ "execution_count": 34,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "cast_frequency = []\n",
+ "for casts in credits['cast']:\n",
+ " counted_ids = set()\n",
+ " for cast in casts:\n",
+ " id = cast['id']\n",
+ " department = cast['known_for_department']\n",
+ " if department=='Acting' and id not in counted_ids:\n",
+ " counted_ids.add(id)\n",
+ " cast_frequency.append(id)\n",
+ " person_department_map[id]='Acting'\n",
+ "\n",
+ "\n",
+ "cast_frequency = pd.Series(Counter(cast_frequency))\n",
+ "print('Number of Cast', cast_frequency.shape[0])\n",
+ "print('Cast whose frequency is 1|2|3|4|5:')\n",
+ "cast_frequency.value_counts().head()"
+ ],
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/"
+ },
+ "id": "4P-XFSYp-pEP",
+ "executionInfo": {
+ "status": "ok",
+ "timestamp": 1717165375845,
+ "user_tz": -480,
+ "elapsed": 435,
+ "user": {
+ "displayName": "Yunhui Liu",
+ "userId": "17327062528746877694"
+ }
+ },
+ "outputId": "2f0d5c97-0029-4c28-f3fb-b906ae91170d"
+ },
+ "execution_count": 35,
+ "outputs": [
+ {
+ "output_type": "stream",
+ "name": "stdout",
+ "text": [
+ "Number of Cast 121642\n",
+ "Cast whose frequency is 1|2|3|4|5:\n"
+ ]
+ },
+ {
+ "output_type": "execute_result",
+ "data": {
+ "text/plain": [
+ "1 84520\n",
+ "2 16935\n",
+ "3 7146\n",
+ "4 3786\n",
+ "5 2413\n",
+ "Name: count, dtype: int64"
+ ]
+ },
+ "metadata": {},
+ "execution_count": 35
+ }
+ ]
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "sound_frequency = []\n",
+ "directing_frequency = []\n",
+ "editing_frequency = []\n",
+ "writing_frequency = []\n",
+ "production_frequency = []\n",
+ "\n",
+ "\n",
+ "for crews in credits['crew']:\n",
+ " counted_ids = set()\n",
+ " for crew in crews:\n",
+ " id = crew['id']\n",
+ " department = crew['known_for_department']\n",
+ " if department == crew['department'] and (id not in counted_ids):\n",
+ " counted_ids.add(id)\n",
+ " if department == 'Sound':\n",
+ " sound_frequency.append(id)\n",
+ " person_department_map[id]=department\n",
+ " elif department == 'Directing':\n",
+ " directing_frequency.append(id)\n",
+ " person_department_map[id]=department\n",
+ " elif department == 'Editing':\n",
+ " editing_frequency.append(id)\n",
+ " person_department_map[id]=department\n",
+ " elif department == 'Writing':\n",
+ " writing_frequency.append(id)\n",
+ " person_department_map[id]=department\n",
+ " elif department == 'Production':\n",
+ " production_frequency.append(id)\n",
+ " person_department_map[id]=department\n",
+ "\n",
+ "sound_frequency = pd.Series(Counter(sound_frequency))\n",
+ "directing_frequency = pd.Series(Counter(directing_frequency))\n",
+ "editing_frequency = pd.Series(Counter(editing_frequency))\n",
+ "writing_frequency = pd.Series(Counter(writing_frequency))\n",
+ "production_frequency = pd.Series(Counter(production_frequency))"
+ ],
+ "metadata": {
+ "id": "so5vtp_1zcRH",
+ "executionInfo": {
+ "status": "ok",
+ "timestamp": 1717165378667,
+ "user_tz": -480,
+ "elapsed": 640,
+ "user": {
+ "displayName": "Yunhui Liu",
+ "userId": "17327062528746877694"
+ }
+ }
+ },
+ "execution_count": 36,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "print('Number of Sound', sound_frequency.shape[0])\n",
+ "print('Sound whose frequency is 1|2|3|4|5:')\n",
+ "sound_frequency.value_counts().head()"
+ ],
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/"
+ },
+ "id": "BVLJ3V3I1LId",
+ "executionInfo": {
+ "status": "ok",
+ "timestamp": 1717165380767,
+ "user_tz": -480,
+ "elapsed": 2,
+ "user": {
+ "displayName": "Yunhui Liu",
+ "userId": "17327062528746877694"
+ }
+ },
+ "outputId": "25f72dd7-96ec-4bcc-f168-d87ba6b7528e"
+ },
+ "execution_count": 37,
+ "outputs": [
+ {
+ "output_type": "stream",
+ "name": "stdout",
+ "text": [
+ "Number of Sound 15055\n",
+ "Sound whose frequency is 1|2|3|4|5:\n"
+ ]
+ },
+ {
+ "output_type": "execute_result",
+ "data": {
+ "text/plain": [
+ "1 7663\n",
+ "2 2220\n",
+ "3 1171\n",
+ "4 810\n",
+ "5 536\n",
+ "Name: count, dtype: int64"
+ ]
+ },
+ "metadata": {},
+ "execution_count": 37
+ }
+ ]
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "print('Number of Directing', directing_frequency.shape[0])\n",
+ "print('Directing whose frequency is 1|2|3|4|5:')\n",
+ "directing_frequency.value_counts().head()"
+ ],
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/"
+ },
+ "id": "SaEC4gzg1hAO",
+ "executionInfo": {
+ "status": "ok",
+ "timestamp": 1717165382514,
+ "user_tz": -480,
+ "elapsed": 548,
+ "user": {
+ "displayName": "Yunhui Liu",
+ "userId": "17327062528746877694"
+ }
+ },
+ "outputId": "9c06f3c7-b2ee-4bf7-ae11-90978447bbd7"
+ },
+ "execution_count": 38,
+ "outputs": [
+ {
+ "output_type": "stream",
+ "name": "stdout",
+ "text": [
+ "Number of Directing 9625\n",
+ "Directing whose frequency is 1|2|3|4|5:\n"
+ ]
+ },
+ {
+ "output_type": "execute_result",
+ "data": {
+ "text/plain": [
+ "1 5726\n",
+ "2 1619\n",
+ "3 787\n",
+ "4 469\n",
+ "5 322\n",
+ "Name: count, dtype: int64"
+ ]
+ },
+ "metadata": {},
+ "execution_count": 38
+ }
+ ]
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "print('Number of Editing', editing_frequency.shape[0])\n",
+ "print('Editing whose frequency is 1|2|3|4|5:')\n",
+ "editing_frequency.value_counts().head()"
+ ],
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/"
+ },
+ "id": "WQQY-RKQ1qAT",
+ "executionInfo": {
+ "status": "ok",
+ "timestamp": 1717165384063,
+ "user_tz": -480,
+ "elapsed": 3,
+ "user": {
+ "displayName": "Yunhui Liu",
+ "userId": "17327062528746877694"
+ }
+ },
+ "outputId": "66421164-0d2b-46ee-fe18-19f3b24136c1"
+ },
+ "execution_count": 39,
+ "outputs": [
+ {
+ "output_type": "stream",
+ "name": "stdout",
+ "text": [
+ "Number of Editing 6511\n",
+ "Editing whose frequency is 1|2|3|4|5:\n"
+ ]
+ },
+ {
+ "output_type": "execute_result",
+ "data": {
+ "text/plain": [
+ "1 3544\n",
+ "2 1089\n",
+ "3 535\n",
+ "4 380\n",
+ "5 237\n",
+ "Name: count, dtype: int64"
+ ]
+ },
+ "metadata": {},
+ "execution_count": 39
+ }
+ ]
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "print('Number of Writing', writing_frequency.shape[0])\n",
+ "print('Writing whose frequency is 1|2|3|4|5:')\n",
+ "writing_frequency.value_counts().head()"
+ ],
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/"
+ },
+ "id": "d2IUMuJF33__",
+ "executionInfo": {
+ "status": "ok",
+ "timestamp": 1717165386508,
+ "user_tz": -480,
+ "elapsed": 310,
+ "user": {
+ "displayName": "Yunhui Liu",
+ "userId": "17327062528746877694"
+ }
+ },
+ "outputId": "02fc76a3-7646-4c9f-89a1-9cac6220b0d7"
+ },
+ "execution_count": 40,
+ "outputs": [
+ {
+ "output_type": "stream",
+ "name": "stdout",
+ "text": [
+ "Number of Writing 8166\n",
+ "Writing whose frequency is 1|2|3|4|5:\n"
+ ]
+ },
+ {
+ "output_type": "execute_result",
+ "data": {
+ "text/plain": [
+ "1 5478\n",
+ "2 1213\n",
+ "3 593\n",
+ "4 301\n",
+ "5 206\n",
+ "Name: count, dtype: int64"
+ ]
+ },
+ "metadata": {},
+ "execution_count": 40
+ }
+ ]
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "print('Number of Production', production_frequency.shape[0])\n",
+ "print('Production whose frequency is 1|2|3|4|5:')\n",
+ "production_frequency.value_counts().head()"
+ ],
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/"
+ },
+ "id": "_06CcsU62LiA",
+ "executionInfo": {
+ "status": "ok",
+ "timestamp": 1717165388284,
+ "user_tz": -480,
+ "elapsed": 3,
+ "user": {
+ "displayName": "Yunhui Liu",
+ "userId": "17327062528746877694"
+ }
+ },
+ "outputId": "9529ca4a-cf6a-475c-b531-bbe63cf7daf4"
+ },
+ "execution_count": 41,
+ "outputs": [
+ {
+ "output_type": "stream",
+ "name": "stdout",
+ "text": [
+ "Number of Production 30085\n",
+ "Production whose frequency is 1|2|3|4|5:\n"
+ ]
+ },
+ {
+ "output_type": "execute_result",
+ "data": {
+ "text/plain": [
+ "1 19023\n",
+ "2 4487\n",
+ "3 2171\n",
+ "4 1257\n",
+ "5 777\n",
+ "Name: count, dtype: int64"
+ ]
+ },
+ "metadata": {},
+ "execution_count": 41
+ }
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "#### People Selection\n",
+ "\n",
+ "Choose people who have participated in at least 3 movies."
+ ],
+ "metadata": {
+ "id": "gxItSu5I_c4n"
+ }
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "min_freq = 3\n",
+ "\n",
+ "selected_cast_ids = cast_frequency[cast_frequency>=4].index\n",
+ "print('Cast', selected_cast_ids.shape[0])\n",
+ "\n",
+ "selected_sound_ids = sound_frequency[sound_frequency>=min_freq].index\n",
+ "print('Sound', selected_sound_ids.shape[0])\n",
+ "\n",
+ "selected_directing_ids = directing_frequency[directing_frequency>=2].index\n",
+ "print('Directing', selected_directing_ids.shape[0])\n",
+ "\n",
+ "selected_editing_ids = editing_frequency[editing_frequency>=min_freq].index\n",
+ "print('Editing', selected_editing_ids.shape[0])\n",
+ "\n",
+ "selected_writing_ids = writing_frequency[writing_frequency>=min_freq].index\n",
+ "print('Writing', selected_writing_ids.shape[0])\n",
+ "\n",
+ "selected_production_ids = production_frequency[production_frequency>=min_freq].index\n",
+ "print('Production', selected_production_ids.shape[0])"
+ ],
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/"
+ },
+ "id": "JksA5bk9ymaP",
+ "executionInfo": {
+ "status": "ok",
+ "timestamp": 1717165391344,
+ "user_tz": -480,
+ "elapsed": 312,
+ "user": {
+ "displayName": "Yunhui Liu",
+ "userId": "17327062528746877694"
+ }
+ },
+ "outputId": "dd486143-7167-4929-bb6f-66a71aa74641"
+ },
+ "execution_count": 42,
+ "outputs": [
+ {
+ "output_type": "stream",
+ "name": "stdout",
+ "text": [
+ "Cast 13041\n",
+ "Sound 5172\n",
+ "Directing 3899\n",
+ "Editing 1878\n",
+ "Writing 1475\n",
+ "Production 6575\n"
+ ]
+ }
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "#### People Details"
+ ],
+ "metadata": {
+ "id": "FAMRjjWJkZ3n"
+ }
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "def select_casts(casts):\n",
+ " return list({cast['id'] for cast in casts if cast['id'] in selected_cast_ids})\n",
+ "\n",
+ "def select_crews(crews):\n",
+ " sound_ids = set()\n",
+ " directing_ids = set()\n",
+ " editing_ids = set()\n",
+ " writing_ids = set()\n",
+ " production_ids = set()\n",
+ " for crew in crews:\n",
+ " department = crew['known_for_department']\n",
+ " id = crew['id']\n",
+ " if department == 'Directing':\n",
+ " if id in selected_directing_ids:\n",
+ " directing_ids.add(id)\n",
+ " # elif department == 'Sound':\n",
+ " # if id in selected_sound_ids:\n",
+ " # sound_ids.add(id)\n",
+ " # elif department == 'Editing':\n",
+ " # if id in selected_editing_ids:\n",
+ " # editing_ids.add(id)\n",
+ " # elif department == 'Writing':\n",
+ " # if id in selected_writing_ids:\n",
+ " # writing_ids.add(id)\n",
+ " # elif department == 'Production':\n",
+ " # if id in selected_production_ids:\n",
+ " # production_ids.add(id)\n",
+ " return {'sound_ids':list(sound_ids), 'directing_ids':list(directing_ids),\n",
+ " 'editing_ids':list(editing_ids),\n",
+ " 'writing_ids':list(writing_ids),\n",
+ " 'production_ids':list(production_ids)}"
+ ],
+ "metadata": {
+ "id": "KqFP4D52xnjN",
+ "executionInfo": {
+ "status": "ok",
+ "timestamp": 1717165393660,
+ "user_tz": -480,
+ "elapsed": 2,
+ "user": {
+ "displayName": "Yunhui Liu",
+ "userId": "17327062528746877694"
+ }
+ }
+ },
+ "execution_count": 43,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "selected_credits = credits['crew'].apply(select_crews).apply(pd.Series)\n",
+ "selected_credits['cast_ids'] = credits['cast'].apply(select_casts)\n",
+ "selected_credits.head(2)"
+ ],
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/",
+ "height": 112
+ },
+ "id": "wK_zWqdlDeib",
+ "executionInfo": {
+ "status": "ok",
+ "timestamp": 1717165401225,
+ "user_tz": -480,
+ "elapsed": 4246,
+ "user": {
+ "displayName": "Yunhui Liu",
+ "userId": "17327062528746877694"
+ }
+ },
+ "outputId": "19f93748-81b5-4203-b484-d151afd7954b"
+ },
+ "execution_count": 44,
+ "outputs": [
+ {
+ "output_type": "execute_result",
+ "data": {
+ "text/plain": [
+ " sound_ids directing_ids editing_ids writing_ids \\\n",
+ "0 [] [2045537, 86599] [] [] \n",
+ "1 [] [1560964, 1423005, 143894] [] [] \n",
+ "\n",
+ " production_ids cast_ids \n",
+ "0 [] [79072, 3905, 58395, 78962, 1394427, 1586047] \n",
+ "1 [] [1431398, 52583, 205, 1683343, 17039, 2135069,... "
+ ],
+ "text/html": [
+ "\n",
+ " \n",
+ "
\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " sound_ids | \n",
+ " directing_ids | \n",
+ " editing_ids | \n",
+ " writing_ids | \n",
+ " production_ids | \n",
+ " cast_ids | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | 0 | \n",
+ " [] | \n",
+ " [2045537, 86599] | \n",
+ " [] | \n",
+ " [] | \n",
+ " [] | \n",
+ " [79072, 3905, 58395, 78962, 1394427, 1586047] | \n",
+ "
\n",
+ " \n",
+ " | 1 | \n",
+ " [] | \n",
+ " [1560964, 1423005, 143894] | \n",
+ " [] | \n",
+ " [] | \n",
+ " [] | \n",
+ " [1431398, 52583, 205, 1683343, 17039, 2135069,... | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
\n",
+ "
\n",
+ "
\n"
+ ],
+ "application/vnd.google.colaboratory.intrinsic+json": {
+ "type": "dataframe",
+ "variable_name": "selected_credits",
+ "summary": "{\n \"name\": \"selected_credits\",\n \"rows\": 10309,\n \"fields\": [\n {\n \"column\": \"sound_ids\",\n \"properties\": {\n \"dtype\": \"object\",\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"directing_ids\",\n \"properties\": {\n \"dtype\": \"object\",\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"editing_ids\",\n \"properties\": {\n \"dtype\": \"object\",\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"writing_ids\",\n \"properties\": {\n \"dtype\": \"object\",\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"production_ids\",\n \"properties\": {\n \"dtype\": \"object\",\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"cast_ids\",\n \"properties\": {\n \"dtype\": \"object\",\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}"
+ }
+ },
+ "metadata": {},
+ "execution_count": 44
+ }
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "#### Drop movies without selected people"
+ ],
+ "metadata": {
+ "id": "i6hzntNoIAEH"
+ }
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "selected_credits_len = pd.DataFrame(columns=selected_credits.columns)\n",
+ "\n",
+ "for col in selected_credits.columns:\n",
+ " selected_credits_len[col] = selected_credits[col].apply(len)\n",
+ "\n",
+ "\n",
+ "selected_credits_len['crew_ids']=selected_credits_len.iloc[:,:-1].sum(axis=1)\n",
+ "selected_credits_len.head(2)"
+ ],
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/",
+ "height": 112
+ },
+ "id": "vfMYxfGHEtF_",
+ "executionInfo": {
+ "status": "ok",
+ "timestamp": 1717165404846,
+ "user_tz": -480,
+ "elapsed": 335,
+ "user": {
+ "displayName": "Yunhui Liu",
+ "userId": "17327062528746877694"
+ }
+ },
+ "outputId": "b760772a-3eb8-4cb2-fbec-080c0f86d25b"
+ },
+ "execution_count": 45,
+ "outputs": [
+ {
+ "output_type": "execute_result",
+ "data": {
+ "text/plain": [
+ " sound_ids directing_ids editing_ids writing_ids production_ids \\\n",
+ "0 0 2 0 0 0 \n",
+ "1 0 3 0 0 0 \n",
+ "\n",
+ " cast_ids crew_ids \n",
+ "0 6 2 \n",
+ "1 10 3 "
+ ],
+ "text/html": [
+ "\n",
+ " \n",
+ "
\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " sound_ids | \n",
+ " directing_ids | \n",
+ " editing_ids | \n",
+ " writing_ids | \n",
+ " production_ids | \n",
+ " cast_ids | \n",
+ " crew_ids | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | 0 | \n",
+ " 0 | \n",
+ " 2 | \n",
+ " 0 | \n",
+ " 0 | \n",
+ " 0 | \n",
+ " 6 | \n",
+ " 2 | \n",
+ "
\n",
+ " \n",
+ " | 1 | \n",
+ " 0 | \n",
+ " 3 | \n",
+ " 0 | \n",
+ " 0 | \n",
+ " 0 | \n",
+ " 10 | \n",
+ " 3 | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
\n",
+ "
\n",
+ "
\n"
+ ],
+ "application/vnd.google.colaboratory.intrinsic+json": {
+ "type": "dataframe",
+ "variable_name": "selected_credits_len",
+ "summary": "{\n \"name\": \"selected_credits_len\",\n \"rows\": 10309,\n \"fields\": [\n {\n \"column\": \"sound_ids\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 0,\n \"min\": 0,\n \"max\": 0,\n \"num_unique_values\": 1,\n \"samples\": [\n 0\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"directing_ids\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 2,\n \"min\": 0,\n \"max\": 28,\n \"num_unique_values\": 25,\n \"samples\": [\n 18\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"editing_ids\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 0,\n \"min\": 0,\n \"max\": 0,\n \"num_unique_values\": 1,\n \"samples\": [\n 0\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"writing_ids\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 0,\n \"min\": 0,\n \"max\": 0,\n \"num_unique_values\": 1,\n \"samples\": [\n 0\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"production_ids\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 0,\n \"min\": 0,\n \"max\": 0,\n \"num_unique_values\": 1,\n \"samples\": [\n 0\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"cast_ids\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 8,\n \"min\": 0,\n \"max\": 162,\n \"num_unique_values\": 70,\n \"samples\": [\n 13\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"crew_ids\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 2,\n \"min\": 0,\n \"max\": 28,\n \"num_unique_values\": 25,\n \"samples\": [\n 18\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}"
+ }
+ },
+ "metadata": {},
+ "execution_count": 45
+ }
+ ]
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "print('Original number', selected_credits_len.shape[0])\n",
+ "selected_credits_len = selected_credits_len[(selected_credits_len['cast_ids']!=0) & (selected_credits_len['crew_ids']!=0)]\n",
+ "selected_credits = selected_credits.loc[selected_credits_len.index]\n",
+ "print('Now number', selected_credits_len.shape[0])"
+ ],
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/"
+ },
+ "id": "7fV-4pG8GMk1",
+ "executionInfo": {
+ "status": "ok",
+ "timestamp": 1717165411290,
+ "user_tz": -480,
+ "elapsed": 331,
+ "user": {
+ "displayName": "Yunhui Liu",
+ "userId": "17327062528746877694"
+ }
+ },
+ "outputId": "1331b8d5-1443-4811-8d37-73ee676f6623"
+ },
+ "execution_count": 46,
+ "outputs": [
+ {
+ "output_type": "stream",
+ "name": "stdout",
+ "text": [
+ "Original number 10309\n",
+ "Now number 7505\n"
+ ]
+ }
+ ]
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "selected_credits"
+ ],
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/",
+ "height": 423
+ },
+ "id": "uShsfFl2nPVT",
+ "executionInfo": {
+ "status": "ok",
+ "timestamp": 1717165416995,
+ "user_tz": -480,
+ "elapsed": 311,
+ "user": {
+ "displayName": "Yunhui Liu",
+ "userId": "17327062528746877694"
+ }
+ },
+ "outputId": "8a878b0d-6db4-489e-f1c0-5f5981eeede2"
+ },
+ "execution_count": 47,
+ "outputs": [
+ {
+ "output_type": "execute_result",
+ "data": {
+ "text/plain": [
+ " sound_ids directing_ids editing_ids writing_ids \\\n",
+ "0 [] [2045537, 86599] [] [] \n",
+ "1 [] [1560964, 1423005, 143894] [] [] \n",
+ "2 [] [3034575, 1787802, 98631] [] [] \n",
+ "3 [] [1127472, 1746249, 40684, 2301527] [] [] \n",
+ "4 [] [132876] [] [] \n",
+ "... ... ... ... ... \n",
+ "10609 [] [89755] [] [] \n",
+ "10611 [] [1196347, 1431493] [] [] \n",
+ "10613 [] [124563] [] [] \n",
+ "10616 [] [132742] [] [] \n",
+ "10619 [] [2205321, 131242] [] [] \n",
+ "\n",
+ " production_ids cast_ids \n",
+ "0 [] [79072, 3905, 58395, 78962, 1394427, 1586047] \n",
+ "1 [] [1431398, 52583, 205, 1683343, 17039, 2135069,... \n",
+ "2 [] [60416, 930817, 15298, 15556, 61782, 221018, 2... \n",
+ "3 [] [1381186, 27428, 1278487, 117642, 150030, 2037... \n",
+ "4 [] [1225953, 16866, 2983, 61831, 168140, 1489211] \n",
+ "... ... ... \n",
+ "10609 [] [58530, 89756, 89757, 1004823] \n",
+ "10611 [] [155397, 1099685, 105799, 2204522, 79051, 9729... \n",
+ "10613 [] [6860, 84214] \n",
+ "10616 [] [109969, 33923] \n",
+ "10619 [] [37986, 1243017, 75821, 74359, 52283, 74364, 1... \n",
+ "\n",
+ "[7505 rows x 6 columns]"
+ ],
+ "text/html": [
+ "\n",
+ " \n",
+ "
\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " sound_ids | \n",
+ " directing_ids | \n",
+ " editing_ids | \n",
+ " writing_ids | \n",
+ " production_ids | \n",
+ " cast_ids | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | 0 | \n",
+ " [] | \n",
+ " [2045537, 86599] | \n",
+ " [] | \n",
+ " [] | \n",
+ " [] | \n",
+ " [79072, 3905, 58395, 78962, 1394427, 1586047] | \n",
+ "
\n",
+ " \n",
+ " | 1 | \n",
+ " [] | \n",
+ " [1560964, 1423005, 143894] | \n",
+ " [] | \n",
+ " [] | \n",
+ " [] | \n",
+ " [1431398, 52583, 205, 1683343, 17039, 2135069,... | \n",
+ "
\n",
+ " \n",
+ " | 2 | \n",
+ " [] | \n",
+ " [3034575, 1787802, 98631] | \n",
+ " [] | \n",
+ " [] | \n",
+ " [] | \n",
+ " [60416, 930817, 15298, 15556, 61782, 221018, 2... | \n",
+ "
\n",
+ " \n",
+ " | 3 | \n",
+ " [] | \n",
+ " [1127472, 1746249, 40684, 2301527] | \n",
+ " [] | \n",
+ " [] | \n",
+ " [] | \n",
+ " [1381186, 27428, 1278487, 117642, 150030, 2037... | \n",
+ "
\n",
+ " \n",
+ " | 4 | \n",
+ " [] | \n",
+ " [132876] | \n",
+ " [] | \n",
+ " [] | \n",
+ " [] | \n",
+ " [1225953, 16866, 2983, 61831, 168140, 1489211] | \n",
+ "
\n",
+ " \n",
+ " | ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ "
\n",
+ " \n",
+ " | 10609 | \n",
+ " [] | \n",
+ " [89755] | \n",
+ " [] | \n",
+ " [] | \n",
+ " [] | \n",
+ " [58530, 89756, 89757, 1004823] | \n",
+ "
\n",
+ " \n",
+ " | 10611 | \n",
+ " [] | \n",
+ " [1196347, 1431493] | \n",
+ " [] | \n",
+ " [] | \n",
+ " [] | \n",
+ " [155397, 1099685, 105799, 2204522, 79051, 9729... | \n",
+ "
\n",
+ " \n",
+ " | 10613 | \n",
+ " [] | \n",
+ " [124563] | \n",
+ " [] | \n",
+ " [] | \n",
+ " [] | \n",
+ " [6860, 84214] | \n",
+ "
\n",
+ " \n",
+ " | 10616 | \n",
+ " [] | \n",
+ " [132742] | \n",
+ " [] | \n",
+ " [] | \n",
+ " [] | \n",
+ " [109969, 33923] | \n",
+ "
\n",
+ " \n",
+ " | 10619 | \n",
+ " [] | \n",
+ " [2205321, 131242] | \n",
+ " [] | \n",
+ " [] | \n",
+ " [] | \n",
+ " [37986, 1243017, 75821, 74359, 52283, 74364, 1... | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
7505 rows × 6 columns
\n",
+ "
\n",
+ "
\n",
+ "
\n"
+ ],
+ "application/vnd.google.colaboratory.intrinsic+json": {
+ "type": "dataframe",
+ "variable_name": "selected_credits",
+ "summary": "{\n \"name\": \"selected_credits\",\n \"rows\": 7505,\n \"fields\": [\n {\n \"column\": \"sound_ids\",\n \"properties\": {\n \"dtype\": \"object\",\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"directing_ids\",\n \"properties\": {\n \"dtype\": \"object\",\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"editing_ids\",\n \"properties\": {\n \"dtype\": \"object\",\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"writing_ids\",\n \"properties\": {\n \"dtype\": \"object\",\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"production_ids\",\n \"properties\": {\n \"dtype\": \"object\",\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"cast_ids\",\n \"properties\": {\n \"dtype\": \"object\",\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}"
+ }
+ },
+ "metadata": {},
+ "execution_count": 47
+ }
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "#### Save People&Movies"
+ ],
+ "metadata": {
+ "id": "LnCD-3Wl311S"
+ }
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "movies = pd.read_csv('ARTA_en.csv')"
+ ],
+ "metadata": {
+ "id": "tE_zNrDVoDUN",
+ "executionInfo": {
+ "status": "ok",
+ "timestamp": 1717165423446,
+ "user_tz": -480,
+ "elapsed": 294,
+ "user": {
+ "displayName": "Yunhui Liu",
+ "userId": "17327062528746877694"
+ }
+ }
+ },
+ "execution_count": 48,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "movies = movies.iloc[selected_credits.index]\n",
+ "movies.head()"
+ ],
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/",
+ "height": 206
+ },
+ "id": "G8j7KDeuj2G7",
+ "executionInfo": {
+ "status": "ok",
+ "timestamp": 1717165426596,
+ "user_tz": -480,
+ "elapsed": 6,
+ "user": {
+ "displayName": "Yunhui Liu",
+ "userId": "17327062528746877694"
+ }
+ },
+ "outputId": "82a373ef-4d04-497d-8af0-4af07827fe70"
+ },
+ "execution_count": 49,
+ "outputs": [
+ {
+ "output_type": "execute_result",
+ "data": {
+ "text/plain": [
+ " id title \\\n",
+ "0 653346 Kingdom of the Planet of the Apes \n",
+ "1 929590 Civil War \n",
+ "2 823464 Godzilla x Kong: The New Empire \n",
+ "3 746036 The Fall Guy \n",
+ "4 614933 Atlas \n",
+ "\n",
+ " overview genre release_date \n",
+ "0 Several generations in the future following Ca... Action 2024-05-08 \n",
+ "1 In the near future, a group of war journalists... Action 2024-04-10 \n",
+ "2 Following their explosive showdown, Godzilla a... Action 2024-03-27 \n",
+ "3 Fresh off an almost career-ending accident, st... Action 2024-04-24 \n",
+ "4 A brilliant counterterrorism analyst with a de... Action 2024-05-23 "
+ ],
+ "text/html": [
+ "\n",
+ " \n",
+ "
\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " id | \n",
+ " title | \n",
+ " overview | \n",
+ " genre | \n",
+ " release_date | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | 0 | \n",
+ " 653346 | \n",
+ " Kingdom of the Planet of the Apes | \n",
+ " Several generations in the future following Ca... | \n",
+ " Action | \n",
+ " 2024-05-08 | \n",
+ "
\n",
+ " \n",
+ " | 1 | \n",
+ " 929590 | \n",
+ " Civil War | \n",
+ " In the near future, a group of war journalists... | \n",
+ " Action | \n",
+ " 2024-04-10 | \n",
+ "
\n",
+ " \n",
+ " | 2 | \n",
+ " 823464 | \n",
+ " Godzilla x Kong: The New Empire | \n",
+ " Following their explosive showdown, Godzilla a... | \n",
+ " Action | \n",
+ " 2024-03-27 | \n",
+ "
\n",
+ " \n",
+ " | 3 | \n",
+ " 746036 | \n",
+ " The Fall Guy | \n",
+ " Fresh off an almost career-ending accident, st... | \n",
+ " Action | \n",
+ " 2024-04-24 | \n",
+ "
\n",
+ " \n",
+ " | 4 | \n",
+ " 614933 | \n",
+ " Atlas | \n",
+ " A brilliant counterterrorism analyst with a de... | \n",
+ " Action | \n",
+ " 2024-05-23 | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
\n",
+ "
\n",
+ "
\n"
+ ],
+ "application/vnd.google.colaboratory.intrinsic+json": {
+ "type": "dataframe",
+ "variable_name": "movies",
+ "summary": "{\n \"name\": \"movies\",\n \"rows\": 7505,\n \"fields\": [\n {\n \"column\": \"id\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 274531,\n \"min\": 11,\n \"max\": 1288104,\n \"num_unique_values\": 7505,\n \"samples\": [\n 982752,\n 290714,\n 1052\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"title\",\n \"properties\": {\n \"dtype\": \"string\",\n \"num_unique_values\": 7270,\n \"samples\": [\n \"The Purge: Anarchy\",\n \"Inside Out 2\",\n \"Signs\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"overview\",\n \"properties\": {\n \"dtype\": \"string\",\n \"num_unique_values\": 7500,\n \"samples\": [\n \"The Civil War has ended, but Colonel Morsman Carver is on one final mission \\u2013 to kill Gideon, no matter what it takes. Launched by a gunshot and propelled by rage, the relentless pursuit takes the two men through frigid snow-capped mountains and arid deserts, far from the comforts and codes of civilisation, into the bloodiest recesses of their own souls.\",\n \"Peter makes good on another power outage at home by retelling Star Wars Episode V: The Empire Strikes Back.\",\n \"Nine years later, Jesse travels across Europe giving readings from a book he wrote about the night he spent in Vienna with Celine. After his reading in Paris, Celine finds him, and they spend part of the day together before Jesse has to again leave for a flight. They are both in relationships now, and Jesse has a son, but as their strong feelings for each other start to return, both confess a longing for more.\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"genre\",\n \"properties\": {\n \"dtype\": \"category\",\n \"num_unique_values\": 4,\n \"samples\": [\n \"Romance\",\n \"Animation\",\n \"Action\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"release_date\",\n \"properties\": {\n \"dtype\": \"object\",\n \"num_unique_values\": 5777,\n \"samples\": [\n \"1950-08-05\",\n \"1959-03-19\",\n \"2019-08-05\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}"
+ }
+ },
+ "metadata": {},
+ "execution_count": 49
+ }
+ ]
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "movies['actor'] = selected_credits['cast_ids']\n",
+ "movies['director'] = selected_credits['directing_ids']\n",
+ "movies.head()"
+ ],
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/",
+ "height": 293
+ },
+ "id": "okTs7HPjkPJN",
+ "executionInfo": {
+ "status": "ok",
+ "timestamp": 1717165431909,
+ "user_tz": -480,
+ "elapsed": 314,
+ "user": {
+ "displayName": "Yunhui Liu",
+ "userId": "17327062528746877694"
+ }
+ },
+ "outputId": "5b767864-c20d-40ae-b1ea-f1489323b050"
+ },
+ "execution_count": 50,
+ "outputs": [
+ {
+ "output_type": "execute_result",
+ "data": {
+ "text/plain": [
+ " id title \\\n",
+ "0 653346 Kingdom of the Planet of the Apes \n",
+ "1 929590 Civil War \n",
+ "2 823464 Godzilla x Kong: The New Empire \n",
+ "3 746036 The Fall Guy \n",
+ "4 614933 Atlas \n",
+ "\n",
+ " overview genre release_date \\\n",
+ "0 Several generations in the future following Ca... Action 2024-05-08 \n",
+ "1 In the near future, a group of war journalists... Action 2024-04-10 \n",
+ "2 Following their explosive showdown, Godzilla a... Action 2024-03-27 \n",
+ "3 Fresh off an almost career-ending accident, st... Action 2024-04-24 \n",
+ "4 A brilliant counterterrorism analyst with a de... Action 2024-05-23 \n",
+ "\n",
+ " actor \\\n",
+ "0 [79072, 3905, 58395, 78962, 1394427, 1586047] \n",
+ "1 [1431398, 52583, 205, 1683343, 17039, 2135069,... \n",
+ "2 [60416, 930817, 15298, 15556, 61782, 221018, 2... \n",
+ "3 [1381186, 27428, 1278487, 117642, 150030, 2037... \n",
+ "4 [1225953, 16866, 2983, 61831, 168140, 1489211] \n",
+ "\n",
+ " director \n",
+ "0 [2045537, 86599] \n",
+ "1 [1560964, 1423005, 143894] \n",
+ "2 [3034575, 1787802, 98631] \n",
+ "3 [1127472, 1746249, 40684, 2301527] \n",
+ "4 [132876] "
+ ],
+ "text/html": [
+ "\n",
+ " \n",
+ "
\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " id | \n",
+ " title | \n",
+ " overview | \n",
+ " genre | \n",
+ " release_date | \n",
+ " actor | \n",
+ " director | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | 0 | \n",
+ " 653346 | \n",
+ " Kingdom of the Planet of the Apes | \n",
+ " Several generations in the future following Ca... | \n",
+ " Action | \n",
+ " 2024-05-08 | \n",
+ " [79072, 3905, 58395, 78962, 1394427, 1586047] | \n",
+ " [2045537, 86599] | \n",
+ "
\n",
+ " \n",
+ " | 1 | \n",
+ " 929590 | \n",
+ " Civil War | \n",
+ " In the near future, a group of war journalists... | \n",
+ " Action | \n",
+ " 2024-04-10 | \n",
+ " [1431398, 52583, 205, 1683343, 17039, 2135069,... | \n",
+ " [1560964, 1423005, 143894] | \n",
+ "
\n",
+ " \n",
+ " | 2 | \n",
+ " 823464 | \n",
+ " Godzilla x Kong: The New Empire | \n",
+ " Following their explosive showdown, Godzilla a... | \n",
+ " Action | \n",
+ " 2024-03-27 | \n",
+ " [60416, 930817, 15298, 15556, 61782, 221018, 2... | \n",
+ " [3034575, 1787802, 98631] | \n",
+ "
\n",
+ " \n",
+ " | 3 | \n",
+ " 746036 | \n",
+ " The Fall Guy | \n",
+ " Fresh off an almost career-ending accident, st... | \n",
+ " Action | \n",
+ " 2024-04-24 | \n",
+ " [1381186, 27428, 1278487, 117642, 150030, 2037... | \n",
+ " [1127472, 1746249, 40684, 2301527] | \n",
+ "
\n",
+ " \n",
+ " | 4 | \n",
+ " 614933 | \n",
+ " Atlas | \n",
+ " A brilliant counterterrorism analyst with a de... | \n",
+ " Action | \n",
+ " 2024-05-23 | \n",
+ " [1225953, 16866, 2983, 61831, 168140, 1489211] | \n",
+ " [132876] | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
\n",
+ "
\n",
+ "
\n"
+ ],
+ "application/vnd.google.colaboratory.intrinsic+json": {
+ "type": "dataframe",
+ "variable_name": "movies",
+ "summary": "{\n \"name\": \"movies\",\n \"rows\": 7505,\n \"fields\": [\n {\n \"column\": \"id\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 274531,\n \"min\": 11,\n \"max\": 1288104,\n \"num_unique_values\": 7505,\n \"samples\": [\n 982752,\n 290714,\n 1052\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"title\",\n \"properties\": {\n \"dtype\": \"string\",\n \"num_unique_values\": 7270,\n \"samples\": [\n \"The Purge: Anarchy\",\n \"Inside Out 2\",\n \"Signs\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"overview\",\n \"properties\": {\n \"dtype\": \"string\",\n \"num_unique_values\": 7500,\n \"samples\": [\n \"The Civil War has ended, but Colonel Morsman Carver is on one final mission \\u2013 to kill Gideon, no matter what it takes. Launched by a gunshot and propelled by rage, the relentless pursuit takes the two men through frigid snow-capped mountains and arid deserts, far from the comforts and codes of civilisation, into the bloodiest recesses of their own souls.\",\n \"Peter makes good on another power outage at home by retelling Star Wars Episode V: The Empire Strikes Back.\",\n \"Nine years later, Jesse travels across Europe giving readings from a book he wrote about the night he spent in Vienna with Celine. After his reading in Paris, Celine finds him, and they spend part of the day together before Jesse has to again leave for a flight. They are both in relationships now, and Jesse has a son, but as their strong feelings for each other start to return, both confess a longing for more.\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"genre\",\n \"properties\": {\n \"dtype\": \"category\",\n \"num_unique_values\": 4,\n \"samples\": [\n \"Romance\",\n \"Animation\",\n \"Action\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"release_date\",\n \"properties\": {\n \"dtype\": \"object\",\n \"num_unique_values\": 5777,\n \"samples\": [\n \"1950-08-05\",\n \"1959-03-19\",\n \"2019-08-05\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"actor\",\n \"properties\": {\n \"dtype\": \"object\",\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"director\",\n \"properties\": {\n \"dtype\": \"object\",\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}"
+ }
+ },
+ "metadata": {},
+ "execution_count": 50
+ }
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "Random shuffle to prevent data leakage."
+ ],
+ "metadata": {
+ "id": "fwn9vMMWu83p"
+ }
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "seed = 1225\n",
+ "movies = movies.sample(frac=1.0, random_state=seed, ignore_index=True)"
+ ],
+ "metadata": {
+ "id": "5lrP6moBvH5Z",
+ "executionInfo": {
+ "status": "ok",
+ "timestamp": 1717165456491,
+ "user_tz": -480,
+ "elapsed": 1,
+ "user": {
+ "displayName": "Yunhui Liu",
+ "userId": "17327062528746877694"
+ }
+ }
+ },
+ "execution_count": 51,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": "movies.to_csv('TMDB.csv', index=False)",
+ "metadata": {
+ "id": "X_RMQTp7wBwE",
+ "executionInfo": {
+ "status": "ok",
+ "timestamp": 1717165458821,
+ "user_tz": -480,
+ "elapsed": 3,
+ "user": {
+ "displayName": "Yunhui Liu",
+ "userId": "17327062528746877694"
+ }
+ }
+ },
+ "execution_count": 52,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": "pd.read_csv('TMDB.csv')",
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/",
+ "height": 597
+ },
+ "id": "PluExPPAlIF-",
+ "executionInfo": {
+ "status": "ok",
+ "timestamp": 1717165462243,
+ "user_tz": -480,
+ "elapsed": 498,
+ "user": {
+ "displayName": "Yunhui Liu",
+ "userId": "17327062528746877694"
+ }
+ },
+ "outputId": "50cbc6d0-766a-40f3-dc8b-c87e213fa02b"
+ },
+ "execution_count": 53,
+ "outputs": [
+ {
+ "output_type": "execute_result",
+ "data": {
+ "text/plain": [
+ " id title \\\n",
+ "0 199753 Tom and Jerry's Giant Adventure \n",
+ "1 9560 A Walk in the Clouds \n",
+ "2 10875 The Fabulous Baker Boys \n",
+ "3 67609 Three Blind Mouseketeers \n",
+ "4 24021 The Twilight Saga: Eclipse \n",
+ "... ... ... \n",
+ "7500 358148 The Smurfic Games \n",
+ "7501 1001783 LaRoy, Texas \n",
+ "7502 43529 Golden Boy \n",
+ "7503 29884 Ball of Fire \n",
+ "7504 42745 The Skull \n",
+ "\n",
+ " overview genre \\\n",
+ "0 Tom And Jerry are among the last animals livin... Animation \n",
+ "1 World War II vet Paul Sutton falls for a pregn... Romance \n",
+ "2 The lives of two struggling musicians, who hap... Romance \n",
+ "3 As the title implies, the three blind mice are... Animation \n",
+ "4 Bella once again finds herself surrounded by d... Romance \n",
+ "... ... ... \n",
+ "7500 The Smurfs engage in athletic competition to s... Animation \n",
+ "7501 A man named Ray discovers his wife is cheating... Thriller \n",
+ "7502 Despite his talent as a musician, a city boy d... Romance \n",
+ "7503 A group of academics have spent years shut up ... Romance \n",
+ "7504 An occult investigator buys the 150-year-old s... Thriller \n",
+ "\n",
+ " release_date actor \\\n",
+ "0 2013-08-04 [80416, 86434, 60739, 5129, 1065, 31531, 11444... \n",
+ "1 1995-05-27 [7353, 62595, 3753, 85869, 6862, 152943, 6384,... \n",
+ "2 1989-10-13 [7906, 8354, 43364, 152963, 1160, 57992, 1229,... \n",
+ "3 1936-09-26 [31771, 5462] \n",
+ "4 2010-06-23 [84224, 84225, 45827, 121868, 87310, 1475835, ... \n",
+ "... ... ... \n",
+ "7500 1984-05-20 [24320, 101606, 77548, 148111, 81841, 15098, 1... \n",
+ "7501 2024-04-12 [1006144, 37154, 60677, 85484, 307885, 60460, ... \n",
+ "7502 1939-09-05 [5248, 34818, 1092484, 129544, 1010443, 29579,... \n",
+ "7503 1941-12-02 [13578, 29579, 3339, 103947, 1472526, 1466128,... \n",
+ "7504 1965-08-25 [5, 1847210, 67917, 113, 11028, 29909, 3796, 1... \n",
+ "\n",
+ " director \n",
+ "0 [23683, 1447452, 92317] \n",
+ "1 [77162, 1377239] \n",
+ "2 [2226, 2571810, 1966431] \n",
+ "3 [564041, 5446] \n",
+ "4 [2045537, 1393423, 27571, 2476949, 113019] \n",
+ "... ... \n",
+ "7500 [1198894] \n",
+ "7501 [2724637] \n",
+ "7502 [29595, 1312767] \n",
+ "7503 [121314, 3146, 11435, 30293, 87829] \n",
+ "7504 [5629] \n",
+ "\n",
+ "[7505 rows x 7 columns]"
+ ],
+ "text/html": [
+ "\n",
+ " \n",
+ "
\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " id | \n",
+ " title | \n",
+ " overview | \n",
+ " genre | \n",
+ " release_date | \n",
+ " actor | \n",
+ " director | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | 0 | \n",
+ " 199753 | \n",
+ " Tom and Jerry's Giant Adventure | \n",
+ " Tom And Jerry are among the last animals livin... | \n",
+ " Animation | \n",
+ " 2013-08-04 | \n",
+ " [80416, 86434, 60739, 5129, 1065, 31531, 11444... | \n",
+ " [23683, 1447452, 92317] | \n",
+ "
\n",
+ " \n",
+ " | 1 | \n",
+ " 9560 | \n",
+ " A Walk in the Clouds | \n",
+ " World War II vet Paul Sutton falls for a pregn... | \n",
+ " Romance | \n",
+ " 1995-05-27 | \n",
+ " [7353, 62595, 3753, 85869, 6862, 152943, 6384,... | \n",
+ " [77162, 1377239] | \n",
+ "
\n",
+ " \n",
+ " | 2 | \n",
+ " 10875 | \n",
+ " The Fabulous Baker Boys | \n",
+ " The lives of two struggling musicians, who hap... | \n",
+ " Romance | \n",
+ " 1989-10-13 | \n",
+ " [7906, 8354, 43364, 152963, 1160, 57992, 1229,... | \n",
+ " [2226, 2571810, 1966431] | \n",
+ "
\n",
+ " \n",
+ " | 3 | \n",
+ " 67609 | \n",
+ " Three Blind Mouseketeers | \n",
+ " As the title implies, the three blind mice are... | \n",
+ " Animation | \n",
+ " 1936-09-26 | \n",
+ " [31771, 5462] | \n",
+ " [564041, 5446] | \n",
+ "
\n",
+ " \n",
+ " | 4 | \n",
+ " 24021 | \n",
+ " The Twilight Saga: Eclipse | \n",
+ " Bella once again finds herself surrounded by d... | \n",
+ " Romance | \n",
+ " 2010-06-23 | \n",
+ " [84224, 84225, 45827, 121868, 87310, 1475835, ... | \n",
+ " [2045537, 1393423, 27571, 2476949, 113019] | \n",
+ "
\n",
+ " \n",
+ " | ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ "
\n",
+ " \n",
+ " | 7500 | \n",
+ " 358148 | \n",
+ " The Smurfic Games | \n",
+ " The Smurfs engage in athletic competition to s... | \n",
+ " Animation | \n",
+ " 1984-05-20 | \n",
+ " [24320, 101606, 77548, 148111, 81841, 15098, 1... | \n",
+ " [1198894] | \n",
+ "
\n",
+ " \n",
+ " | 7501 | \n",
+ " 1001783 | \n",
+ " LaRoy, Texas | \n",
+ " A man named Ray discovers his wife is cheating... | \n",
+ " Thriller | \n",
+ " 2024-04-12 | \n",
+ " [1006144, 37154, 60677, 85484, 307885, 60460, ... | \n",
+ " [2724637] | \n",
+ "
\n",
+ " \n",
+ " | 7502 | \n",
+ " 43529 | \n",
+ " Golden Boy | \n",
+ " Despite his talent as a musician, a city boy d... | \n",
+ " Romance | \n",
+ " 1939-09-05 | \n",
+ " [5248, 34818, 1092484, 129544, 1010443, 29579,... | \n",
+ " [29595, 1312767] | \n",
+ "
\n",
+ " \n",
+ " | 7503 | \n",
+ " 29884 | \n",
+ " Ball of Fire | \n",
+ " A group of academics have spent years shut up ... | \n",
+ " Romance | \n",
+ " 1941-12-02 | \n",
+ " [13578, 29579, 3339, 103947, 1472526, 1466128,... | \n",
+ " [121314, 3146, 11435, 30293, 87829] | \n",
+ "
\n",
+ " \n",
+ " | 7504 | \n",
+ " 42745 | \n",
+ " The Skull | \n",
+ " An occult investigator buys the 150-year-old s... | \n",
+ " Thriller | \n",
+ " 1965-08-25 | \n",
+ " [5, 1847210, 67917, 113, 11028, 29909, 3796, 1... | \n",
+ " [5629] | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
7505 rows × 7 columns
\n",
+ "
\n",
+ "
\n",
+ "
\n"
+ ],
+ "application/vnd.google.colaboratory.intrinsic+json": {
+ "type": "dataframe",
+ "summary": "{\n \"name\": \"pd\",\n \"rows\": 7505,\n \"fields\": [\n {\n \"column\": \"id\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 274531,\n \"min\": 11,\n \"max\": 1288104,\n \"num_unique_values\": 7505,\n \"samples\": [\n 10202,\n 19947,\n 814340\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"title\",\n \"properties\": {\n \"dtype\": \"string\",\n \"num_unique_values\": 7270,\n \"samples\": [\n \"Our Town\",\n \"Deep Blue Sea\",\n \"Fanny Hill\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"overview\",\n \"properties\": {\n \"dtype\": \"string\",\n \"num_unique_values\": 7500,\n \"samples\": [\n \"Two police officers struggle to survive when they become trapped beneath the rubble of the World Trade Center on September 11, 2001.\",\n \"Simon Phoenix, a violent criminal cryogenically frozen in 1996, escapes during a parole hearing in 2032 in the utopia of San Angeles. Police are incapable of dealing with his violent ways and turn to his captor, who had also been cryogenically frozen after being wrongfully accused of killing 30 innocent people while apprehending Phoenix.\",\n \"A UK-based military officer in command of a top secret drone operation to capture terrorists in Kenya discovers the targets are planning a suicide bombing and the mission escalates from \\u201ccapture\\u201d to \\u201ckill.\\u201d As American pilot Steve Watts is about to engage, a nine-year old girl enters the kill zone, triggering an international dispute reaching the highest levels of US and British government over the moral, political, and personal implications of modern warfare.\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"genre\",\n \"properties\": {\n \"dtype\": \"category\",\n \"num_unique_values\": 4,\n \"samples\": [\n \"Romance\",\n \"Action\",\n \"Animation\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"release_date\",\n \"properties\": {\n \"dtype\": \"object\",\n \"num_unique_values\": 5777,\n \"samples\": [\n \"2002-05-03\",\n \"1940-05-24\",\n \"1947-11-28\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"actor\",\n \"properties\": {\n \"dtype\": \"string\",\n \"num_unique_values\": 7085,\n \"samples\": [\n \"[1394090, 6413, 1674734, 212815, 137905]\",\n \"[58339, 2629, 10341, 1229878, 3895, 10748, 175965]\",\n \"[17486, 2299, 36819, 484359]\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"director\",\n \"properties\": {\n \"dtype\": \"string\",\n \"num_unique_values\": 5609,\n \"samples\": [\n \"[1701297, 1701298, 10723]\",\n \"[1778540, 17825, 1129908, 2121663]\",\n \"[1455417]\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}"
+ }
+ },
+ "metadata": {},
+ "execution_count": 53
+ }
+ ]
+ }
+ ]
+}