├── .gitignore ├── LICENSE ├── Movie Recommender System Data Analysis.ipynb ├── Procfile ├── README.md ├── app.py ├── artifacts └── .gitignore ├── data └── .gitignore ├── demo ├── 1.png ├── 2.png ├── 3.png └── 6.jpeg ├── requirements.txt ├── setup.py ├── setup.sh └── src ├── __init__.py └── utils └── __init__.py /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | wheels/ 23 | pip-wheel-metadata/ 24 | share/python-wheels/ 25 | *.egg-info/ 26 | .installed.cfg 27 | *.egg 28 | MANIFEST 29 | 30 | # PyInstaller 31 | # Usually these files are written by a python script from a template 32 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 33 | *.manifest 34 | *.spec 35 | 36 | # Installer logs 37 | pip-log.txt 38 | pip-delete-this-directory.txt 39 | 40 | # Unit test / coverage reports 41 | htmlcov/ 42 | .tox/ 43 | .nox/ 44 | .coverage 45 | .coverage.* 46 | .cache 47 | nosetests.xml 48 | coverage.xml 49 | *.cover 50 | *.py,cover 51 | .hypothesis/ 52 | .pytest_cache/ 53 | 54 | # Translations 55 | *.mo 56 | *.pot 57 | 58 | # Django stuff: 59 | *.log 60 | local_settings.py 61 | db.sqlite3 62 | db.sqlite3-journal 63 | 64 | # Flask stuff: 65 | instance/ 66 | .webassets-cache 67 | 68 | # Scrapy stuff: 69 | .scrapy 70 | 71 | # Sphinx documentation 72 | docs/_build/ 73 | 74 | # PyBuilder 75 | target/ 76 | 77 | # Jupyter Notebook 78 | .ipynb_checkpoints 79 | 80 | # IPython 81 | profile_default/ 82 | ipython_config.py 83 | 84 | # pyenv 85 | .python-version 86 | 87 | # pipenv 88 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 89 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 90 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 91 | # install all needed dependencies. 92 | #Pipfile.lock 93 | 94 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow 95 | __pypackages__/ 96 | 97 | # Celery stuff 98 | celerybeat-schedule 99 | celerybeat.pid 100 | 101 | # SageMath parsed files 102 | *.sage.py 103 | 104 | # Environments 105 | .env 106 | .venv 107 | env/ 108 | venv/ 109 | ENV/ 110 | env.bak/ 111 | venv.bak/ 112 | 113 | # Spyder project settings 114 | .spyderproject 115 | .spyproject 116 | 117 | # Rope project settings 118 | .ropeproject 119 | 120 | # mkdocs documentation 121 | /site 122 | 123 | # mypy 124 | .mypy_cache/ 125 | .dmypy.json 126 | dmypy.json 127 | 128 | # Pyre type checker 129 | .pyre/ 130 | 131 | # if using pycharm 132 | .idea 133 | 134 | # if using VScode 135 | .vscode 136 | 137 | # add secret keys or API keys here 138 | configs/secrets.yaml 139 | 140 | # add your env folder here if its there 141 | 142 | 143 | 144 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Bappy Ahmed 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Movie Recommender System Data Analysis.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "## Content Based Recommender System" 8 | ] 9 | }, 10 | { 11 | "cell_type": "code", 12 | "execution_count": 150, 13 | "metadata": {}, 14 | "outputs": [], 15 | "source": [ 16 | "import numpy as np \n", 17 | "import pandas as pd" 18 | ] 19 | }, 20 | { 21 | "cell_type": "code", 22 | "execution_count": 151, 23 | "metadata": {}, 24 | "outputs": [], 25 | "source": [ 26 | "movies = pd.read_csv('data/tmdb_5000_movies.csv')\n", 27 | "credits = pd.read_csv('data/tmdb_5000_credits.csv')" 28 | ] 29 | }, 30 | { 31 | "cell_type": "code", 32 | "execution_count": 152, 33 | "metadata": {}, 34 | "outputs": [ 35 | { 36 | "data": { 37 | "text/html": [ 38 | "
\n", 39 | "\n", 52 | "\n", 53 | " \n", 54 | " \n", 55 | " \n", 56 | " \n", 57 | " \n", 58 | " \n", 59 | " \n", 60 | " \n", 61 | " \n", 62 | " \n", 63 | " \n", 64 | " \n", 65 | " \n", 66 | " \n", 67 | " \n", 68 | " \n", 69 | " \n", 70 | " \n", 71 | " \n", 72 | " \n", 73 | " \n", 74 | " \n", 75 | " \n", 76 | " \n", 77 | " \n", 78 | " \n", 79 | " \n", 80 | " \n", 81 | " \n", 82 | " \n", 83 | " \n", 84 | " \n", 85 | " \n", 86 | " \n", 87 | " \n", 88 | " \n", 89 | " \n", 90 | " \n", 91 | " \n", 92 | " \n", 93 | " \n", 94 | " \n", 95 | " \n", 96 | " \n", 97 | " \n", 98 | " \n", 99 | " \n", 100 | " \n", 101 | " \n", 102 | " \n", 103 | " \n", 104 | " \n", 105 | " \n", 106 | " \n", 107 | " \n", 108 | " \n", 109 | " \n", 110 | " \n", 111 | " \n", 112 | " \n", 113 | " \n", 114 | " \n", 115 | " \n", 116 | " \n", 117 | " \n", 118 | " \n", 119 | " \n", 120 | " \n", 121 | " \n", 122 | " \n", 123 | " \n", 124 | " \n", 125 | " \n", 126 | "
budgetgenreshomepageidkeywordsoriginal_languageoriginal_titleoverviewpopularityproduction_companiesproduction_countriesrelease_daterevenueruntimespoken_languagesstatustaglinetitlevote_averagevote_count
0237000000[{\"id\": 28, \"name\": \"Action\"}, {\"id\": 12, \"nam...http://www.avatarmovie.com/19995[{\"id\": 1463, \"name\": \"culture clash\"}, {\"id\":...enAvatarIn the 22nd century, a paraplegic Marine is di...150.437577[{\"name\": \"Ingenious Film Partners\", \"id\": 289...[{\"iso_3166_1\": \"US\", \"name\": \"United States o...2009-12-102787965087162.0[{\"iso_639_1\": \"en\", \"name\": \"English\"}, {\"iso...ReleasedEnter the World of Pandora.Avatar7.211800
1300000000[{\"id\": 12, \"name\": \"Adventure\"}, {\"id\": 14, \"...http://disney.go.com/disneypictures/pirates/285[{\"id\": 270, \"name\": \"ocean\"}, {\"id\": 726, \"na...enPirates of the Caribbean: At World's EndCaptain Barbossa, long believed to be dead, ha...139.082615[{\"name\": \"Walt Disney Pictures\", \"id\": 2}, {\"...[{\"iso_3166_1\": \"US\", \"name\": \"United States o...2007-05-19961000000169.0[{\"iso_639_1\": \"en\", \"name\": \"English\"}]ReleasedAt the end of the world, the adventure begins.Pirates of the Caribbean: At World's End6.94500
\n", 127 | "
" 128 | ], 129 | "text/plain": [ 130 | " budget genres \\\n", 131 | "0 237000000 [{\"id\": 28, \"name\": \"Action\"}, {\"id\": 12, \"nam... \n", 132 | "1 300000000 [{\"id\": 12, \"name\": \"Adventure\"}, {\"id\": 14, \"... \n", 133 | "\n", 134 | " homepage id \\\n", 135 | "0 http://www.avatarmovie.com/ 19995 \n", 136 | "1 http://disney.go.com/disneypictures/pirates/ 285 \n", 137 | "\n", 138 | " keywords original_language \\\n", 139 | "0 [{\"id\": 1463, \"name\": \"culture clash\"}, {\"id\":... en \n", 140 | "1 [{\"id\": 270, \"name\": \"ocean\"}, {\"id\": 726, \"na... en \n", 141 | "\n", 142 | " original_title \\\n", 143 | "0 Avatar \n", 144 | "1 Pirates of the Caribbean: At World's End \n", 145 | "\n", 146 | " overview popularity \\\n", 147 | "0 In the 22nd century, a paraplegic Marine is di... 150.437577 \n", 148 | "1 Captain Barbossa, long believed to be dead, ha... 139.082615 \n", 149 | "\n", 150 | " production_companies \\\n", 151 | "0 [{\"name\": \"Ingenious Film Partners\", \"id\": 289... \n", 152 | "1 [{\"name\": \"Walt Disney Pictures\", \"id\": 2}, {\"... \n", 153 | "\n", 154 | " production_countries release_date revenue \\\n", 155 | "0 [{\"iso_3166_1\": \"US\", \"name\": \"United States o... 2009-12-10 2787965087 \n", 156 | "1 [{\"iso_3166_1\": \"US\", \"name\": \"United States o... 2007-05-19 961000000 \n", 157 | "\n", 158 | " runtime spoken_languages status \\\n", 159 | "0 162.0 [{\"iso_639_1\": \"en\", \"name\": \"English\"}, {\"iso... Released \n", 160 | "1 169.0 [{\"iso_639_1\": \"en\", \"name\": \"English\"}] Released \n", 161 | "\n", 162 | " tagline \\\n", 163 | "0 Enter the World of Pandora. \n", 164 | "1 At the end of the world, the adventure begins. \n", 165 | "\n", 166 | " title vote_average vote_count \n", 167 | "0 Avatar 7.2 11800 \n", 168 | "1 Pirates of the Caribbean: At World's End 6.9 4500 " 169 | ] 170 | }, 171 | "execution_count": 152, 172 | "metadata": {}, 173 | "output_type": "execute_result" 174 | } 175 | ], 176 | "source": [ 177 | "movies.head(2)" 178 | ] 179 | }, 180 | { 181 | "cell_type": "code", 182 | "execution_count": 153, 183 | "metadata": {}, 184 | "outputs": [ 185 | { 186 | "data": { 187 | "text/plain": [ 188 | "(4803, 20)" 189 | ] 190 | }, 191 | "execution_count": 153, 192 | "metadata": {}, 193 | "output_type": "execute_result" 194 | } 195 | ], 196 | "source": [ 197 | "movies.shape" 198 | ] 199 | }, 200 | { 201 | "cell_type": "code", 202 | "execution_count": 154, 203 | "metadata": {}, 204 | "outputs": [ 205 | { 206 | "data": { 207 | "text/html": [ 208 | "
\n", 209 | "\n", 222 | "\n", 223 | " \n", 224 | " \n", 225 | " \n", 226 | " \n", 227 | " \n", 228 | " \n", 229 | " \n", 230 | " \n", 231 | " \n", 232 | " \n", 233 | " \n", 234 | " \n", 235 | " \n", 236 | " \n", 237 | " \n", 238 | " \n", 239 | " \n", 240 | " \n", 241 | " \n", 242 | " \n", 243 | " \n", 244 | " \n", 245 | " \n", 246 | " \n", 247 | " \n", 248 | " \n", 249 | " \n", 250 | " \n", 251 | " \n", 252 | " \n", 253 | " \n", 254 | " \n", 255 | " \n", 256 | " \n", 257 | " \n", 258 | " \n", 259 | " \n", 260 | " \n", 261 | " \n", 262 | " \n", 263 | " \n", 264 | " \n", 265 | " \n", 266 | " \n", 267 | " \n", 268 | " \n", 269 | "
movie_idtitlecastcrew
019995Avatar[{\"cast_id\": 242, \"character\": \"Jake Sully\", \"...[{\"credit_id\": \"52fe48009251416c750aca23\", \"de...
1285Pirates of the Caribbean: At World's End[{\"cast_id\": 4, \"character\": \"Captain Jack Spa...[{\"credit_id\": \"52fe4232c3a36847f800b579\", \"de...
2206647Spectre[{\"cast_id\": 1, \"character\": \"James Bond\", \"cr...[{\"credit_id\": \"54805967c3a36829b5002c41\", \"de...
349026The Dark Knight Rises[{\"cast_id\": 2, \"character\": \"Bruce Wayne / Ba...[{\"credit_id\": \"52fe4781c3a36847f81398c3\", \"de...
449529John Carter[{\"cast_id\": 5, \"character\": \"John Carter\", \"c...[{\"credit_id\": \"52fe479ac3a36847f813eaa3\", \"de...
\n", 270 | "
" 271 | ], 272 | "text/plain": [ 273 | " movie_id title \\\n", 274 | "0 19995 Avatar \n", 275 | "1 285 Pirates of the Caribbean: At World's End \n", 276 | "2 206647 Spectre \n", 277 | "3 49026 The Dark Knight Rises \n", 278 | "4 49529 John Carter \n", 279 | "\n", 280 | " cast \\\n", 281 | "0 [{\"cast_id\": 242, \"character\": \"Jake Sully\", \"... \n", 282 | "1 [{\"cast_id\": 4, \"character\": \"Captain Jack Spa... \n", 283 | "2 [{\"cast_id\": 1, \"character\": \"James Bond\", \"cr... \n", 284 | "3 [{\"cast_id\": 2, \"character\": \"Bruce Wayne / Ba... \n", 285 | "4 [{\"cast_id\": 5, \"character\": \"John Carter\", \"c... \n", 286 | "\n", 287 | " crew \n", 288 | "0 [{\"credit_id\": \"52fe48009251416c750aca23\", \"de... \n", 289 | "1 [{\"credit_id\": \"52fe4232c3a36847f800b579\", \"de... \n", 290 | "2 [{\"credit_id\": \"54805967c3a36829b5002c41\", \"de... \n", 291 | "3 [{\"credit_id\": \"52fe4781c3a36847f81398c3\", \"de... \n", 292 | "4 [{\"credit_id\": \"52fe479ac3a36847f813eaa3\", \"de... " 293 | ] 294 | }, 295 | "execution_count": 154, 296 | "metadata": {}, 297 | "output_type": "execute_result" 298 | } 299 | ], 300 | "source": [ 301 | "credits.head()" 302 | ] 303 | }, 304 | { 305 | "cell_type": "code", 306 | "execution_count": 155, 307 | "metadata": {}, 308 | "outputs": [ 309 | { 310 | "data": { 311 | "text/plain": [ 312 | "(4803, 4)" 313 | ] 314 | }, 315 | "execution_count": 155, 316 | "metadata": {}, 317 | "output_type": "execute_result" 318 | } 319 | ], 320 | "source": [ 321 | "credits.shape" 322 | ] 323 | }, 324 | { 325 | "cell_type": "code", 326 | "execution_count": 156, 327 | "metadata": {}, 328 | "outputs": [], 329 | "source": [ 330 | "movies = movies.merge(credits,on='title')" 331 | ] 332 | }, 333 | { 334 | "cell_type": "code", 335 | "execution_count": 157, 336 | "metadata": {}, 337 | "outputs": [ 338 | { 339 | "data": { 340 | "text/html": [ 341 | "
\n", 342 | "\n", 355 | "\n", 356 | " \n", 357 | " \n", 358 | " \n", 359 | " \n", 360 | " \n", 361 | " \n", 362 | " \n", 363 | " \n", 364 | " \n", 365 | " \n", 366 | " \n", 367 | " \n", 368 | " \n", 369 | " \n", 370 | " \n", 371 | " \n", 372 | " \n", 373 | " \n", 374 | " \n", 375 | " \n", 376 | " \n", 377 | " \n", 378 | " \n", 379 | " \n", 380 | " \n", 381 | " \n", 382 | " \n", 383 | " \n", 384 | " \n", 385 | " \n", 386 | " \n", 387 | " \n", 388 | " \n", 389 | " \n", 390 | " \n", 391 | " \n", 392 | " \n", 393 | " \n", 394 | " \n", 395 | " \n", 396 | " \n", 397 | " \n", 398 | " \n", 399 | " \n", 400 | " \n", 401 | " \n", 402 | " \n", 403 | " \n", 404 | " \n", 405 | " \n", 406 | " \n", 407 | " \n", 408 | " \n", 409 | " \n", 410 | " \n", 411 | " \n", 412 | " \n", 413 | " \n", 414 | " \n", 415 | " \n", 416 | " \n", 417 | " \n", 418 | " \n", 419 | " \n", 420 | " \n", 421 | " \n", 422 | " \n", 423 | " \n", 424 | " \n", 425 | " \n", 426 | " \n", 427 | " \n", 428 | " \n", 429 | " \n", 430 | " \n", 431 | " \n", 432 | "
budgetgenreshomepageidkeywordsoriginal_languageoriginal_titleoverviewpopularityproduction_companies...runtimespoken_languagesstatustaglinetitlevote_averagevote_countmovie_idcastcrew
0237000000[{\"id\": 28, \"name\": \"Action\"}, {\"id\": 12, \"nam...http://www.avatarmovie.com/19995[{\"id\": 1463, \"name\": \"culture clash\"}, {\"id\":...enAvatarIn the 22nd century, a paraplegic Marine is di...150.437577[{\"name\": \"Ingenious Film Partners\", \"id\": 289......162.0[{\"iso_639_1\": \"en\", \"name\": \"English\"}, {\"iso...ReleasedEnter the World of Pandora.Avatar7.21180019995[{\"cast_id\": 242, \"character\": \"Jake Sully\", \"...[{\"credit_id\": \"52fe48009251416c750aca23\", \"de...
1300000000[{\"id\": 12, \"name\": \"Adventure\"}, {\"id\": 14, \"...http://disney.go.com/disneypictures/pirates/285[{\"id\": 270, \"name\": \"ocean\"}, {\"id\": 726, \"na...enPirates of the Caribbean: At World's EndCaptain Barbossa, long believed to be dead, ha...139.082615[{\"name\": \"Walt Disney Pictures\", \"id\": 2}, {\"......169.0[{\"iso_639_1\": \"en\", \"name\": \"English\"}]ReleasedAt the end of the world, the adventure begins.Pirates of the Caribbean: At World's End6.94500285[{\"cast_id\": 4, \"character\": \"Captain Jack Spa...[{\"credit_id\": \"52fe4232c3a36847f800b579\", \"de...
\n", 433 | "

2 rows × 23 columns

\n", 434 | "
" 435 | ], 436 | "text/plain": [ 437 | " budget genres \\\n", 438 | "0 237000000 [{\"id\": 28, \"name\": \"Action\"}, {\"id\": 12, \"nam... \n", 439 | "1 300000000 [{\"id\": 12, \"name\": \"Adventure\"}, {\"id\": 14, \"... \n", 440 | "\n", 441 | " homepage id \\\n", 442 | "0 http://www.avatarmovie.com/ 19995 \n", 443 | "1 http://disney.go.com/disneypictures/pirates/ 285 \n", 444 | "\n", 445 | " keywords original_language \\\n", 446 | "0 [{\"id\": 1463, \"name\": \"culture clash\"}, {\"id\":... en \n", 447 | "1 [{\"id\": 270, \"name\": \"ocean\"}, {\"id\": 726, \"na... en \n", 448 | "\n", 449 | " original_title \\\n", 450 | "0 Avatar \n", 451 | "1 Pirates of the Caribbean: At World's End \n", 452 | "\n", 453 | " overview popularity \\\n", 454 | "0 In the 22nd century, a paraplegic Marine is di... 150.437577 \n", 455 | "1 Captain Barbossa, long believed to be dead, ha... 139.082615 \n", 456 | "\n", 457 | " production_companies ... runtime \\\n", 458 | "0 [{\"name\": \"Ingenious Film Partners\", \"id\": 289... ... 162.0 \n", 459 | "1 [{\"name\": \"Walt Disney Pictures\", \"id\": 2}, {\"... ... 169.0 \n", 460 | "\n", 461 | " spoken_languages status \\\n", 462 | "0 [{\"iso_639_1\": \"en\", \"name\": \"English\"}, {\"iso... Released \n", 463 | "1 [{\"iso_639_1\": \"en\", \"name\": \"English\"}] Released \n", 464 | "\n", 465 | " tagline \\\n", 466 | "0 Enter the World of Pandora. \n", 467 | "1 At the end of the world, the adventure begins. \n", 468 | "\n", 469 | " title vote_average vote_count movie_id \\\n", 470 | "0 Avatar 7.2 11800 19995 \n", 471 | "1 Pirates of the Caribbean: At World's End 6.9 4500 285 \n", 472 | "\n", 473 | " cast \\\n", 474 | "0 [{\"cast_id\": 242, \"character\": \"Jake Sully\", \"... \n", 475 | "1 [{\"cast_id\": 4, \"character\": \"Captain Jack Spa... \n", 476 | "\n", 477 | " crew \n", 478 | "0 [{\"credit_id\": \"52fe48009251416c750aca23\", \"de... \n", 479 | "1 [{\"credit_id\": \"52fe4232c3a36847f800b579\", \"de... \n", 480 | "\n", 481 | "[2 rows x 23 columns]" 482 | ] 483 | }, 484 | "execution_count": 157, 485 | "metadata": {}, 486 | "output_type": "execute_result" 487 | } 488 | ], 489 | "source": [ 490 | "movies.head(2)" 491 | ] 492 | }, 493 | { 494 | "cell_type": "code", 495 | "execution_count": 158, 496 | "metadata": {}, 497 | "outputs": [ 498 | { 499 | "data": { 500 | "text/plain": [ 501 | "(4809, 23)" 502 | ] 503 | }, 504 | "execution_count": 158, 505 | "metadata": {}, 506 | "output_type": "execute_result" 507 | } 508 | ], 509 | "source": [ 510 | "movies.shape" 511 | ] 512 | }, 513 | { 514 | "cell_type": "code", 515 | "execution_count": 159, 516 | "metadata": {}, 517 | "outputs": [], 518 | "source": [ 519 | "# Keeping important columns for recommendation\n", 520 | "movies = movies[['movie_id','title','overview','genres','keywords','cast','crew']]" 521 | ] 522 | }, 523 | { 524 | "cell_type": "code", 525 | "execution_count": 160, 526 | "metadata": {}, 527 | "outputs": [ 528 | { 529 | "data": { 530 | "text/html": [ 531 | "
\n", 532 | "\n", 545 | "\n", 546 | " \n", 547 | " \n", 548 | " \n", 549 | " \n", 550 | " \n", 551 | " \n", 552 | " \n", 553 | " \n", 554 | " \n", 555 | " \n", 556 | " \n", 557 | " \n", 558 | " \n", 559 | " \n", 560 | " \n", 561 | " \n", 562 | " \n", 563 | " \n", 564 | " \n", 565 | " \n", 566 | " \n", 567 | " \n", 568 | " \n", 569 | " \n", 570 | " \n", 571 | " \n", 572 | " \n", 573 | " \n", 574 | " \n", 575 | " \n", 576 | " \n", 577 | " \n", 578 | " \n", 579 | " \n", 580 | "
movie_idtitleoverviewgenreskeywordscastcrew
019995AvatarIn the 22nd century, a paraplegic Marine is di...[{\"id\": 28, \"name\": \"Action\"}, {\"id\": 12, \"nam...[{\"id\": 1463, \"name\": \"culture clash\"}, {\"id\":...[{\"cast_id\": 242, \"character\": \"Jake Sully\", \"...[{\"credit_id\": \"52fe48009251416c750aca23\", \"de...
1285Pirates of the Caribbean: At World's EndCaptain Barbossa, long believed to be dead, ha...[{\"id\": 12, \"name\": \"Adventure\"}, {\"id\": 14, \"...[{\"id\": 270, \"name\": \"ocean\"}, {\"id\": 726, \"na...[{\"cast_id\": 4, \"character\": \"Captain Jack Spa...[{\"credit_id\": \"52fe4232c3a36847f800b579\", \"de...
\n", 581 | "
" 582 | ], 583 | "text/plain": [ 584 | " movie_id title \\\n", 585 | "0 19995 Avatar \n", 586 | "1 285 Pirates of the Caribbean: At World's End \n", 587 | "\n", 588 | " overview \\\n", 589 | "0 In the 22nd century, a paraplegic Marine is di... \n", 590 | "1 Captain Barbossa, long believed to be dead, ha... \n", 591 | "\n", 592 | " genres \\\n", 593 | "0 [{\"id\": 28, \"name\": \"Action\"}, {\"id\": 12, \"nam... \n", 594 | "1 [{\"id\": 12, \"name\": \"Adventure\"}, {\"id\": 14, \"... \n", 595 | "\n", 596 | " keywords \\\n", 597 | "0 [{\"id\": 1463, \"name\": \"culture clash\"}, {\"id\":... \n", 598 | "1 [{\"id\": 270, \"name\": \"ocean\"}, {\"id\": 726, \"na... \n", 599 | "\n", 600 | " cast \\\n", 601 | "0 [{\"cast_id\": 242, \"character\": \"Jake Sully\", \"... \n", 602 | "1 [{\"cast_id\": 4, \"character\": \"Captain Jack Spa... \n", 603 | "\n", 604 | " crew \n", 605 | "0 [{\"credit_id\": \"52fe48009251416c750aca23\", \"de... \n", 606 | "1 [{\"credit_id\": \"52fe4232c3a36847f800b579\", \"de... " 607 | ] 608 | }, 609 | "execution_count": 160, 610 | "metadata": {}, 611 | "output_type": "execute_result" 612 | } 613 | ], 614 | "source": [ 615 | "movies.head(2)" 616 | ] 617 | }, 618 | { 619 | "cell_type": "code", 620 | "execution_count": 161, 621 | "metadata": {}, 622 | "outputs": [ 623 | { 624 | "data": { 625 | "text/plain": [ 626 | "(4809, 7)" 627 | ] 628 | }, 629 | "execution_count": 161, 630 | "metadata": {}, 631 | "output_type": "execute_result" 632 | } 633 | ], 634 | "source": [ 635 | "movies.shape" 636 | ] 637 | }, 638 | { 639 | "cell_type": "code", 640 | "execution_count": 162, 641 | "metadata": {}, 642 | "outputs": [ 643 | { 644 | "data": { 645 | "text/plain": [ 646 | "movie_id 0\n", 647 | "title 0\n", 648 | "overview 3\n", 649 | "genres 0\n", 650 | "keywords 0\n", 651 | "cast 0\n", 652 | "crew 0\n", 653 | "dtype: int64" 654 | ] 655 | }, 656 | "execution_count": 162, 657 | "metadata": {}, 658 | "output_type": "execute_result" 659 | } 660 | ], 661 | "source": [ 662 | "movies.isnull().sum()" 663 | ] 664 | }, 665 | { 666 | "cell_type": "code", 667 | "execution_count": 163, 668 | "metadata": {}, 669 | "outputs": [], 670 | "source": [ 671 | "movies.dropna(inplace=True)" 672 | ] 673 | }, 674 | { 675 | "cell_type": "code", 676 | "execution_count": 164, 677 | "metadata": {}, 678 | "outputs": [ 679 | { 680 | "data": { 681 | "text/plain": [ 682 | "movie_id 0\n", 683 | "title 0\n", 684 | "overview 0\n", 685 | "genres 0\n", 686 | "keywords 0\n", 687 | "cast 0\n", 688 | "crew 0\n", 689 | "dtype: int64" 690 | ] 691 | }, 692 | "execution_count": 164, 693 | "metadata": {}, 694 | "output_type": "execute_result" 695 | } 696 | ], 697 | "source": [ 698 | "movies.isnull().sum()" 699 | ] 700 | }, 701 | { 702 | "cell_type": "code", 703 | "execution_count": 165, 704 | "metadata": {}, 705 | "outputs": [ 706 | { 707 | "data": { 708 | "text/plain": [ 709 | "(4806, 7)" 710 | ] 711 | }, 712 | "execution_count": 165, 713 | "metadata": {}, 714 | "output_type": "execute_result" 715 | } 716 | ], 717 | "source": [ 718 | "movies.shape" 719 | ] 720 | }, 721 | { 722 | "cell_type": "code", 723 | "execution_count": 166, 724 | "metadata": {}, 725 | "outputs": [ 726 | { 727 | "data": { 728 | "text/plain": [ 729 | "0" 730 | ] 731 | }, 732 | "execution_count": 166, 733 | "metadata": {}, 734 | "output_type": "execute_result" 735 | } 736 | ], 737 | "source": [ 738 | "movies.duplicated().sum()" 739 | ] 740 | }, 741 | { 742 | "cell_type": "code", 743 | "execution_count": 167, 744 | "metadata": {}, 745 | "outputs": [ 746 | { 747 | "data": { 748 | "text/plain": [ 749 | "'[{\"id\": 28, \"name\": \"Action\"}, {\"id\": 12, \"name\": \"Adventure\"}, {\"id\": 14, \"name\": \"Fantasy\"}, {\"id\": 878, \"name\": \"Science Fiction\"}]'" 750 | ] 751 | }, 752 | "execution_count": 167, 753 | "metadata": {}, 754 | "output_type": "execute_result" 755 | } 756 | ], 757 | "source": [ 758 | "# handle genres\n", 759 | "\n", 760 | "movies.iloc[0]['genres']" 761 | ] 762 | }, 763 | { 764 | "cell_type": "code", 765 | "execution_count": 168, 766 | "metadata": {}, 767 | "outputs": [], 768 | "source": [ 769 | "import ast #for converting str to list\n", 770 | "\n", 771 | "def convert(text):\n", 772 | " L = []\n", 773 | " for i in ast.literal_eval(text):\n", 774 | " L.append(i['name']) \n", 775 | " return L" 776 | ] 777 | }, 778 | { 779 | "cell_type": "code", 780 | "execution_count": 169, 781 | "metadata": {}, 782 | "outputs": [], 783 | "source": [ 784 | "movies['genres'] = movies['genres'].apply(convert)" 785 | ] 786 | }, 787 | { 788 | "cell_type": "code", 789 | "execution_count": 170, 790 | "metadata": {}, 791 | "outputs": [ 792 | { 793 | "data": { 794 | "text/html": [ 795 | "
\n", 796 | "\n", 809 | "\n", 810 | " \n", 811 | " \n", 812 | " \n", 813 | " \n", 814 | " \n", 815 | " \n", 816 | " \n", 817 | " \n", 818 | " \n", 819 | " \n", 820 | " \n", 821 | " \n", 822 | " \n", 823 | " \n", 824 | " \n", 825 | " \n", 826 | " \n", 827 | " \n", 828 | " \n", 829 | " \n", 830 | " \n", 831 | " \n", 832 | " \n", 833 | " \n", 834 | " \n", 835 | " \n", 836 | " \n", 837 | " \n", 838 | " \n", 839 | " \n", 840 | " \n", 841 | " \n", 842 | " \n", 843 | " \n", 844 | " \n", 845 | " \n", 846 | " \n", 847 | " \n", 848 | " \n", 849 | " \n", 850 | " \n", 851 | " \n", 852 | " \n", 853 | " \n", 854 | " \n", 855 | " \n", 856 | " \n", 857 | " \n", 858 | " \n", 859 | " \n", 860 | " \n", 861 | " \n", 862 | " \n", 863 | " \n", 864 | " \n", 865 | " \n", 866 | " \n", 867 | " \n", 868 | " \n", 869 | " \n", 870 | " \n", 871 | " \n", 872 | " \n", 873 | " \n", 874 | "
movie_idtitleoverviewgenreskeywordscastcrew
019995AvatarIn the 22nd century, a paraplegic Marine is di...[Action, Adventure, Fantasy, Science Fiction][{\"id\": 1463, \"name\": \"culture clash\"}, {\"id\":...[{\"cast_id\": 242, \"character\": \"Jake Sully\", \"...[{\"credit_id\": \"52fe48009251416c750aca23\", \"de...
1285Pirates of the Caribbean: At World's EndCaptain Barbossa, long believed to be dead, ha...[Adventure, Fantasy, Action][{\"id\": 270, \"name\": \"ocean\"}, {\"id\": 726, \"na...[{\"cast_id\": 4, \"character\": \"Captain Jack Spa...[{\"credit_id\": \"52fe4232c3a36847f800b579\", \"de...
2206647SpectreA cryptic message from Bond’s past sends him o...[Action, Adventure, Crime][{\"id\": 470, \"name\": \"spy\"}, {\"id\": 818, \"name...[{\"cast_id\": 1, \"character\": \"James Bond\", \"cr...[{\"credit_id\": \"54805967c3a36829b5002c41\", \"de...
349026The Dark Knight RisesFollowing the death of District Attorney Harve...[Action, Crime, Drama, Thriller][{\"id\": 849, \"name\": \"dc comics\"}, {\"id\": 853,...[{\"cast_id\": 2, \"character\": \"Bruce Wayne / Ba...[{\"credit_id\": \"52fe4781c3a36847f81398c3\", \"de...
449529John CarterJohn Carter is a war-weary, former military ca...[Action, Adventure, Science Fiction][{\"id\": 818, \"name\": \"based on novel\"}, {\"id\":...[{\"cast_id\": 5, \"character\": \"John Carter\", \"c...[{\"credit_id\": \"52fe479ac3a36847f813eaa3\", \"de...
\n", 875 | "
" 876 | ], 877 | "text/plain": [ 878 | " movie_id title \\\n", 879 | "0 19995 Avatar \n", 880 | "1 285 Pirates of the Caribbean: At World's End \n", 881 | "2 206647 Spectre \n", 882 | "3 49026 The Dark Knight Rises \n", 883 | "4 49529 John Carter \n", 884 | "\n", 885 | " overview \\\n", 886 | "0 In the 22nd century, a paraplegic Marine is di... \n", 887 | "1 Captain Barbossa, long believed to be dead, ha... \n", 888 | "2 A cryptic message from Bond’s past sends him o... \n", 889 | "3 Following the death of District Attorney Harve... \n", 890 | "4 John Carter is a war-weary, former military ca... \n", 891 | "\n", 892 | " genres \\\n", 893 | "0 [Action, Adventure, Fantasy, Science Fiction] \n", 894 | "1 [Adventure, Fantasy, Action] \n", 895 | "2 [Action, Adventure, Crime] \n", 896 | "3 [Action, Crime, Drama, Thriller] \n", 897 | "4 [Action, Adventure, Science Fiction] \n", 898 | "\n", 899 | " keywords \\\n", 900 | "0 [{\"id\": 1463, \"name\": \"culture clash\"}, {\"id\":... \n", 901 | "1 [{\"id\": 270, \"name\": \"ocean\"}, {\"id\": 726, \"na... \n", 902 | "2 [{\"id\": 470, \"name\": \"spy\"}, {\"id\": 818, \"name... \n", 903 | "3 [{\"id\": 849, \"name\": \"dc comics\"}, {\"id\": 853,... \n", 904 | "4 [{\"id\": 818, \"name\": \"based on novel\"}, {\"id\":... \n", 905 | "\n", 906 | " cast \\\n", 907 | "0 [{\"cast_id\": 242, \"character\": \"Jake Sully\", \"... \n", 908 | "1 [{\"cast_id\": 4, \"character\": \"Captain Jack Spa... \n", 909 | "2 [{\"cast_id\": 1, \"character\": \"James Bond\", \"cr... \n", 910 | "3 [{\"cast_id\": 2, \"character\": \"Bruce Wayne / Ba... \n", 911 | "4 [{\"cast_id\": 5, \"character\": \"John Carter\", \"c... \n", 912 | "\n", 913 | " crew \n", 914 | "0 [{\"credit_id\": \"52fe48009251416c750aca23\", \"de... \n", 915 | "1 [{\"credit_id\": \"52fe4232c3a36847f800b579\", \"de... \n", 916 | "2 [{\"credit_id\": \"54805967c3a36829b5002c41\", \"de... \n", 917 | "3 [{\"credit_id\": \"52fe4781c3a36847f81398c3\", \"de... \n", 918 | "4 [{\"credit_id\": \"52fe479ac3a36847f813eaa3\", \"de... " 919 | ] 920 | }, 921 | "execution_count": 170, 922 | "metadata": {}, 923 | "output_type": "execute_result" 924 | } 925 | ], 926 | "source": [ 927 | "movies.head()" 928 | ] 929 | }, 930 | { 931 | "cell_type": "code", 932 | "execution_count": 171, 933 | "metadata": {}, 934 | "outputs": [ 935 | { 936 | "data": { 937 | "text/plain": [ 938 | "'[{\"id\": 1463, \"name\": \"culture clash\"}, {\"id\": 2964, \"name\": \"future\"}, {\"id\": 3386, \"name\": \"space war\"}, {\"id\": 3388, \"name\": \"space colony\"}, {\"id\": 3679, \"name\": \"society\"}, {\"id\": 3801, \"name\": \"space travel\"}, {\"id\": 9685, \"name\": \"futuristic\"}, {\"id\": 9840, \"name\": \"romance\"}, {\"id\": 9882, \"name\": \"space\"}, {\"id\": 9951, \"name\": \"alien\"}, {\"id\": 10148, \"name\": \"tribe\"}, {\"id\": 10158, \"name\": \"alien planet\"}, {\"id\": 10987, \"name\": \"cgi\"}, {\"id\": 11399, \"name\": \"marine\"}, {\"id\": 13065, \"name\": \"soldier\"}, {\"id\": 14643, \"name\": \"battle\"}, {\"id\": 14720, \"name\": \"love affair\"}, {\"id\": 165431, \"name\": \"anti war\"}, {\"id\": 193554, \"name\": \"power relations\"}, {\"id\": 206690, \"name\": \"mind and soul\"}, {\"id\": 209714, \"name\": \"3d\"}]'" 939 | ] 940 | }, 941 | "execution_count": 171, 942 | "metadata": {}, 943 | "output_type": "execute_result" 944 | } 945 | ], 946 | "source": [ 947 | "# handle keywords\n", 948 | "movies.iloc[0]['keywords']" 949 | ] 950 | }, 951 | { 952 | "cell_type": "code", 953 | "execution_count": 172, 954 | "metadata": {}, 955 | "outputs": [ 956 | { 957 | "data": { 958 | "text/html": [ 959 | "
\n", 960 | "\n", 973 | "\n", 974 | " \n", 975 | " \n", 976 | " \n", 977 | " \n", 978 | " \n", 979 | " \n", 980 | " \n", 981 | " \n", 982 | " \n", 983 | " \n", 984 | " \n", 985 | " \n", 986 | " \n", 987 | " \n", 988 | " \n", 989 | " \n", 990 | " \n", 991 | " \n", 992 | " \n", 993 | " \n", 994 | " \n", 995 | " \n", 996 | " \n", 997 | " \n", 998 | " \n", 999 | " \n", 1000 | " \n", 1001 | " \n", 1002 | " \n", 1003 | " \n", 1004 | " \n", 1005 | " \n", 1006 | " \n", 1007 | " \n", 1008 | " \n", 1009 | " \n", 1010 | " \n", 1011 | " \n", 1012 | " \n", 1013 | " \n", 1014 | " \n", 1015 | " \n", 1016 | " \n", 1017 | " \n", 1018 | " \n", 1019 | " \n", 1020 | " \n", 1021 | " \n", 1022 | " \n", 1023 | " \n", 1024 | " \n", 1025 | " \n", 1026 | " \n", 1027 | " \n", 1028 | " \n", 1029 | " \n", 1030 | " \n", 1031 | " \n", 1032 | " \n", 1033 | " \n", 1034 | " \n", 1035 | " \n", 1036 | " \n", 1037 | " \n", 1038 | "
movie_idtitleoverviewgenreskeywordscastcrew
019995AvatarIn the 22nd century, a paraplegic Marine is di...[Action, Adventure, Fantasy, Science Fiction][culture clash, future, space war, space colon...[{\"cast_id\": 242, \"character\": \"Jake Sully\", \"...[{\"credit_id\": \"52fe48009251416c750aca23\", \"de...
1285Pirates of the Caribbean: At World's EndCaptain Barbossa, long believed to be dead, ha...[Adventure, Fantasy, Action][ocean, drug abuse, exotic island, east india ...[{\"cast_id\": 4, \"character\": \"Captain Jack Spa...[{\"credit_id\": \"52fe4232c3a36847f800b579\", \"de...
2206647SpectreA cryptic message from Bond’s past sends him o...[Action, Adventure, Crime][spy, based on novel, secret agent, sequel, mi...[{\"cast_id\": 1, \"character\": \"James Bond\", \"cr...[{\"credit_id\": \"54805967c3a36829b5002c41\", \"de...
349026The Dark Knight RisesFollowing the death of District Attorney Harve...[Action, Crime, Drama, Thriller][dc comics, crime fighter, terrorist, secret i...[{\"cast_id\": 2, \"character\": \"Bruce Wayne / Ba...[{\"credit_id\": \"52fe4781c3a36847f81398c3\", \"de...
449529John CarterJohn Carter is a war-weary, former military ca...[Action, Adventure, Science Fiction][based on novel, mars, medallion, space travel...[{\"cast_id\": 5, \"character\": \"John Carter\", \"c...[{\"credit_id\": \"52fe479ac3a36847f813eaa3\", \"de...
\n", 1039 | "
" 1040 | ], 1041 | "text/plain": [ 1042 | " movie_id title \\\n", 1043 | "0 19995 Avatar \n", 1044 | "1 285 Pirates of the Caribbean: At World's End \n", 1045 | "2 206647 Spectre \n", 1046 | "3 49026 The Dark Knight Rises \n", 1047 | "4 49529 John Carter \n", 1048 | "\n", 1049 | " overview \\\n", 1050 | "0 In the 22nd century, a paraplegic Marine is di... \n", 1051 | "1 Captain Barbossa, long believed to be dead, ha... \n", 1052 | "2 A cryptic message from Bond’s past sends him o... \n", 1053 | "3 Following the death of District Attorney Harve... \n", 1054 | "4 John Carter is a war-weary, former military ca... \n", 1055 | "\n", 1056 | " genres \\\n", 1057 | "0 [Action, Adventure, Fantasy, Science Fiction] \n", 1058 | "1 [Adventure, Fantasy, Action] \n", 1059 | "2 [Action, Adventure, Crime] \n", 1060 | "3 [Action, Crime, Drama, Thriller] \n", 1061 | "4 [Action, Adventure, Science Fiction] \n", 1062 | "\n", 1063 | " keywords \\\n", 1064 | "0 [culture clash, future, space war, space colon... \n", 1065 | "1 [ocean, drug abuse, exotic island, east india ... \n", 1066 | "2 [spy, based on novel, secret agent, sequel, mi... \n", 1067 | "3 [dc comics, crime fighter, terrorist, secret i... \n", 1068 | "4 [based on novel, mars, medallion, space travel... \n", 1069 | "\n", 1070 | " cast \\\n", 1071 | "0 [{\"cast_id\": 242, \"character\": \"Jake Sully\", \"... \n", 1072 | "1 [{\"cast_id\": 4, \"character\": \"Captain Jack Spa... \n", 1073 | "2 [{\"cast_id\": 1, \"character\": \"James Bond\", \"cr... \n", 1074 | "3 [{\"cast_id\": 2, \"character\": \"Bruce Wayne / Ba... \n", 1075 | "4 [{\"cast_id\": 5, \"character\": \"John Carter\", \"c... \n", 1076 | "\n", 1077 | " crew \n", 1078 | "0 [{\"credit_id\": \"52fe48009251416c750aca23\", \"de... \n", 1079 | "1 [{\"credit_id\": \"52fe4232c3a36847f800b579\", \"de... \n", 1080 | "2 [{\"credit_id\": \"54805967c3a36829b5002c41\", \"de... \n", 1081 | "3 [{\"credit_id\": \"52fe4781c3a36847f81398c3\", \"de... \n", 1082 | "4 [{\"credit_id\": \"52fe479ac3a36847f813eaa3\", \"de... " 1083 | ] 1084 | }, 1085 | "execution_count": 172, 1086 | "metadata": {}, 1087 | "output_type": "execute_result" 1088 | } 1089 | ], 1090 | "source": [ 1091 | "movies['keywords'] = movies['keywords'].apply(convert)\n", 1092 | "movies.head()" 1093 | ] 1094 | }, 1095 | { 1096 | "cell_type": "code", 1097 | "execution_count": 173, 1098 | "metadata": {}, 1099 | "outputs": [ 1100 | { 1101 | "data": { 1102 | "text/plain": [ 1103 | "'[{\"cast_id\": 242, \"character\": \"Jake Sully\", \"credit_id\": \"5602a8a7c3a3685532001c9a\", \"gender\": 2, \"id\": 65731, \"name\": \"Sam Worthington\", \"order\": 0}, {\"cast_id\": 3, \"character\": \"Neytiri\", \"credit_id\": \"52fe48009251416c750ac9cb\", \"gender\": 1, \"id\": 8691, \"name\": \"Zoe Saldana\", \"order\": 1}, {\"cast_id\": 25, \"character\": \"Dr. Grace Augustine\", \"credit_id\": \"52fe48009251416c750aca39\", \"gender\": 1, \"id\": 10205, \"name\": \"Sigourney Weaver\", \"order\": 2}, {\"cast_id\": 4, \"character\": \"Col. Quaritch\", \"credit_id\": \"52fe48009251416c750ac9cf\", \"gender\": 2, \"id\": 32747, \"name\": \"Stephen Lang\", \"order\": 3}, {\"cast_id\": 5, \"character\": \"Trudy Chacon\", \"credit_id\": \"52fe48009251416c750ac9d3\", \"gender\": 1, \"id\": 17647, \"name\": \"Michelle Rodriguez\", \"order\": 4}, {\"cast_id\": 8, \"character\": \"Selfridge\", \"credit_id\": \"52fe48009251416c750ac9e1\", \"gender\": 2, \"id\": 1771, \"name\": \"Giovanni Ribisi\", \"order\": 5}, {\"cast_id\": 7, \"character\": \"Norm Spellman\", \"credit_id\": \"52fe48009251416c750ac9dd\", \"gender\": 2, \"id\": 59231, \"name\": \"Joel David Moore\", \"order\": 6}, {\"cast_id\": 9, \"character\": \"Moat\", \"credit_id\": \"52fe48009251416c750ac9e5\", \"gender\": 1, \"id\": 30485, \"name\": \"CCH Pounder\", \"order\": 7}, {\"cast_id\": 11, \"character\": \"Eytukan\", \"credit_id\": \"52fe48009251416c750ac9ed\", \"gender\": 2, \"id\": 15853, \"name\": \"Wes Studi\", \"order\": 8}, {\"cast_id\": 10, \"character\": \"Tsu\\'Tey\", \"credit_id\": \"52fe48009251416c750ac9e9\", \"gender\": 2, \"id\": 10964, \"name\": \"Laz Alonso\", \"order\": 9}, {\"cast_id\": 12, \"character\": \"Dr. Max Patel\", \"credit_id\": \"52fe48009251416c750ac9f1\", \"gender\": 2, \"id\": 95697, \"name\": \"Dileep Rao\", \"order\": 10}, {\"cast_id\": 13, \"character\": \"Lyle Wainfleet\", \"credit_id\": \"52fe48009251416c750ac9f5\", \"gender\": 2, \"id\": 98215, \"name\": \"Matt Gerald\", \"order\": 11}, {\"cast_id\": 32, \"character\": \"Private Fike\", \"credit_id\": \"52fe48009251416c750aca5b\", \"gender\": 2, \"id\": 154153, \"name\": \"Sean Anthony Moran\", \"order\": 12}, {\"cast_id\": 33, \"character\": \"Cryo Vault Med Tech\", \"credit_id\": \"52fe48009251416c750aca5f\", \"gender\": 2, \"id\": 397312, \"name\": \"Jason Whyte\", \"order\": 13}, {\"cast_id\": 34, \"character\": \"Venture Star Crew Chief\", \"credit_id\": \"52fe48009251416c750aca63\", \"gender\": 2, \"id\": 42317, \"name\": \"Scott Lawrence\", \"order\": 14}, {\"cast_id\": 35, \"character\": \"Lock Up Trooper\", \"credit_id\": \"52fe48009251416c750aca67\", \"gender\": 2, \"id\": 986734, \"name\": \"Kelly Kilgour\", \"order\": 15}, {\"cast_id\": 36, \"character\": \"Shuttle Pilot\", \"credit_id\": \"52fe48009251416c750aca6b\", \"gender\": 0, \"id\": 1207227, \"name\": \"James Patrick Pitt\", \"order\": 16}, {\"cast_id\": 37, \"character\": \"Shuttle Co-Pilot\", \"credit_id\": \"52fe48009251416c750aca6f\", \"gender\": 0, \"id\": 1180936, \"name\": \"Sean Patrick Murphy\", \"order\": 17}, {\"cast_id\": 38, \"character\": \"Shuttle Crew Chief\", \"credit_id\": \"52fe48009251416c750aca73\", \"gender\": 2, \"id\": 1019578, \"name\": \"Peter Dillon\", \"order\": 18}, {\"cast_id\": 39, \"character\": \"Tractor Operator / Troupe\", \"credit_id\": \"52fe48009251416c750aca77\", \"gender\": 0, \"id\": 91443, \"name\": \"Kevin Dorman\", \"order\": 19}, {\"cast_id\": 40, \"character\": \"Dragon Gunship Pilot\", \"credit_id\": \"52fe48009251416c750aca7b\", \"gender\": 2, \"id\": 173391, \"name\": \"Kelson Henderson\", \"order\": 20}, {\"cast_id\": 41, \"character\": \"Dragon Gunship Gunner\", \"credit_id\": \"52fe48009251416c750aca7f\", \"gender\": 0, \"id\": 1207236, \"name\": \"David Van Horn\", \"order\": 21}, {\"cast_id\": 42, \"character\": \"Dragon Gunship Navigator\", \"credit_id\": \"52fe48009251416c750aca83\", \"gender\": 0, \"id\": 215913, \"name\": \"Jacob Tomuri\", \"order\": 22}, {\"cast_id\": 43, \"character\": \"Suit #1\", \"credit_id\": \"52fe48009251416c750aca87\", \"gender\": 0, \"id\": 143206, \"name\": \"Michael Blain-Rozgay\", \"order\": 23}, {\"cast_id\": 44, \"character\": \"Suit #2\", \"credit_id\": \"52fe48009251416c750aca8b\", \"gender\": 2, \"id\": 169676, \"name\": \"Jon Curry\", \"order\": 24}, {\"cast_id\": 46, \"character\": \"Ambient Room Tech\", \"credit_id\": \"52fe48009251416c750aca8f\", \"gender\": 0, \"id\": 1048610, \"name\": \"Luke Hawker\", \"order\": 25}, {\"cast_id\": 47, \"character\": \"Ambient Room Tech / Troupe\", \"credit_id\": \"52fe48009251416c750aca93\", \"gender\": 0, \"id\": 42288, \"name\": \"Woody Schultz\", \"order\": 26}, {\"cast_id\": 48, \"character\": \"Horse Clan Leader\", \"credit_id\": \"52fe48009251416c750aca97\", \"gender\": 2, \"id\": 68278, \"name\": \"Peter Mensah\", \"order\": 27}, {\"cast_id\": 49, \"character\": \"Link Room Tech\", \"credit_id\": \"52fe48009251416c750aca9b\", \"gender\": 0, \"id\": 1207247, \"name\": \"Sonia Yee\", \"order\": 28}, {\"cast_id\": 50, \"character\": \"Basketball Avatar / Troupe\", \"credit_id\": \"52fe48009251416c750aca9f\", \"gender\": 1, \"id\": 1207248, \"name\": \"Jahnel Curfman\", \"order\": 29}, {\"cast_id\": 51, \"character\": \"Basketball Avatar\", \"credit_id\": \"52fe48009251416c750acaa3\", \"gender\": 0, \"id\": 89714, \"name\": \"Ilram Choi\", \"order\": 30}, {\"cast_id\": 52, \"character\": \"Na\\'vi Child\", \"credit_id\": \"52fe48009251416c750acaa7\", \"gender\": 0, \"id\": 1207249, \"name\": \"Kyla Warren\", \"order\": 31}, {\"cast_id\": 53, \"character\": \"Troupe\", \"credit_id\": \"52fe48009251416c750acaab\", \"gender\": 0, \"id\": 1207250, \"name\": \"Lisa Roumain\", \"order\": 32}, {\"cast_id\": 54, \"character\": \"Troupe\", \"credit_id\": \"52fe48009251416c750acaaf\", \"gender\": 1, \"id\": 83105, \"name\": \"Debra Wilson\", \"order\": 33}, {\"cast_id\": 57, \"character\": \"Troupe\", \"credit_id\": \"52fe48009251416c750acabb\", \"gender\": 0, \"id\": 1207253, \"name\": \"Chris Mala\", \"order\": 34}, {\"cast_id\": 55, \"character\": \"Troupe\", \"credit_id\": \"52fe48009251416c750acab3\", \"gender\": 0, \"id\": 1207251, \"name\": \"Taylor Kibby\", \"order\": 35}, {\"cast_id\": 56, \"character\": \"Troupe\", \"credit_id\": \"52fe48009251416c750acab7\", \"gender\": 0, \"id\": 1207252, \"name\": \"Jodie Landau\", \"order\": 36}, {\"cast_id\": 58, \"character\": \"Troupe\", \"credit_id\": \"52fe48009251416c750acabf\", \"gender\": 0, \"id\": 1207254, \"name\": \"Julie Lamm\", \"order\": 37}, {\"cast_id\": 59, \"character\": \"Troupe\", \"credit_id\": \"52fe48009251416c750acac3\", \"gender\": 0, \"id\": 1207257, \"name\": \"Cullen B. Madden\", \"order\": 38}, {\"cast_id\": 60, \"character\": \"Troupe\", \"credit_id\": \"52fe48009251416c750acac7\", \"gender\": 0, \"id\": 1207259, \"name\": \"Joseph Brady Madden\", \"order\": 39}, {\"cast_id\": 61, \"character\": \"Troupe\", \"credit_id\": \"52fe48009251416c750acacb\", \"gender\": 0, \"id\": 1207262, \"name\": \"Frankie Torres\", \"order\": 40}, {\"cast_id\": 62, \"character\": \"Troupe\", \"credit_id\": \"52fe48009251416c750acacf\", \"gender\": 1, \"id\": 1158600, \"name\": \"Austin Wilson\", \"order\": 41}, {\"cast_id\": 63, \"character\": \"Troupe\", \"credit_id\": \"52fe48019251416c750acad3\", \"gender\": 1, \"id\": 983705, \"name\": \"Sara Wilson\", \"order\": 42}, {\"cast_id\": 64, \"character\": \"Troupe\", \"credit_id\": \"52fe48019251416c750acad7\", \"gender\": 0, \"id\": 1207263, \"name\": \"Tamica Washington-Miller\", \"order\": 43}, {\"cast_id\": 65, \"character\": \"Op Center Staff\", \"credit_id\": \"52fe48019251416c750acadb\", \"gender\": 1, \"id\": 1145098, \"name\": \"Lucy Briant\", \"order\": 44}, {\"cast_id\": 66, \"character\": \"Op Center Staff\", \"credit_id\": \"52fe48019251416c750acadf\", \"gender\": 2, \"id\": 33305, \"name\": \"Nathan Meister\", \"order\": 45}, {\"cast_id\": 67, \"character\": \"Op Center Staff\", \"credit_id\": \"52fe48019251416c750acae3\", \"gender\": 0, \"id\": 1207264, \"name\": \"Gerry Blair\", \"order\": 46}, {\"cast_id\": 68, \"character\": \"Op Center Staff\", \"credit_id\": \"52fe48019251416c750acae7\", \"gender\": 2, \"id\": 33311, \"name\": \"Matthew Chamberlain\", \"order\": 47}, {\"cast_id\": 69, \"character\": \"Op Center Staff\", \"credit_id\": \"52fe48019251416c750acaeb\", \"gender\": 0, \"id\": 1207265, \"name\": \"Paul Yates\", \"order\": 48}, {\"cast_id\": 70, \"character\": \"Op Center Duty Officer\", \"credit_id\": \"52fe48019251416c750acaef\", \"gender\": 0, \"id\": 1207266, \"name\": \"Wray Wilson\", \"order\": 49}, {\"cast_id\": 71, \"character\": \"Op Center Staff\", \"credit_id\": \"52fe48019251416c750acaf3\", \"gender\": 2, \"id\": 54492, \"name\": \"James Gaylyn\", \"order\": 50}, {\"cast_id\": 72, \"character\": \"Dancer\", \"credit_id\": \"52fe48019251416c750acaf7\", \"gender\": 0, \"id\": 1207267, \"name\": \"Melvin Leno Clark III\", \"order\": 51}, {\"cast_id\": 73, \"character\": \"Dancer\", \"credit_id\": \"52fe48019251416c750acafb\", \"gender\": 0, \"id\": 1207268, \"name\": \"Carvon Futrell\", \"order\": 52}, {\"cast_id\": 74, \"character\": \"Dancer\", \"credit_id\": \"52fe48019251416c750acaff\", \"gender\": 0, \"id\": 1207269, \"name\": \"Brandon Jelkes\", \"order\": 53}, {\"cast_id\": 75, \"character\": \"Dancer\", \"credit_id\": \"52fe48019251416c750acb03\", \"gender\": 0, \"id\": 1207270, \"name\": \"Micah Moch\", \"order\": 54}, {\"cast_id\": 76, \"character\": \"Dancer\", \"credit_id\": \"52fe48019251416c750acb07\", \"gender\": 0, \"id\": 1207271, \"name\": \"Hanniyah Muhammad\", \"order\": 55}, {\"cast_id\": 77, \"character\": \"Dancer\", \"credit_id\": \"52fe48019251416c750acb0b\", \"gender\": 0, \"id\": 1207272, \"name\": \"Christopher Nolen\", \"order\": 56}, {\"cast_id\": 78, \"character\": \"Dancer\", \"credit_id\": \"52fe48019251416c750acb0f\", \"gender\": 0, \"id\": 1207273, \"name\": \"Christa Oliver\", \"order\": 57}, {\"cast_id\": 79, \"character\": \"Dancer\", \"credit_id\": \"52fe48019251416c750acb13\", \"gender\": 0, \"id\": 1207274, \"name\": \"April Marie Thomas\", \"order\": 58}, {\"cast_id\": 80, \"character\": \"Dancer\", \"credit_id\": \"52fe48019251416c750acb17\", \"gender\": 0, \"id\": 1207275, \"name\": \"Bravita A. Threatt\", \"order\": 59}, {\"cast_id\": 81, \"character\": \"Mining Chief (uncredited)\", \"credit_id\": \"52fe48019251416c750acb1b\", \"gender\": 0, \"id\": 1207276, \"name\": \"Colin Bleasdale\", \"order\": 60}, {\"cast_id\": 82, \"character\": \"Veteran Miner (uncredited)\", \"credit_id\": \"52fe48019251416c750acb1f\", \"gender\": 0, \"id\": 107969, \"name\": \"Mike Bodnar\", \"order\": 61}, {\"cast_id\": 83, \"character\": \"Richard (uncredited)\", \"credit_id\": \"52fe48019251416c750acb23\", \"gender\": 0, \"id\": 1207278, \"name\": \"Matt Clayton\", \"order\": 62}, {\"cast_id\": 84, \"character\": \"Nav\\'i (uncredited)\", \"credit_id\": \"52fe48019251416c750acb27\", \"gender\": 1, \"id\": 147898, \"name\": \"Nicole Dionne\", \"order\": 63}, {\"cast_id\": 85, \"character\": \"Trooper (uncredited)\", \"credit_id\": \"52fe48019251416c750acb2b\", \"gender\": 0, \"id\": 1207280, \"name\": \"Jamie Harrison\", \"order\": 64}, {\"cast_id\": 86, \"character\": \"Trooper (uncredited)\", \"credit_id\": \"52fe48019251416c750acb2f\", \"gender\": 0, \"id\": 1207281, \"name\": \"Allan Henry\", \"order\": 65}, {\"cast_id\": 87, \"character\": \"Ground Technician (uncredited)\", \"credit_id\": \"52fe48019251416c750acb33\", \"gender\": 2, \"id\": 1207282, \"name\": \"Anthony Ingruber\", \"order\": 66}, {\"cast_id\": 88, \"character\": \"Flight Crew Mechanic (uncredited)\", \"credit_id\": \"52fe48019251416c750acb37\", \"gender\": 0, \"id\": 1207283, \"name\": \"Ashley Jeffery\", \"order\": 67}, {\"cast_id\": 14, \"character\": \"Samson Pilot\", \"credit_id\": \"52fe48009251416c750ac9f9\", \"gender\": 0, \"id\": 98216, \"name\": \"Dean Knowsley\", \"order\": 68}, {\"cast_id\": 89, \"character\": \"Trooper (uncredited)\", \"credit_id\": \"52fe48019251416c750acb3b\", \"gender\": 0, \"id\": 1201399, \"name\": \"Joseph Mika-Hunt\", \"order\": 69}, {\"cast_id\": 90, \"character\": \"Banshee (uncredited)\", \"credit_id\": \"52fe48019251416c750acb3f\", \"gender\": 0, \"id\": 236696, \"name\": \"Terry Notary\", \"order\": 70}, {\"cast_id\": 91, \"character\": \"Soldier (uncredited)\", \"credit_id\": \"52fe48019251416c750acb43\", \"gender\": 0, \"id\": 1207287, \"name\": \"Kai Pantano\", \"order\": 71}, {\"cast_id\": 92, \"character\": \"Blast Technician (uncredited)\", \"credit_id\": \"52fe48019251416c750acb47\", \"gender\": 0, \"id\": 1207288, \"name\": \"Logan Pithyou\", \"order\": 72}, {\"cast_id\": 93, \"character\": \"Vindum Raah (uncredited)\", \"credit_id\": \"52fe48019251416c750acb4b\", \"gender\": 0, \"id\": 1207289, \"name\": \"Stuart Pollock\", \"order\": 73}, {\"cast_id\": 94, \"character\": \"Hero (uncredited)\", \"credit_id\": \"52fe48019251416c750acb4f\", \"gender\": 0, \"id\": 584868, \"name\": \"Raja\", \"order\": 74}, {\"cast_id\": 95, \"character\": \"Ops Centreworker (uncredited)\", \"credit_id\": \"52fe48019251416c750acb53\", \"gender\": 0, \"id\": 1207290, \"name\": \"Gareth Ruck\", \"order\": 75}, {\"cast_id\": 96, \"character\": \"Engineer (uncredited)\", \"credit_id\": \"52fe48019251416c750acb57\", \"gender\": 0, \"id\": 1062463, \"name\": \"Rhian Sheehan\", \"order\": 76}, {\"cast_id\": 97, \"character\": \"Col. Quaritch\\'s Mech Suit (uncredited)\", \"credit_id\": \"52fe48019251416c750acb5b\", \"gender\": 0, \"id\": 60656, \"name\": \"T. J. Storm\", \"order\": 77}, {\"cast_id\": 98, \"character\": \"Female Marine (uncredited)\", \"credit_id\": \"52fe48019251416c750acb5f\", \"gender\": 0, \"id\": 1207291, \"name\": \"Jodie Taylor\", \"order\": 78}, {\"cast_id\": 99, \"character\": \"Ikran Clan Leader (uncredited)\", \"credit_id\": \"52fe48019251416c750acb63\", \"gender\": 1, \"id\": 1186027, \"name\": \"Alicia Vela-Bailey\", \"order\": 79}, {\"cast_id\": 100, \"character\": \"Geologist (uncredited)\", \"credit_id\": \"52fe48019251416c750acb67\", \"gender\": 0, \"id\": 1207292, \"name\": \"Richard Whiteside\", \"order\": 80}, {\"cast_id\": 101, \"character\": \"Na\\'vi (uncredited)\", \"credit_id\": \"52fe48019251416c750acb6b\", \"gender\": 0, \"id\": 103259, \"name\": \"Nikie Zambo\", \"order\": 81}, {\"cast_id\": 102, \"character\": \"Ambient Room Tech / Troupe\", \"credit_id\": \"52fe48019251416c750acb6f\", \"gender\": 1, \"id\": 42286, \"name\": \"Julene Renee\", \"order\": 82}]'" 1104 | ] 1105 | }, 1106 | "execution_count": 173, 1107 | "metadata": {}, 1108 | "output_type": "execute_result" 1109 | } 1110 | ], 1111 | "source": [ 1112 | "# handle cast\n", 1113 | "movies.iloc[0]['cast']" 1114 | ] 1115 | }, 1116 | { 1117 | "cell_type": "code", 1118 | "execution_count": 174, 1119 | "metadata": {}, 1120 | "outputs": [], 1121 | "source": [ 1122 | "# Here i am just keeping top 3 cast\n", 1123 | "\n", 1124 | "def convert_cast(text):\n", 1125 | " L = []\n", 1126 | " counter = 0\n", 1127 | " for i in ast.literal_eval(text):\n", 1128 | " if counter < 3:\n", 1129 | " L.append(i['name'])\n", 1130 | " counter+=1\n", 1131 | " return L" 1132 | ] 1133 | }, 1134 | { 1135 | "cell_type": "code", 1136 | "execution_count": 175, 1137 | "metadata": {}, 1138 | "outputs": [ 1139 | { 1140 | "data": { 1141 | "text/html": [ 1142 | "
\n", 1143 | "\n", 1156 | "\n", 1157 | " \n", 1158 | " \n", 1159 | " \n", 1160 | " \n", 1161 | " \n", 1162 | " \n", 1163 | " \n", 1164 | " \n", 1165 | " \n", 1166 | " \n", 1167 | " \n", 1168 | " \n", 1169 | " \n", 1170 | " \n", 1171 | " \n", 1172 | " \n", 1173 | " \n", 1174 | " \n", 1175 | " \n", 1176 | " \n", 1177 | " \n", 1178 | " \n", 1179 | " \n", 1180 | " \n", 1181 | " \n", 1182 | " \n", 1183 | " \n", 1184 | " \n", 1185 | " \n", 1186 | " \n", 1187 | " \n", 1188 | " \n", 1189 | " \n", 1190 | " \n", 1191 | " \n", 1192 | " \n", 1193 | " \n", 1194 | " \n", 1195 | " \n", 1196 | " \n", 1197 | " \n", 1198 | " \n", 1199 | " \n", 1200 | " \n", 1201 | " \n", 1202 | " \n", 1203 | " \n", 1204 | " \n", 1205 | " \n", 1206 | " \n", 1207 | " \n", 1208 | " \n", 1209 | " \n", 1210 | " \n", 1211 | " \n", 1212 | " \n", 1213 | " \n", 1214 | " \n", 1215 | " \n", 1216 | " \n", 1217 | " \n", 1218 | " \n", 1219 | " \n", 1220 | " \n", 1221 | "
movie_idtitleoverviewgenreskeywordscastcrew
019995AvatarIn the 22nd century, a paraplegic Marine is di...[Action, Adventure, Fantasy, Science Fiction][culture clash, future, space war, space colon...[Sam Worthington, Zoe Saldana, Sigourney Weaver][{\"credit_id\": \"52fe48009251416c750aca23\", \"de...
1285Pirates of the Caribbean: At World's EndCaptain Barbossa, long believed to be dead, ha...[Adventure, Fantasy, Action][ocean, drug abuse, exotic island, east india ...[Johnny Depp, Orlando Bloom, Keira Knightley][{\"credit_id\": \"52fe4232c3a36847f800b579\", \"de...
2206647SpectreA cryptic message from Bond’s past sends him o...[Action, Adventure, Crime][spy, based on novel, secret agent, sequel, mi...[Daniel Craig, Christoph Waltz, Léa Seydoux][{\"credit_id\": \"54805967c3a36829b5002c41\", \"de...
349026The Dark Knight RisesFollowing the death of District Attorney Harve...[Action, Crime, Drama, Thriller][dc comics, crime fighter, terrorist, secret i...[Christian Bale, Michael Caine, Gary Oldman][{\"credit_id\": \"52fe4781c3a36847f81398c3\", \"de...
449529John CarterJohn Carter is a war-weary, former military ca...[Action, Adventure, Science Fiction][based on novel, mars, medallion, space travel...[Taylor Kitsch, Lynn Collins, Samantha Morton][{\"credit_id\": \"52fe479ac3a36847f813eaa3\", \"de...
\n", 1222 | "
" 1223 | ], 1224 | "text/plain": [ 1225 | " movie_id title \\\n", 1226 | "0 19995 Avatar \n", 1227 | "1 285 Pirates of the Caribbean: At World's End \n", 1228 | "2 206647 Spectre \n", 1229 | "3 49026 The Dark Knight Rises \n", 1230 | "4 49529 John Carter \n", 1231 | "\n", 1232 | " overview \\\n", 1233 | "0 In the 22nd century, a paraplegic Marine is di... \n", 1234 | "1 Captain Barbossa, long believed to be dead, ha... \n", 1235 | "2 A cryptic message from Bond’s past sends him o... \n", 1236 | "3 Following the death of District Attorney Harve... \n", 1237 | "4 John Carter is a war-weary, former military ca... \n", 1238 | "\n", 1239 | " genres \\\n", 1240 | "0 [Action, Adventure, Fantasy, Science Fiction] \n", 1241 | "1 [Adventure, Fantasy, Action] \n", 1242 | "2 [Action, Adventure, Crime] \n", 1243 | "3 [Action, Crime, Drama, Thriller] \n", 1244 | "4 [Action, Adventure, Science Fiction] \n", 1245 | "\n", 1246 | " keywords \\\n", 1247 | "0 [culture clash, future, space war, space colon... \n", 1248 | "1 [ocean, drug abuse, exotic island, east india ... \n", 1249 | "2 [spy, based on novel, secret agent, sequel, mi... \n", 1250 | "3 [dc comics, crime fighter, terrorist, secret i... \n", 1251 | "4 [based on novel, mars, medallion, space travel... \n", 1252 | "\n", 1253 | " cast \\\n", 1254 | "0 [Sam Worthington, Zoe Saldana, Sigourney Weaver] \n", 1255 | "1 [Johnny Depp, Orlando Bloom, Keira Knightley] \n", 1256 | "2 [Daniel Craig, Christoph Waltz, Léa Seydoux] \n", 1257 | "3 [Christian Bale, Michael Caine, Gary Oldman] \n", 1258 | "4 [Taylor Kitsch, Lynn Collins, Samantha Morton] \n", 1259 | "\n", 1260 | " crew \n", 1261 | "0 [{\"credit_id\": \"52fe48009251416c750aca23\", \"de... \n", 1262 | "1 [{\"credit_id\": \"52fe4232c3a36847f800b579\", \"de... \n", 1263 | "2 [{\"credit_id\": \"54805967c3a36829b5002c41\", \"de... \n", 1264 | "3 [{\"credit_id\": \"52fe4781c3a36847f81398c3\", \"de... \n", 1265 | "4 [{\"credit_id\": \"52fe479ac3a36847f813eaa3\", \"de... " 1266 | ] 1267 | }, 1268 | "execution_count": 175, 1269 | "metadata": {}, 1270 | "output_type": "execute_result" 1271 | } 1272 | ], 1273 | "source": [ 1274 | "movies['cast'] = movies['cast'].apply(convert_cast)\n", 1275 | "movies.head()" 1276 | ] 1277 | }, 1278 | { 1279 | "cell_type": "code", 1280 | "execution_count": 176, 1281 | "metadata": {}, 1282 | "outputs": [ 1283 | { 1284 | "data": { 1285 | "text/plain": [ 1286 | "'[{\"credit_id\": \"52fe48009251416c750aca23\", \"department\": \"Editing\", \"gender\": 0, \"id\": 1721, \"job\": \"Editor\", \"name\": \"Stephen E. Rivkin\"}, {\"credit_id\": \"539c47ecc3a36810e3001f87\", \"department\": \"Art\", \"gender\": 2, \"id\": 496, \"job\": \"Production Design\", \"name\": \"Rick Carter\"}, {\"credit_id\": \"54491c89c3a3680fb4001cf7\", \"department\": \"Sound\", \"gender\": 0, \"id\": 900, \"job\": \"Sound Designer\", \"name\": \"Christopher Boyes\"}, {\"credit_id\": \"54491cb70e0a267480001bd0\", \"department\": \"Sound\", \"gender\": 0, \"id\": 900, \"job\": \"Supervising Sound Editor\", \"name\": \"Christopher Boyes\"}, {\"credit_id\": \"539c4a4cc3a36810c9002101\", \"department\": \"Production\", \"gender\": 1, \"id\": 1262, \"job\": \"Casting\", \"name\": \"Mali Finn\"}, {\"credit_id\": \"5544ee3b925141499f0008fc\", \"department\": \"Sound\", \"gender\": 2, \"id\": 1729, \"job\": \"Original Music Composer\", \"name\": \"James Horner\"}, {\"credit_id\": \"52fe48009251416c750ac9c3\", \"department\": \"Directing\", \"gender\": 2, \"id\": 2710, \"job\": \"Director\", \"name\": \"James Cameron\"}, {\"credit_id\": \"52fe48009251416c750ac9d9\", \"department\": \"Writing\", \"gender\": 2, \"id\": 2710, \"job\": \"Writer\", \"name\": \"James Cameron\"}, {\"credit_id\": \"52fe48009251416c750aca17\", \"department\": \"Editing\", \"gender\": 2, \"id\": 2710, \"job\": \"Editor\", \"name\": \"James Cameron\"}, {\"credit_id\": \"52fe48009251416c750aca29\", \"department\": \"Production\", \"gender\": 2, \"id\": 2710, \"job\": \"Producer\", \"name\": \"James Cameron\"}, {\"credit_id\": \"52fe48009251416c750aca3f\", \"department\": \"Writing\", \"gender\": 2, \"id\": 2710, \"job\": \"Screenplay\", \"name\": \"James Cameron\"}, {\"credit_id\": \"539c4987c3a36810ba0021a4\", \"department\": \"Art\", \"gender\": 2, \"id\": 7236, \"job\": \"Art Direction\", \"name\": \"Andrew Menzies\"}, {\"credit_id\": \"549598c3c3a3686ae9004383\", \"department\": \"Visual Effects\", \"gender\": 0, \"id\": 6690, \"job\": \"Visual Effects Producer\", \"name\": \"Jill Brooks\"}, {\"credit_id\": \"52fe48009251416c750aca4b\", \"department\": \"Production\", \"gender\": 1, \"id\": 6347, \"job\": \"Casting\", \"name\": \"Margery Simkin\"}, {\"credit_id\": \"570b6f419251417da70032fe\", \"department\": \"Art\", \"gender\": 2, \"id\": 6878, \"job\": \"Supervising Art Director\", \"name\": \"Kevin Ishioka\"}, {\"credit_id\": \"5495a0fac3a3686ae9004468\", \"department\": \"Sound\", \"gender\": 0, \"id\": 6883, \"job\": \"Music Editor\", \"name\": \"Dick Bernstein\"}, {\"credit_id\": \"54959706c3a3686af3003e81\", \"department\": \"Sound\", \"gender\": 0, \"id\": 8159, \"job\": \"Sound Effects Editor\", \"name\": \"Shannon Mills\"}, {\"credit_id\": \"54491d58c3a3680fb1001ccb\", \"department\": \"Sound\", \"gender\": 0, \"id\": 8160, \"job\": \"Foley\", \"name\": \"Dennie Thorpe\"}, {\"credit_id\": \"54491d6cc3a3680fa5001b2c\", \"department\": \"Sound\", \"gender\": 0, \"id\": 8163, \"job\": \"Foley\", \"name\": \"Jana Vance\"}, {\"credit_id\": \"52fe48009251416c750aca57\", \"department\": \"Costume & Make-Up\", \"gender\": 1, \"id\": 8527, \"job\": \"Costume Design\", \"name\": \"Deborah Lynn Scott\"}, {\"credit_id\": \"52fe48009251416c750aca2f\", \"department\": \"Production\", \"gender\": 2, \"id\": 8529, \"job\": \"Producer\", \"name\": \"Jon Landau\"}, {\"credit_id\": \"539c4937c3a36810ba002194\", \"department\": \"Art\", \"gender\": 0, \"id\": 9618, \"job\": \"Art Direction\", \"name\": \"Sean Haworth\"}, {\"credit_id\": \"539c49b6c3a36810c10020e6\", \"department\": \"Art\", \"gender\": 1, \"id\": 12653, \"job\": \"Set Decoration\", \"name\": \"Kim Sinclair\"}, {\"credit_id\": \"570b6f2f9251413a0e00020d\", \"department\": \"Art\", \"gender\": 1, \"id\": 12653, \"job\": \"Supervising Art Director\", \"name\": \"Kim Sinclair\"}, {\"credit_id\": \"54491a6c0e0a26748c001b19\", \"department\": \"Art\", \"gender\": 2, \"id\": 14350, \"job\": \"Set Designer\", \"name\": \"Richard F. Mays\"}, {\"credit_id\": \"56928cf4c3a3684cff0025c4\", \"department\": \"Production\", \"gender\": 1, \"id\": 20294, \"job\": \"Executive Producer\", \"name\": \"Laeta Kalogridis\"}, {\"credit_id\": \"52fe48009251416c750aca51\", \"department\": \"Costume & Make-Up\", \"gender\": 0, \"id\": 17675, \"job\": \"Costume Design\", \"name\": \"Mayes C. Rubeo\"}, {\"credit_id\": \"52fe48009251416c750aca11\", \"department\": \"Camera\", \"gender\": 2, \"id\": 18265, \"job\": \"Director of Photography\", \"name\": \"Mauro Fiore\"}, {\"credit_id\": \"5449194d0e0a26748f001b39\", \"department\": \"Art\", \"gender\": 0, \"id\": 42281, \"job\": \"Set Designer\", \"name\": \"Scott Herbertson\"}, {\"credit_id\": \"52fe48009251416c750aca05\", \"department\": \"Crew\", \"gender\": 0, \"id\": 42288, \"job\": \"Stunts\", \"name\": \"Woody Schultz\"}, {\"credit_id\": \"5592aefb92514152de0010f5\", \"department\": \"Costume & Make-Up\", \"gender\": 0, \"id\": 29067, \"job\": \"Makeup Artist\", \"name\": \"Linda DeVetta\"}, {\"credit_id\": \"5592afa492514152de00112c\", \"department\": \"Costume & Make-Up\", \"gender\": 0, \"id\": 29067, \"job\": \"Hairstylist\", \"name\": \"Linda DeVetta\"}, {\"credit_id\": \"54959ed592514130fc002e5d\", \"department\": \"Camera\", \"gender\": 2, \"id\": 33302, \"job\": \"Camera Operator\", \"name\": \"Richard Bluck\"}, {\"credit_id\": \"539c4891c3a36810ba002147\", \"department\": \"Art\", \"gender\": 2, \"id\": 33303, \"job\": \"Art Direction\", \"name\": \"Simon Bright\"}, {\"credit_id\": \"54959c069251417a81001f3a\", \"department\": \"Visual Effects\", \"gender\": 0, \"id\": 113145, \"job\": \"Visual Effects Supervisor\", \"name\": \"Richard Martin\"}, {\"credit_id\": \"54959a0dc3a3680ff5002c8d\", \"department\": \"Crew\", \"gender\": 2, \"id\": 58188, \"job\": \"Visual Effects Editor\", \"name\": \"Steve R. Moore\"}, {\"credit_id\": \"52fe48009251416c750aca1d\", \"department\": \"Editing\", \"gender\": 2, \"id\": 58871, \"job\": \"Editor\", \"name\": \"John Refoua\"}, {\"credit_id\": \"54491a4dc3a3680fc30018ca\", \"department\": \"Art\", \"gender\": 0, \"id\": 92359, \"job\": \"Set Designer\", \"name\": \"Karl J. Martin\"}, {\"credit_id\": \"52fe48009251416c750aca35\", \"department\": \"Camera\", \"gender\": 1, \"id\": 72201, \"job\": \"Director of Photography\", \"name\": \"Chiling Lin\"}, {\"credit_id\": \"52fe48009251416c750ac9ff\", \"department\": \"Crew\", \"gender\": 0, \"id\": 89714, \"job\": \"Stunts\", \"name\": \"Ilram Choi\"}, {\"credit_id\": \"54959c529251416e2b004394\", \"department\": \"Visual Effects\", \"gender\": 2, \"id\": 93214, \"job\": \"Visual Effects Supervisor\", \"name\": \"Steven Quale\"}, {\"credit_id\": \"54491edf0e0a267489001c37\", \"department\": \"Crew\", \"gender\": 1, \"id\": 122607, \"job\": \"Dialect Coach\", \"name\": \"Carla Meyer\"}, {\"credit_id\": \"539c485bc3a368653d001a3a\", \"department\": \"Art\", \"gender\": 2, \"id\": 132585, \"job\": \"Art Direction\", \"name\": \"Nick Bassett\"}, {\"credit_id\": \"539c4903c3a368653d001a74\", \"department\": \"Art\", \"gender\": 0, \"id\": 132596, \"job\": \"Art Direction\", \"name\": \"Jill Cormack\"}, {\"credit_id\": \"539c4967c3a368653d001a94\", \"department\": \"Art\", \"gender\": 0, \"id\": 132604, \"job\": \"Art Direction\", \"name\": \"Andy McLaren\"}, {\"credit_id\": \"52fe48009251416c750aca45\", \"department\": \"Crew\", \"gender\": 0, \"id\": 236696, \"job\": \"Motion Capture Artist\", \"name\": \"Terry Notary\"}, {\"credit_id\": \"54959e02c3a3680fc60027d2\", \"department\": \"Crew\", \"gender\": 2, \"id\": 956198, \"job\": \"Stunt Coordinator\", \"name\": \"Garrett Warren\"}, {\"credit_id\": \"54959ca3c3a3686ae300438c\", \"department\": \"Visual Effects\", \"gender\": 2, \"id\": 957874, \"job\": \"Visual Effects Supervisor\", \"name\": \"Jonathan Rothbart\"}, {\"credit_id\": \"570b6f519251412c74001b2f\", \"department\": \"Art\", \"gender\": 0, \"id\": 957889, \"job\": \"Supervising Art Director\", \"name\": \"Stefan Dechant\"}, {\"credit_id\": \"570b6f62c3a3680b77007460\", \"department\": \"Art\", \"gender\": 2, \"id\": 959555, \"job\": \"Supervising Art Director\", \"name\": \"Todd Cherniawsky\"}, {\"credit_id\": \"539c4a3ac3a36810da0021cc\", \"department\": \"Production\", \"gender\": 0, \"id\": 1016177, \"job\": \"Casting\", \"name\": \"Miranda Rivers\"}, {\"credit_id\": \"539c482cc3a36810c1002062\", \"department\": \"Art\", \"gender\": 0, \"id\": 1032536, \"job\": \"Production Design\", \"name\": \"Robert Stromberg\"}, {\"credit_id\": \"539c4b65c3a36810c9002125\", \"department\": \"Costume & Make-Up\", \"gender\": 2, \"id\": 1071680, \"job\": \"Costume Design\", \"name\": \"John Harding\"}, {\"credit_id\": \"54959e6692514130fc002e4e\", \"department\": \"Camera\", \"gender\": 0, \"id\": 1177364, \"job\": \"Steadicam Operator\", \"name\": \"Roberto De Angelis\"}, {\"credit_id\": \"539c49f1c3a368653d001aac\", \"department\": \"Costume & Make-Up\", \"gender\": 2, \"id\": 1202850, \"job\": \"Makeup Department Head\", \"name\": \"Mike Smithson\"}, {\"credit_id\": \"5495999ec3a3686ae100460c\", \"department\": \"Visual Effects\", \"gender\": 0, \"id\": 1204668, \"job\": \"Visual Effects Producer\", \"name\": \"Alain Lalanne\"}, {\"credit_id\": \"54959cdfc3a3681153002729\", \"department\": \"Visual Effects\", \"gender\": 0, \"id\": 1206410, \"job\": \"Visual Effects Supervisor\", \"name\": \"Lucas Salton\"}, {\"credit_id\": \"549596239251417a81001eae\", \"department\": \"Crew\", \"gender\": 0, \"id\": 1234266, \"job\": \"Post Production Supervisor\", \"name\": \"Janace Tashjian\"}, {\"credit_id\": \"54959c859251416e1e003efe\", \"department\": \"Visual Effects\", \"gender\": 0, \"id\": 1271932, \"job\": \"Visual Effects Supervisor\", \"name\": \"Stephen Rosenbaum\"}, {\"credit_id\": \"5592af28c3a368775a00105f\", \"department\": \"Costume & Make-Up\", \"gender\": 0, \"id\": 1310064, \"job\": \"Makeup Artist\", \"name\": \"Frankie Karena\"}, {\"credit_id\": \"539c4adfc3a36810e300203b\", \"department\": \"Costume & Make-Up\", \"gender\": 1, \"id\": 1319844, \"job\": \"Costume Supervisor\", \"name\": \"Lisa Lovaas\"}, {\"credit_id\": \"54959b579251416e2b004371\", \"department\": \"Visual Effects\", \"gender\": 0, \"id\": 1327028, \"job\": \"Visual Effects Supervisor\", \"name\": \"Jonathan Fawkner\"}, {\"credit_id\": \"539c48a7c3a36810b5001fa7\", \"department\": \"Art\", \"gender\": 0, \"id\": 1330561, \"job\": \"Art Direction\", \"name\": \"Robert Bavin\"}, {\"credit_id\": \"539c4a71c3a36810da0021e0\", \"department\": \"Costume & Make-Up\", \"gender\": 0, \"id\": 1330567, \"job\": \"Costume Supervisor\", \"name\": \"Anthony Almaraz\"}, {\"credit_id\": \"539c4a8ac3a36810ba0021e4\", \"department\": \"Costume & Make-Up\", \"gender\": 0, \"id\": 1330570, \"job\": \"Costume Supervisor\", \"name\": \"Carolyn M. Fenton\"}, {\"credit_id\": \"539c4ab6c3a36810da0021f0\", \"department\": \"Costume & Make-Up\", \"gender\": 0, \"id\": 1330574, \"job\": \"Costume Supervisor\", \"name\": \"Beth Koenigsberg\"}, {\"credit_id\": \"54491ab70e0a267480001ba2\", \"department\": \"Art\", \"gender\": 0, \"id\": 1336191, \"job\": \"Set Designer\", \"name\": \"Sam Page\"}, {\"credit_id\": \"544919d9c3a3680fc30018bd\", \"department\": \"Art\", \"gender\": 0, \"id\": 1339441, \"job\": \"Set Designer\", \"name\": \"Tex Kadonaga\"}, {\"credit_id\": \"54491cf50e0a267483001b0c\", \"department\": \"Editing\", \"gender\": 0, \"id\": 1352422, \"job\": \"Dialogue Editor\", \"name\": \"Kim Foscato\"}, {\"credit_id\": \"544919f40e0a26748c001b09\", \"department\": \"Art\", \"gender\": 0, \"id\": 1352962, \"job\": \"Set Designer\", \"name\": \"Tammy S. Lee\"}, {\"credit_id\": \"5495a115c3a3680ff5002d71\", \"department\": \"Crew\", \"gender\": 0, \"id\": 1357070, \"job\": \"Transportation Coordinator\", \"name\": \"Denny Caira\"}, {\"credit_id\": \"5495a12f92514130fc002e94\", \"department\": \"Crew\", \"gender\": 0, \"id\": 1357071, \"job\": \"Transportation Coordinator\", \"name\": \"James Waitkus\"}, {\"credit_id\": \"5495976fc3a36811530026b0\", \"department\": \"Sound\", \"gender\": 0, \"id\": 1360103, \"job\": \"Supervising Sound Editor\", \"name\": \"Addison Teague\"}, {\"credit_id\": \"54491837c3a3680fb1001c5a\", \"department\": \"Art\", \"gender\": 2, \"id\": 1376887, \"job\": \"Set Designer\", \"name\": \"C. Scott Baker\"}, {\"credit_id\": \"54491878c3a3680fb4001c9d\", \"department\": \"Art\", \"gender\": 0, \"id\": 1376888, \"job\": \"Set Designer\", \"name\": \"Luke Caska\"}, {\"credit_id\": \"544918dac3a3680fa5001ae0\", \"department\": \"Art\", \"gender\": 0, \"id\": 1376889, \"job\": \"Set Designer\", \"name\": \"David Chow\"}, {\"credit_id\": \"544919110e0a267486001b68\", \"department\": \"Art\", \"gender\": 0, \"id\": 1376890, \"job\": \"Set Designer\", \"name\": \"Jonathan Dyer\"}, {\"credit_id\": \"54491967c3a3680faa001b5e\", \"department\": \"Art\", \"gender\": 0, \"id\": 1376891, \"job\": \"Set Designer\", \"name\": \"Joseph Hiura\"}, {\"credit_id\": \"54491997c3a3680fb1001c8a\", \"department\": \"Art\", \"gender\": 0, \"id\": 1376892, \"job\": \"Art Department Coordinator\", \"name\": \"Rebecca Jellie\"}, {\"credit_id\": \"544919ba0e0a26748f001b42\", \"department\": \"Art\", \"gender\": 0, \"id\": 1376893, \"job\": \"Set Designer\", \"name\": \"Robert Andrew Johnson\"}, {\"credit_id\": \"54491b1dc3a3680faa001b8c\", \"department\": \"Art\", \"gender\": 0, \"id\": 1376895, \"job\": \"Assistant Art Director\", \"name\": \"Mike Stassi\"}, {\"credit_id\": \"54491b79c3a3680fbb001826\", \"department\": \"Art\", \"gender\": 0, \"id\": 1376897, \"job\": \"Construction Coordinator\", \"name\": \"John Villarino\"}, {\"credit_id\": \"54491baec3a3680fb4001ce6\", \"department\": \"Art\", \"gender\": 2, \"id\": 1376898, \"job\": \"Assistant Art Director\", \"name\": \"Jeffrey Wisniewski\"}, {\"credit_id\": \"54491d2fc3a3680fb4001d07\", \"department\": \"Editing\", \"gender\": 0, \"id\": 1376899, \"job\": \"Dialogue Editor\", \"name\": \"Cheryl Nardi\"}, {\"credit_id\": \"54491d86c3a3680fa5001b2f\", \"department\": \"Editing\", \"gender\": 0, \"id\": 1376901, \"job\": \"Dialogue Editor\", \"name\": \"Marshall Winn\"}, {\"credit_id\": \"54491d9dc3a3680faa001bb0\", \"department\": \"Sound\", \"gender\": 0, \"id\": 1376902, \"job\": \"Supervising Sound Editor\", \"name\": \"Gwendolyn Yates Whittle\"}, {\"credit_id\": \"54491dc10e0a267486001bce\", \"department\": \"Sound\", \"gender\": 0, \"id\": 1376903, \"job\": \"Sound Re-Recording Mixer\", \"name\": \"William Stein\"}, {\"credit_id\": \"54491f500e0a26747c001c07\", \"department\": \"Crew\", \"gender\": 0, \"id\": 1376909, \"job\": \"Choreographer\", \"name\": \"Lula Washington\"}, {\"credit_id\": \"549599239251412c4e002a2e\", \"department\": \"Visual Effects\", \"gender\": 0, \"id\": 1391692, \"job\": \"Visual Effects Producer\", \"name\": \"Chris Del Conte\"}, {\"credit_id\": \"54959d54c3a36831b8001d9a\", \"department\": \"Visual Effects\", \"gender\": 2, \"id\": 1391695, \"job\": \"Visual Effects Supervisor\", \"name\": \"R. Christopher White\"}, {\"credit_id\": \"54959bdf9251412c4e002a66\", \"department\": \"Visual Effects\", \"gender\": 0, \"id\": 1394070, \"job\": \"Visual Effects Supervisor\", \"name\": \"Dan Lemmon\"}, {\"credit_id\": \"5495971d92514132ed002922\", \"department\": \"Sound\", \"gender\": 0, \"id\": 1394129, \"job\": \"Sound Effects Editor\", \"name\": \"Tim Nielsen\"}, {\"credit_id\": \"5592b25792514152cc0011aa\", \"department\": \"Crew\", \"gender\": 0, \"id\": 1394286, \"job\": \"CG Supervisor\", \"name\": \"Michael Mulholland\"}, {\"credit_id\": \"54959a329251416e2b004355\", \"department\": \"Crew\", \"gender\": 0, \"id\": 1394750, \"job\": \"Visual Effects Editor\", \"name\": \"Thomas Nittmann\"}, {\"credit_id\": \"54959d6dc3a3686ae9004401\", \"department\": \"Visual Effects\", \"gender\": 0, \"id\": 1394755, \"job\": \"Visual Effects Supervisor\", \"name\": \"Edson Williams\"}, {\"credit_id\": \"5495a08fc3a3686ae300441c\", \"department\": \"Editing\", \"gender\": 0, \"id\": 1394953, \"job\": \"Digital Intermediate\", \"name\": \"Christine Carr\"}, {\"credit_id\": \"55402d659251413d6d000249\", \"department\": \"Visual Effects\", \"gender\": 0, \"id\": 1395269, \"job\": \"Visual Effects Supervisor\", \"name\": \"John Bruno\"}, {\"credit_id\": \"54959e7b9251416e1e003f3e\", \"department\": \"Camera\", \"gender\": 0, \"id\": 1398970, \"job\": \"Steadicam Operator\", \"name\": \"David Emmerichs\"}, {\"credit_id\": \"54959734c3a3686ae10045e0\", \"department\": \"Sound\", \"gender\": 0, \"id\": 1400906, \"job\": \"Sound Effects Editor\", \"name\": \"Christopher Scarabosio\"}, {\"credit_id\": \"549595dd92514130fc002d79\", \"department\": \"Production\", \"gender\": 0, \"id\": 1401784, \"job\": \"Production Supervisor\", \"name\": \"Jennifer Teves\"}, {\"credit_id\": \"549596009251413af70028cc\", \"department\": \"Production\", \"gender\": 0, \"id\": 1401785, \"job\": \"Production Manager\", \"name\": \"Brigitte Yorke\"}, {\"credit_id\": \"549596e892514130fc002d99\", \"department\": \"Sound\", \"gender\": 0, \"id\": 1401786, \"job\": \"Sound Effects Editor\", \"name\": \"Ken Fischer\"}, {\"credit_id\": \"549598229251412c4e002a1c\", \"department\": \"Crew\", \"gender\": 0, \"id\": 1401787, \"job\": \"Special Effects Coordinator\", \"name\": \"Iain Hutton\"}, {\"credit_id\": \"549598349251416e2b00432b\", \"department\": \"Crew\", \"gender\": 0, \"id\": 1401788, \"job\": \"Special Effects Coordinator\", \"name\": \"Steve Ingram\"}, {\"credit_id\": \"54959905c3a3686ae3004324\", \"department\": \"Visual Effects\", \"gender\": 0, \"id\": 1401789, \"job\": \"Visual Effects Producer\", \"name\": \"Joyce Cox\"}, {\"credit_id\": \"5495994b92514132ed002951\", \"department\": \"Visual Effects\", \"gender\": 0, \"id\": 1401790, \"job\": \"Visual Effects Producer\", \"name\": \"Jenny Foster\"}, {\"credit_id\": \"549599cbc3a3686ae1004613\", \"department\": \"Crew\", \"gender\": 0, \"id\": 1401791, \"job\": \"Visual Effects Editor\", \"name\": \"Christopher Marino\"}, {\"credit_id\": \"549599f2c3a3686ae100461e\", \"department\": \"Crew\", \"gender\": 0, \"id\": 1401792, \"job\": \"Visual Effects Editor\", \"name\": \"Jim Milton\"}, {\"credit_id\": \"54959a51c3a3686af3003eb5\", \"department\": \"Visual Effects\", \"gender\": 0, \"id\": 1401793, \"job\": \"Visual Effects Producer\", \"name\": \"Cyndi Ochs\"}, {\"credit_id\": \"54959a7cc3a36811530026f4\", \"department\": \"Crew\", \"gender\": 0, \"id\": 1401794, \"job\": \"Visual Effects Editor\", \"name\": \"Lucas Putnam\"}, {\"credit_id\": \"54959b91c3a3680ff5002cb4\", \"department\": \"Visual Effects\", \"gender\": 0, \"id\": 1401795, \"job\": \"Visual Effects Supervisor\", \"name\": \"Anthony \\'Max\\' Ivins\"}, {\"credit_id\": \"54959bb69251412c4e002a5f\", \"department\": \"Visual Effects\", \"gender\": 0, \"id\": 1401796, \"job\": \"Visual Effects Supervisor\", \"name\": \"John Knoll\"}, {\"credit_id\": \"54959cbbc3a3686ae3004391\", \"department\": \"Visual Effects\", \"gender\": 2, \"id\": 1401799, \"job\": \"Visual Effects Supervisor\", \"name\": \"Eric Saindon\"}, {\"credit_id\": \"54959d06c3a3686ae90043f6\", \"department\": \"Visual Effects\", \"gender\": 0, \"id\": 1401800, \"job\": \"Visual Effects Supervisor\", \"name\": \"Wayne Stables\"}, {\"credit_id\": \"54959d259251416e1e003f11\", \"department\": \"Visual Effects\", \"gender\": 0, \"id\": 1401801, \"job\": \"Visual Effects Supervisor\", \"name\": \"David Stinnett\"}, {\"credit_id\": \"54959db49251413af7002975\", \"department\": \"Visual Effects\", \"gender\": 0, \"id\": 1401803, \"job\": \"Visual Effects Supervisor\", \"name\": \"Guy Williams\"}, {\"credit_id\": \"54959de4c3a3681153002750\", \"department\": \"Crew\", \"gender\": 0, \"id\": 1401804, \"job\": \"Stunt Coordinator\", \"name\": \"Stuart Thorp\"}, {\"credit_id\": \"54959ef2c3a3680fc60027f2\", \"department\": \"Lighting\", \"gender\": 0, \"id\": 1401805, \"job\": \"Best Boy Electric\", \"name\": \"Giles Coburn\"}, {\"credit_id\": \"54959f07c3a3680fc60027f9\", \"department\": \"Camera\", \"gender\": 2, \"id\": 1401806, \"job\": \"Still Photographer\", \"name\": \"Mark Fellman\"}, {\"credit_id\": \"54959f47c3a3681153002774\", \"department\": \"Lighting\", \"gender\": 0, \"id\": 1401807, \"job\": \"Lighting Technician\", \"name\": \"Scott Sprague\"}, {\"credit_id\": \"54959f8cc3a36831b8001df2\", \"department\": \"Visual Effects\", \"gender\": 0, \"id\": 1401808, \"job\": \"Animation Director\", \"name\": \"Jeremy Hollobon\"}, {\"credit_id\": \"54959fa0c3a36831b8001dfb\", \"department\": \"Visual Effects\", \"gender\": 0, \"id\": 1401809, \"job\": \"Animation Director\", \"name\": \"Orlando Meunier\"}, {\"credit_id\": \"54959fb6c3a3686af3003f54\", \"department\": \"Visual Effects\", \"gender\": 0, \"id\": 1401810, \"job\": \"Animation Director\", \"name\": \"Taisuke Tanimura\"}, {\"credit_id\": \"54959fd2c3a36831b8001e02\", \"department\": \"Costume & Make-Up\", \"gender\": 0, \"id\": 1401812, \"job\": \"Set Costumer\", \"name\": \"Lilia Mishel Acevedo\"}, {\"credit_id\": \"54959ff9c3a3686ae300440c\", \"department\": \"Costume & Make-Up\", \"gender\": 0, \"id\": 1401814, \"job\": \"Set Costumer\", \"name\": \"Alejandro M. Hernandez\"}, {\"credit_id\": \"5495a0ddc3a3686ae10046fe\", \"department\": \"Editing\", \"gender\": 0, \"id\": 1401815, \"job\": \"Digital Intermediate\", \"name\": \"Marvin Hall\"}, {\"credit_id\": \"5495a1f7c3a3686ae3004443\", \"department\": \"Production\", \"gender\": 0, \"id\": 1401816, \"job\": \"Publicist\", \"name\": \"Judy Alley\"}, {\"credit_id\": \"5592b29fc3a36869d100002f\", \"department\": \"Crew\", \"gender\": 0, \"id\": 1418381, \"job\": \"CG Supervisor\", \"name\": \"Mike Perry\"}, {\"credit_id\": \"5592b23a9251415df8001081\", \"department\": \"Crew\", \"gender\": 0, \"id\": 1426854, \"job\": \"CG Supervisor\", \"name\": \"Andrew Morley\"}, {\"credit_id\": \"55491e1192514104c40002d8\", \"department\": \"Art\", \"gender\": 0, \"id\": 1438901, \"job\": \"Conceptual Design\", \"name\": \"Seth Engstrom\"}, {\"credit_id\": \"5525d5809251417276002b06\", \"department\": \"Crew\", \"gender\": 0, \"id\": 1447362, \"job\": \"Visual Effects Art Director\", \"name\": \"Eric Oliver\"}, {\"credit_id\": \"554427ca925141586500312a\", \"department\": \"Visual Effects\", \"gender\": 0, \"id\": 1447503, \"job\": \"Modeling\", \"name\": \"Matsune Suzuki\"}, {\"credit_id\": \"551906889251415aab001c88\", \"department\": \"Art\", \"gender\": 0, \"id\": 1447524, \"job\": \"Art Department Manager\", \"name\": \"Paul Tobin\"}, {\"credit_id\": \"5592af8492514152cc0010de\", \"department\": \"Costume & Make-Up\", \"gender\": 0, \"id\": 1452643, \"job\": \"Hairstylist\", \"name\": \"Roxane Griffin\"}, {\"credit_id\": \"553d3c109251415852001318\", \"department\": \"Lighting\", \"gender\": 0, \"id\": 1453938, \"job\": \"Lighting Artist\", \"name\": \"Arun Ram-Mohan\"}, {\"credit_id\": \"5592af4692514152d5001355\", \"department\": \"Costume & Make-Up\", \"gender\": 0, \"id\": 1457305, \"job\": \"Makeup Artist\", \"name\": \"Georgia Lockhart-Adams\"}, {\"credit_id\": \"5592b2eac3a36877470012a5\", \"department\": \"Crew\", \"gender\": 0, \"id\": 1466035, \"job\": \"CG Supervisor\", \"name\": \"Thrain Shadbolt\"}, {\"credit_id\": \"5592b032c3a36877450015f1\", \"department\": \"Crew\", \"gender\": 0, \"id\": 1483220, \"job\": \"CG Supervisor\", \"name\": \"Brad Alexander\"}, {\"credit_id\": \"5592b05592514152d80012f6\", \"department\": \"Crew\", \"gender\": 0, \"id\": 1483221, \"job\": \"CG Supervisor\", \"name\": \"Shadi Almassizadeh\"}, {\"credit_id\": \"5592b090c3a36877570010b5\", \"department\": \"Crew\", \"gender\": 0, \"id\": 1483222, \"job\": \"CG Supervisor\", \"name\": \"Simon Clutterbuck\"}, {\"credit_id\": \"5592b0dbc3a368774b00112c\", \"department\": \"Crew\", \"gender\": 0, \"id\": 1483223, \"job\": \"CG Supervisor\", \"name\": \"Graeme Demmocks\"}, {\"credit_id\": \"5592b0fe92514152db0010c1\", \"department\": \"Crew\", \"gender\": 0, \"id\": 1483224, \"job\": \"CG Supervisor\", \"name\": \"Adrian Fernandes\"}, {\"credit_id\": \"5592b11f9251415df8001059\", \"department\": \"Crew\", \"gender\": 0, \"id\": 1483225, \"job\": \"CG Supervisor\", \"name\": \"Mitch Gates\"}, {\"credit_id\": \"5592b15dc3a3687745001645\", \"department\": \"Crew\", \"gender\": 0, \"id\": 1483226, \"job\": \"CG Supervisor\", \"name\": \"Jerry Kung\"}, {\"credit_id\": \"5592b18e925141645a0004ae\", \"department\": \"Crew\", \"gender\": 0, \"id\": 1483227, \"job\": \"CG Supervisor\", \"name\": \"Andy Lomas\"}, {\"credit_id\": \"5592b1bfc3a368775d0010e7\", \"department\": \"Crew\", \"gender\": 0, \"id\": 1483228, \"job\": \"CG Supervisor\", \"name\": \"Sebastian Marino\"}, {\"credit_id\": \"5592b2049251415df8001078\", \"department\": \"Crew\", \"gender\": 0, \"id\": 1483229, \"job\": \"CG Supervisor\", \"name\": \"Matthias Menz\"}, {\"credit_id\": \"5592b27b92514152d800136a\", \"department\": \"Crew\", \"gender\": 0, \"id\": 1483230, \"job\": \"CG Supervisor\", \"name\": \"Sergei Nevshupov\"}, {\"credit_id\": \"5592b2c3c3a36869e800003c\", \"department\": \"Crew\", \"gender\": 0, \"id\": 1483231, \"job\": \"CG Supervisor\", \"name\": \"Philippe Rebours\"}, {\"credit_id\": \"5592b317c3a36877470012af\", \"department\": \"Crew\", \"gender\": 0, \"id\": 1483232, \"job\": \"CG Supervisor\", \"name\": \"Michael Takarangi\"}, {\"credit_id\": \"5592b345c3a36877470012bb\", \"department\": \"Crew\", \"gender\": 0, \"id\": 1483233, \"job\": \"CG Supervisor\", \"name\": \"David Weitzberg\"}, {\"credit_id\": \"5592b37cc3a368775100113b\", \"department\": \"Crew\", \"gender\": 0, \"id\": 1483234, \"job\": \"CG Supervisor\", \"name\": \"Ben White\"}, {\"credit_id\": \"573c8e2f9251413f5d000094\", \"department\": \"Crew\", \"gender\": 1, \"id\": 1621932, \"job\": \"Stunts\", \"name\": \"Min Windle\"}]'" 1287 | ] 1288 | }, 1289 | "execution_count": 176, 1290 | "metadata": {}, 1291 | "output_type": "execute_result" 1292 | } 1293 | ], 1294 | "source": [ 1295 | "# handle crew\n", 1296 | "\n", 1297 | "movies.iloc[0]['crew']" 1298 | ] 1299 | }, 1300 | { 1301 | "cell_type": "code", 1302 | "execution_count": 177, 1303 | "metadata": {}, 1304 | "outputs": [], 1305 | "source": [ 1306 | "def fetch_director(text):\n", 1307 | " L = []\n", 1308 | " for i in ast.literal_eval(text):\n", 1309 | " if i['job'] == 'Director':\n", 1310 | " L.append(i['name'])\n", 1311 | " break\n", 1312 | " return L" 1313 | ] 1314 | }, 1315 | { 1316 | "cell_type": "code", 1317 | "execution_count": 178, 1318 | "metadata": {}, 1319 | "outputs": [], 1320 | "source": [ 1321 | "movies['crew'] = movies['crew'].apply(fetch_director)" 1322 | ] 1323 | }, 1324 | { 1325 | "cell_type": "code", 1326 | "execution_count": 179, 1327 | "metadata": {}, 1328 | "outputs": [ 1329 | { 1330 | "data": { 1331 | "text/html": [ 1332 | "
\n", 1333 | "\n", 1346 | "\n", 1347 | " \n", 1348 | " \n", 1349 | " \n", 1350 | " \n", 1351 | " \n", 1352 | " \n", 1353 | " \n", 1354 | " \n", 1355 | " \n", 1356 | " \n", 1357 | " \n", 1358 | " \n", 1359 | " \n", 1360 | " \n", 1361 | " \n", 1362 | " \n", 1363 | " \n", 1364 | " \n", 1365 | " \n", 1366 | " \n", 1367 | " \n", 1368 | " \n", 1369 | " \n", 1370 | " \n", 1371 | " \n", 1372 | " \n", 1373 | " \n", 1374 | " \n", 1375 | " \n", 1376 | " \n", 1377 | " \n", 1378 | " \n", 1379 | " \n", 1380 | " \n", 1381 | " \n", 1382 | " \n", 1383 | " \n", 1384 | " \n", 1385 | " \n", 1386 | " \n", 1387 | " \n", 1388 | " \n", 1389 | " \n", 1390 | " \n", 1391 | " \n", 1392 | " \n", 1393 | " \n", 1394 | " \n", 1395 | " \n", 1396 | " \n", 1397 | " \n", 1398 | " \n", 1399 | " \n", 1400 | " \n", 1401 | " \n", 1402 | " \n", 1403 | " \n", 1404 | " \n", 1405 | " \n", 1406 | " \n", 1407 | " \n", 1408 | " \n", 1409 | " \n", 1410 | " \n", 1411 | "
movie_idtitleoverviewgenreskeywordscastcrew
019995AvatarIn the 22nd century, a paraplegic Marine is di...[Action, Adventure, Fantasy, Science Fiction][culture clash, future, space war, space colon...[Sam Worthington, Zoe Saldana, Sigourney Weaver][James Cameron]
1285Pirates of the Caribbean: At World's EndCaptain Barbossa, long believed to be dead, ha...[Adventure, Fantasy, Action][ocean, drug abuse, exotic island, east india ...[Johnny Depp, Orlando Bloom, Keira Knightley][Gore Verbinski]
2206647SpectreA cryptic message from Bond’s past sends him o...[Action, Adventure, Crime][spy, based on novel, secret agent, sequel, mi...[Daniel Craig, Christoph Waltz, Léa Seydoux][Sam Mendes]
349026The Dark Knight RisesFollowing the death of District Attorney Harve...[Action, Crime, Drama, Thriller][dc comics, crime fighter, terrorist, secret i...[Christian Bale, Michael Caine, Gary Oldman][Christopher Nolan]
449529John CarterJohn Carter is a war-weary, former military ca...[Action, Adventure, Science Fiction][based on novel, mars, medallion, space travel...[Taylor Kitsch, Lynn Collins, Samantha Morton][Andrew Stanton]
\n", 1412 | "
" 1413 | ], 1414 | "text/plain": [ 1415 | " movie_id title \\\n", 1416 | "0 19995 Avatar \n", 1417 | "1 285 Pirates of the Caribbean: At World's End \n", 1418 | "2 206647 Spectre \n", 1419 | "3 49026 The Dark Knight Rises \n", 1420 | "4 49529 John Carter \n", 1421 | "\n", 1422 | " overview \\\n", 1423 | "0 In the 22nd century, a paraplegic Marine is di... \n", 1424 | "1 Captain Barbossa, long believed to be dead, ha... \n", 1425 | "2 A cryptic message from Bond’s past sends him o... \n", 1426 | "3 Following the death of District Attorney Harve... \n", 1427 | "4 John Carter is a war-weary, former military ca... \n", 1428 | "\n", 1429 | " genres \\\n", 1430 | "0 [Action, Adventure, Fantasy, Science Fiction] \n", 1431 | "1 [Adventure, Fantasy, Action] \n", 1432 | "2 [Action, Adventure, Crime] \n", 1433 | "3 [Action, Crime, Drama, Thriller] \n", 1434 | "4 [Action, Adventure, Science Fiction] \n", 1435 | "\n", 1436 | " keywords \\\n", 1437 | "0 [culture clash, future, space war, space colon... \n", 1438 | "1 [ocean, drug abuse, exotic island, east india ... \n", 1439 | "2 [spy, based on novel, secret agent, sequel, mi... \n", 1440 | "3 [dc comics, crime fighter, terrorist, secret i... \n", 1441 | "4 [based on novel, mars, medallion, space travel... \n", 1442 | "\n", 1443 | " cast crew \n", 1444 | "0 [Sam Worthington, Zoe Saldana, Sigourney Weaver] [James Cameron] \n", 1445 | "1 [Johnny Depp, Orlando Bloom, Keira Knightley] [Gore Verbinski] \n", 1446 | "2 [Daniel Craig, Christoph Waltz, Léa Seydoux] [Sam Mendes] \n", 1447 | "3 [Christian Bale, Michael Caine, Gary Oldman] [Christopher Nolan] \n", 1448 | "4 [Taylor Kitsch, Lynn Collins, Samantha Morton] [Andrew Stanton] " 1449 | ] 1450 | }, 1451 | "execution_count": 179, 1452 | "metadata": {}, 1453 | "output_type": "execute_result" 1454 | } 1455 | ], 1456 | "source": [ 1457 | "movies.head()" 1458 | ] 1459 | }, 1460 | { 1461 | "cell_type": "code", 1462 | "execution_count": 180, 1463 | "metadata": {}, 1464 | "outputs": [ 1465 | { 1466 | "data": { 1467 | "text/plain": [ 1468 | "'In the 22nd century, a paraplegic Marine is dispatched to the moon Pandora on a unique mission, but becomes torn between following orders and protecting an alien civilization.'" 1469 | ] 1470 | }, 1471 | "execution_count": 180, 1472 | "metadata": {}, 1473 | "output_type": "execute_result" 1474 | } 1475 | ], 1476 | "source": [ 1477 | "# handle overview (converting to list)\n", 1478 | "\n", 1479 | "movies.iloc[0]['overview']" 1480 | ] 1481 | }, 1482 | { 1483 | "cell_type": "code", 1484 | "execution_count": 181, 1485 | "metadata": {}, 1486 | "outputs": [ 1487 | { 1488 | "data": { 1489 | "text/html": [ 1490 | "
\n", 1491 | "\n", 1504 | "\n", 1505 | " \n", 1506 | " \n", 1507 | " \n", 1508 | " \n", 1509 | " \n", 1510 | " \n", 1511 | " \n", 1512 | " \n", 1513 | " \n", 1514 | " \n", 1515 | " \n", 1516 | " \n", 1517 | " \n", 1518 | " \n", 1519 | " \n", 1520 | " \n", 1521 | " \n", 1522 | " \n", 1523 | " \n", 1524 | " \n", 1525 | " \n", 1526 | " \n", 1527 | " \n", 1528 | " \n", 1529 | " \n", 1530 | " \n", 1531 | " \n", 1532 | " \n", 1533 | " \n", 1534 | " \n", 1535 | " \n", 1536 | " \n", 1537 | " \n", 1538 | " \n", 1539 | " \n", 1540 | " \n", 1541 | " \n", 1542 | " \n", 1543 | " \n", 1544 | " \n", 1545 | " \n", 1546 | " \n", 1547 | " \n", 1548 | " \n", 1549 | " \n", 1550 | " \n", 1551 | " \n", 1552 | " \n", 1553 | " \n", 1554 | " \n", 1555 | " \n", 1556 | " \n", 1557 | " \n", 1558 | " \n", 1559 | "
movie_idtitleoverviewgenreskeywordscastcrew
233710934Under the Tuscan Sun[After, a, rough, divoce,, Frances,, a, 35, ye...[Comedy, Drama, Romance][depression, toscana, recreation, author, divo...[Diane Lane, Sandra Oh, Lindsay Duncan][Audrey Wells]
294811184Kinsey[Kinsey, is, a, portrait, of, researcher, Alfr...[Drama][free love, sex, sexuality, indiana, professor...[Liam Neeson, Laura Linney, Chris O'Donnell][Bill Condon]
143214175Valiant[The, animated, comedy, tells, the, story, of,...[Animation, Family, Adventure][animation, animal, 3d][Ewan McGregor, Ricky Gervais, Tim Curry][Gary Chapman]
336422314In Too Deep[A, fearless, cop, is, taking, on, a, ruthless...[Drama, Action, Thriller, Crime][][Omar Epps, LL Cool J, Nia Long][Michael Rymer]
\n", 1560 | "
" 1561 | ], 1562 | "text/plain": [ 1563 | " movie_id title \\\n", 1564 | "2337 10934 Under the Tuscan Sun \n", 1565 | "2948 11184 Kinsey \n", 1566 | "1432 14175 Valiant \n", 1567 | "3364 22314 In Too Deep \n", 1568 | "\n", 1569 | " overview \\\n", 1570 | "2337 [After, a, rough, divoce,, Frances,, a, 35, ye... \n", 1571 | "2948 [Kinsey, is, a, portrait, of, researcher, Alfr... \n", 1572 | "1432 [The, animated, comedy, tells, the, story, of,... \n", 1573 | "3364 [A, fearless, cop, is, taking, on, a, ruthless... \n", 1574 | "\n", 1575 | " genres \\\n", 1576 | "2337 [Comedy, Drama, Romance] \n", 1577 | "2948 [Drama] \n", 1578 | "1432 [Animation, Family, Adventure] \n", 1579 | "3364 [Drama, Action, Thriller, Crime] \n", 1580 | "\n", 1581 | " keywords \\\n", 1582 | "2337 [depression, toscana, recreation, author, divo... \n", 1583 | "2948 [free love, sex, sexuality, indiana, professor... \n", 1584 | "1432 [animation, animal, 3d] \n", 1585 | "3364 [] \n", 1586 | "\n", 1587 | " cast crew \n", 1588 | "2337 [Diane Lane, Sandra Oh, Lindsay Duncan] [Audrey Wells] \n", 1589 | "2948 [Liam Neeson, Laura Linney, Chris O'Donnell] [Bill Condon] \n", 1590 | "1432 [Ewan McGregor, Ricky Gervais, Tim Curry] [Gary Chapman] \n", 1591 | "3364 [Omar Epps, LL Cool J, Nia Long] [Michael Rymer] " 1592 | ] 1593 | }, 1594 | "execution_count": 181, 1595 | "metadata": {}, 1596 | "output_type": "execute_result" 1597 | } 1598 | ], 1599 | "source": [ 1600 | "movies['overview'] = movies['overview'].apply(lambda x:x.split())\n", 1601 | "movies.sample(4)" 1602 | ] 1603 | }, 1604 | { 1605 | "cell_type": "code", 1606 | "execution_count": 182, 1607 | "metadata": {}, 1608 | "outputs": [ 1609 | { 1610 | "data": { 1611 | "text/plain": [ 1612 | "['In',\n", 1613 | " 'the',\n", 1614 | " '22nd',\n", 1615 | " 'century,',\n", 1616 | " 'a',\n", 1617 | " 'paraplegic',\n", 1618 | " 'Marine',\n", 1619 | " 'is',\n", 1620 | " 'dispatched',\n", 1621 | " 'to',\n", 1622 | " 'the',\n", 1623 | " 'moon',\n", 1624 | " 'Pandora',\n", 1625 | " 'on',\n", 1626 | " 'a',\n", 1627 | " 'unique',\n", 1628 | " 'mission,',\n", 1629 | " 'but',\n", 1630 | " 'becomes',\n", 1631 | " 'torn',\n", 1632 | " 'between',\n", 1633 | " 'following',\n", 1634 | " 'orders',\n", 1635 | " 'and',\n", 1636 | " 'protecting',\n", 1637 | " 'an',\n", 1638 | " 'alien',\n", 1639 | " 'civilization.']" 1640 | ] 1641 | }, 1642 | "execution_count": 182, 1643 | "metadata": {}, 1644 | "output_type": "execute_result" 1645 | } 1646 | ], 1647 | "source": [ 1648 | "movies.iloc[0]['overview']" 1649 | ] 1650 | }, 1651 | { 1652 | "cell_type": "code", 1653 | "execution_count": 183, 1654 | "metadata": {}, 1655 | "outputs": [], 1656 | "source": [ 1657 | "# now removing space like that \n", 1658 | "'Anna Kendrick'\n", 1659 | "'AnnaKendrick'\n", 1660 | "\n", 1661 | "def remove_space(L):\n", 1662 | " L1 = []\n", 1663 | " for i in L:\n", 1664 | " L1.append(i.replace(\" \",\"\"))\n", 1665 | " return L1" 1666 | ] 1667 | }, 1668 | { 1669 | "cell_type": "code", 1670 | "execution_count": 184, 1671 | "metadata": {}, 1672 | "outputs": [], 1673 | "source": [ 1674 | "\n", 1675 | "movies['cast'] = movies['cast'].apply(remove_space)\n", 1676 | "movies['crew'] = movies['crew'].apply(remove_space)\n", 1677 | "movies['genres'] = movies['genres'].apply(remove_space)\n", 1678 | "movies['keywords'] = movies['keywords'].apply(remove_space)" 1679 | ] 1680 | }, 1681 | { 1682 | "cell_type": "code", 1683 | "execution_count": 185, 1684 | "metadata": {}, 1685 | "outputs": [ 1686 | { 1687 | "data": { 1688 | "text/html": [ 1689 | "
\n", 1690 | "\n", 1703 | "\n", 1704 | " \n", 1705 | " \n", 1706 | " \n", 1707 | " \n", 1708 | " \n", 1709 | " \n", 1710 | " \n", 1711 | " \n", 1712 | " \n", 1713 | " \n", 1714 | " \n", 1715 | " \n", 1716 | " \n", 1717 | " \n", 1718 | " \n", 1719 | " \n", 1720 | " \n", 1721 | " \n", 1722 | " \n", 1723 | " \n", 1724 | " \n", 1725 | " \n", 1726 | " \n", 1727 | " \n", 1728 | " \n", 1729 | " \n", 1730 | " \n", 1731 | " \n", 1732 | " \n", 1733 | " \n", 1734 | " \n", 1735 | " \n", 1736 | " \n", 1737 | " \n", 1738 | " \n", 1739 | " \n", 1740 | " \n", 1741 | " \n", 1742 | " \n", 1743 | " \n", 1744 | " \n", 1745 | " \n", 1746 | " \n", 1747 | " \n", 1748 | " \n", 1749 | " \n", 1750 | " \n", 1751 | " \n", 1752 | " \n", 1753 | " \n", 1754 | " \n", 1755 | " \n", 1756 | " \n", 1757 | " \n", 1758 | " \n", 1759 | " \n", 1760 | " \n", 1761 | " \n", 1762 | " \n", 1763 | " \n", 1764 | " \n", 1765 | " \n", 1766 | " \n", 1767 | " \n", 1768 | "
movie_idtitleoverviewgenreskeywordscastcrew
019995Avatar[In, the, 22nd, century,, a, paraplegic, Marin...[Action, Adventure, Fantasy, ScienceFiction][cultureclash, future, spacewar, spacecolony, ...[SamWorthington, ZoeSaldana, SigourneyWeaver][JamesCameron]
1285Pirates of the Caribbean: At World's End[Captain, Barbossa,, long, believed, to, be, d...[Adventure, Fantasy, Action][ocean, drugabuse, exoticisland, eastindiatrad...[JohnnyDepp, OrlandoBloom, KeiraKnightley][GoreVerbinski]
2206647Spectre[A, cryptic, message, from, Bond’s, past, send...[Action, Adventure, Crime][spy, basedonnovel, secretagent, sequel, mi6, ...[DanielCraig, ChristophWaltz, LéaSeydoux][SamMendes]
349026The Dark Knight Rises[Following, the, death, of, District, Attorney...[Action, Crime, Drama, Thriller][dccomics, crimefighter, terrorist, secretiden...[ChristianBale, MichaelCaine, GaryOldman][ChristopherNolan]
449529John Carter[John, Carter, is, a, war-weary,, former, mili...[Action, Adventure, ScienceFiction][basedonnovel, mars, medallion, spacetravel, p...[TaylorKitsch, LynnCollins, SamanthaMorton][AndrewStanton]
\n", 1769 | "
" 1770 | ], 1771 | "text/plain": [ 1772 | " movie_id title \\\n", 1773 | "0 19995 Avatar \n", 1774 | "1 285 Pirates of the Caribbean: At World's End \n", 1775 | "2 206647 Spectre \n", 1776 | "3 49026 The Dark Knight Rises \n", 1777 | "4 49529 John Carter \n", 1778 | "\n", 1779 | " overview \\\n", 1780 | "0 [In, the, 22nd, century,, a, paraplegic, Marin... \n", 1781 | "1 [Captain, Barbossa,, long, believed, to, be, d... \n", 1782 | "2 [A, cryptic, message, from, Bond’s, past, send... \n", 1783 | "3 [Following, the, death, of, District, Attorney... \n", 1784 | "4 [John, Carter, is, a, war-weary,, former, mili... \n", 1785 | "\n", 1786 | " genres \\\n", 1787 | "0 [Action, Adventure, Fantasy, ScienceFiction] \n", 1788 | "1 [Adventure, Fantasy, Action] \n", 1789 | "2 [Action, Adventure, Crime] \n", 1790 | "3 [Action, Crime, Drama, Thriller] \n", 1791 | "4 [Action, Adventure, ScienceFiction] \n", 1792 | "\n", 1793 | " keywords \\\n", 1794 | "0 [cultureclash, future, spacewar, spacecolony, ... \n", 1795 | "1 [ocean, drugabuse, exoticisland, eastindiatrad... \n", 1796 | "2 [spy, basedonnovel, secretagent, sequel, mi6, ... \n", 1797 | "3 [dccomics, crimefighter, terrorist, secretiden... \n", 1798 | "4 [basedonnovel, mars, medallion, spacetravel, p... \n", 1799 | "\n", 1800 | " cast crew \n", 1801 | "0 [SamWorthington, ZoeSaldana, SigourneyWeaver] [JamesCameron] \n", 1802 | "1 [JohnnyDepp, OrlandoBloom, KeiraKnightley] [GoreVerbinski] \n", 1803 | "2 [DanielCraig, ChristophWaltz, LéaSeydoux] [SamMendes] \n", 1804 | "3 [ChristianBale, MichaelCaine, GaryOldman] [ChristopherNolan] \n", 1805 | "4 [TaylorKitsch, LynnCollins, SamanthaMorton] [AndrewStanton] " 1806 | ] 1807 | }, 1808 | "execution_count": 185, 1809 | "metadata": {}, 1810 | "output_type": "execute_result" 1811 | } 1812 | ], 1813 | "source": [ 1814 | "movies.head()" 1815 | ] 1816 | }, 1817 | { 1818 | "cell_type": "code", 1819 | "execution_count": 186, 1820 | "metadata": {}, 1821 | "outputs": [], 1822 | "source": [ 1823 | "# Concatinate all\n", 1824 | "movies['tags'] = movies['overview'] + movies['genres'] + movies['keywords'] + movies['cast'] + movies['crew']" 1825 | ] 1826 | }, 1827 | { 1828 | "cell_type": "code", 1829 | "execution_count": 187, 1830 | "metadata": {}, 1831 | "outputs": [ 1832 | { 1833 | "data": { 1834 | "text/html": [ 1835 | "
\n", 1836 | "\n", 1849 | "\n", 1850 | " \n", 1851 | " \n", 1852 | " \n", 1853 | " \n", 1854 | " \n", 1855 | " \n", 1856 | " \n", 1857 | " \n", 1858 | " \n", 1859 | " \n", 1860 | " \n", 1861 | " \n", 1862 | " \n", 1863 | " \n", 1864 | " \n", 1865 | " \n", 1866 | " \n", 1867 | " \n", 1868 | " \n", 1869 | " \n", 1870 | " \n", 1871 | " \n", 1872 | " \n", 1873 | " \n", 1874 | " \n", 1875 | " \n", 1876 | " \n", 1877 | " \n", 1878 | " \n", 1879 | " \n", 1880 | " \n", 1881 | " \n", 1882 | " \n", 1883 | " \n", 1884 | " \n", 1885 | " \n", 1886 | " \n", 1887 | " \n", 1888 | " \n", 1889 | " \n", 1890 | " \n", 1891 | " \n", 1892 | " \n", 1893 | " \n", 1894 | " \n", 1895 | " \n", 1896 | " \n", 1897 | " \n", 1898 | " \n", 1899 | " \n", 1900 | " \n", 1901 | " \n", 1902 | " \n", 1903 | " \n", 1904 | " \n", 1905 | " \n", 1906 | " \n", 1907 | " \n", 1908 | " \n", 1909 | " \n", 1910 | " \n", 1911 | " \n", 1912 | " \n", 1913 | " \n", 1914 | " \n", 1915 | " \n", 1916 | " \n", 1917 | " \n", 1918 | " \n", 1919 | " \n", 1920 | "
movie_idtitleoverviewgenreskeywordscastcrewtags
019995Avatar[In, the, 22nd, century,, a, paraplegic, Marin...[Action, Adventure, Fantasy, ScienceFiction][cultureclash, future, spacewar, spacecolony, ...[SamWorthington, ZoeSaldana, SigourneyWeaver][JamesCameron][In, the, 22nd, century,, a, paraplegic, Marin...
1285Pirates of the Caribbean: At World's End[Captain, Barbossa,, long, believed, to, be, d...[Adventure, Fantasy, Action][ocean, drugabuse, exoticisland, eastindiatrad...[JohnnyDepp, OrlandoBloom, KeiraKnightley][GoreVerbinski][Captain, Barbossa,, long, believed, to, be, d...
2206647Spectre[A, cryptic, message, from, Bond’s, past, send...[Action, Adventure, Crime][spy, basedonnovel, secretagent, sequel, mi6, ...[DanielCraig, ChristophWaltz, LéaSeydoux][SamMendes][A, cryptic, message, from, Bond’s, past, send...
349026The Dark Knight Rises[Following, the, death, of, District, Attorney...[Action, Crime, Drama, Thriller][dccomics, crimefighter, terrorist, secretiden...[ChristianBale, MichaelCaine, GaryOldman][ChristopherNolan][Following, the, death, of, District, Attorney...
449529John Carter[John, Carter, is, a, war-weary,, former, mili...[Action, Adventure, ScienceFiction][basedonnovel, mars, medallion, spacetravel, p...[TaylorKitsch, LynnCollins, SamanthaMorton][AndrewStanton][John, Carter, is, a, war-weary,, former, mili...
\n", 1921 | "
" 1922 | ], 1923 | "text/plain": [ 1924 | " movie_id title \\\n", 1925 | "0 19995 Avatar \n", 1926 | "1 285 Pirates of the Caribbean: At World's End \n", 1927 | "2 206647 Spectre \n", 1928 | "3 49026 The Dark Knight Rises \n", 1929 | "4 49529 John Carter \n", 1930 | "\n", 1931 | " overview \\\n", 1932 | "0 [In, the, 22nd, century,, a, paraplegic, Marin... \n", 1933 | "1 [Captain, Barbossa,, long, believed, to, be, d... \n", 1934 | "2 [A, cryptic, message, from, Bond’s, past, send... \n", 1935 | "3 [Following, the, death, of, District, Attorney... \n", 1936 | "4 [John, Carter, is, a, war-weary,, former, mili... \n", 1937 | "\n", 1938 | " genres \\\n", 1939 | "0 [Action, Adventure, Fantasy, ScienceFiction] \n", 1940 | "1 [Adventure, Fantasy, Action] \n", 1941 | "2 [Action, Adventure, Crime] \n", 1942 | "3 [Action, Crime, Drama, Thriller] \n", 1943 | "4 [Action, Adventure, ScienceFiction] \n", 1944 | "\n", 1945 | " keywords \\\n", 1946 | "0 [cultureclash, future, spacewar, spacecolony, ... \n", 1947 | "1 [ocean, drugabuse, exoticisland, eastindiatrad... \n", 1948 | "2 [spy, basedonnovel, secretagent, sequel, mi6, ... \n", 1949 | "3 [dccomics, crimefighter, terrorist, secretiden... \n", 1950 | "4 [basedonnovel, mars, medallion, spacetravel, p... \n", 1951 | "\n", 1952 | " cast crew \\\n", 1953 | "0 [SamWorthington, ZoeSaldana, SigourneyWeaver] [JamesCameron] \n", 1954 | "1 [JohnnyDepp, OrlandoBloom, KeiraKnightley] [GoreVerbinski] \n", 1955 | "2 [DanielCraig, ChristophWaltz, LéaSeydoux] [SamMendes] \n", 1956 | "3 [ChristianBale, MichaelCaine, GaryOldman] [ChristopherNolan] \n", 1957 | "4 [TaylorKitsch, LynnCollins, SamanthaMorton] [AndrewStanton] \n", 1958 | "\n", 1959 | " tags \n", 1960 | "0 [In, the, 22nd, century,, a, paraplegic, Marin... \n", 1961 | "1 [Captain, Barbossa,, long, believed, to, be, d... \n", 1962 | "2 [A, cryptic, message, from, Bond’s, past, send... \n", 1963 | "3 [Following, the, death, of, District, Attorney... \n", 1964 | "4 [John, Carter, is, a, war-weary,, former, mili... " 1965 | ] 1966 | }, 1967 | "execution_count": 187, 1968 | "metadata": {}, 1969 | "output_type": "execute_result" 1970 | } 1971 | ], 1972 | "source": [ 1973 | "movies.head()" 1974 | ] 1975 | }, 1976 | { 1977 | "cell_type": "code", 1978 | "execution_count": 188, 1979 | "metadata": {}, 1980 | "outputs": [ 1981 | { 1982 | "data": { 1983 | "text/plain": [ 1984 | "['In',\n", 1985 | " 'the',\n", 1986 | " '22nd',\n", 1987 | " 'century,',\n", 1988 | " 'a',\n", 1989 | " 'paraplegic',\n", 1990 | " 'Marine',\n", 1991 | " 'is',\n", 1992 | " 'dispatched',\n", 1993 | " 'to',\n", 1994 | " 'the',\n", 1995 | " 'moon',\n", 1996 | " 'Pandora',\n", 1997 | " 'on',\n", 1998 | " 'a',\n", 1999 | " 'unique',\n", 2000 | " 'mission,',\n", 2001 | " 'but',\n", 2002 | " 'becomes',\n", 2003 | " 'torn',\n", 2004 | " 'between',\n", 2005 | " 'following',\n", 2006 | " 'orders',\n", 2007 | " 'and',\n", 2008 | " 'protecting',\n", 2009 | " 'an',\n", 2010 | " 'alien',\n", 2011 | " 'civilization.',\n", 2012 | " 'Action',\n", 2013 | " 'Adventure',\n", 2014 | " 'Fantasy',\n", 2015 | " 'ScienceFiction',\n", 2016 | " 'cultureclash',\n", 2017 | " 'future',\n", 2018 | " 'spacewar',\n", 2019 | " 'spacecolony',\n", 2020 | " 'society',\n", 2021 | " 'spacetravel',\n", 2022 | " 'futuristic',\n", 2023 | " 'romance',\n", 2024 | " 'space',\n", 2025 | " 'alien',\n", 2026 | " 'tribe',\n", 2027 | " 'alienplanet',\n", 2028 | " 'cgi',\n", 2029 | " 'marine',\n", 2030 | " 'soldier',\n", 2031 | " 'battle',\n", 2032 | " 'loveaffair',\n", 2033 | " 'antiwar',\n", 2034 | " 'powerrelations',\n", 2035 | " 'mindandsoul',\n", 2036 | " '3d',\n", 2037 | " 'SamWorthington',\n", 2038 | " 'ZoeSaldana',\n", 2039 | " 'SigourneyWeaver',\n", 2040 | " 'JamesCameron']" 2041 | ] 2042 | }, 2043 | "execution_count": 188, 2044 | "metadata": {}, 2045 | "output_type": "execute_result" 2046 | } 2047 | ], 2048 | "source": [ 2049 | "movies.iloc[0]['tags']" 2050 | ] 2051 | }, 2052 | { 2053 | "cell_type": "code", 2054 | "execution_count": 189, 2055 | "metadata": {}, 2056 | "outputs": [], 2057 | "source": [ 2058 | "# droping those extra columns\n", 2059 | "new_df = movies[['movie_id','title','tags']]" 2060 | ] 2061 | }, 2062 | { 2063 | "cell_type": "code", 2064 | "execution_count": 190, 2065 | "metadata": {}, 2066 | "outputs": [ 2067 | { 2068 | "data": { 2069 | "text/html": [ 2070 | "
\n", 2071 | "\n", 2084 | "\n", 2085 | " \n", 2086 | " \n", 2087 | " \n", 2088 | " \n", 2089 | " \n", 2090 | " \n", 2091 | " \n", 2092 | " \n", 2093 | " \n", 2094 | " \n", 2095 | " \n", 2096 | " \n", 2097 | " \n", 2098 | " \n", 2099 | " \n", 2100 | " \n", 2101 | " \n", 2102 | " \n", 2103 | " \n", 2104 | " \n", 2105 | " \n", 2106 | " \n", 2107 | " \n", 2108 | " \n", 2109 | " \n", 2110 | " \n", 2111 | " \n", 2112 | " \n", 2113 | " \n", 2114 | " \n", 2115 | " \n", 2116 | " \n", 2117 | " \n", 2118 | " \n", 2119 | " \n", 2120 | " \n", 2121 | " \n", 2122 | " \n", 2123 | " \n", 2124 | " \n", 2125 | "
movie_idtitletags
019995Avatar[In, the, 22nd, century,, a, paraplegic, Marin...
1285Pirates of the Caribbean: At World's End[Captain, Barbossa,, long, believed, to, be, d...
2206647Spectre[A, cryptic, message, from, Bond’s, past, send...
349026The Dark Knight Rises[Following, the, death, of, District, Attorney...
449529John Carter[John, Carter, is, a, war-weary,, former, mili...
\n", 2126 | "
" 2127 | ], 2128 | "text/plain": [ 2129 | " movie_id title \\\n", 2130 | "0 19995 Avatar \n", 2131 | "1 285 Pirates of the Caribbean: At World's End \n", 2132 | "2 206647 Spectre \n", 2133 | "3 49026 The Dark Knight Rises \n", 2134 | "4 49529 John Carter \n", 2135 | "\n", 2136 | " tags \n", 2137 | "0 [In, the, 22nd, century,, a, paraplegic, Marin... \n", 2138 | "1 [Captain, Barbossa,, long, believed, to, be, d... \n", 2139 | "2 [A, cryptic, message, from, Bond’s, past, send... \n", 2140 | "3 [Following, the, death, of, District, Attorney... \n", 2141 | "4 [John, Carter, is, a, war-weary,, former, mili... " 2142 | ] 2143 | }, 2144 | "execution_count": 190, 2145 | "metadata": {}, 2146 | "output_type": "execute_result" 2147 | } 2148 | ], 2149 | "source": [ 2150 | "new_df.head()" 2151 | ] 2152 | }, 2153 | { 2154 | "cell_type": "code", 2155 | "execution_count": 191, 2156 | "metadata": {}, 2157 | "outputs": [ 2158 | { 2159 | "name": "stderr", 2160 | "output_type": "stream", 2161 | "text": [ 2162 | ":2: SettingWithCopyWarning: \n", 2163 | "A value is trying to be set on a copy of a slice from a DataFrame.\n", 2164 | "Try using .loc[row_indexer,col_indexer] = value instead\n", 2165 | "\n", 2166 | "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n", 2167 | " new_df['tags'] = new_df['tags'].apply(lambda x: \" \".join(x))\n" 2168 | ] 2169 | }, 2170 | { 2171 | "data": { 2172 | "text/html": [ 2173 | "
\n", 2174 | "\n", 2187 | "\n", 2188 | " \n", 2189 | " \n", 2190 | " \n", 2191 | " \n", 2192 | " \n", 2193 | " \n", 2194 | " \n", 2195 | " \n", 2196 | " \n", 2197 | " \n", 2198 | " \n", 2199 | " \n", 2200 | " \n", 2201 | " \n", 2202 | " \n", 2203 | " \n", 2204 | " \n", 2205 | " \n", 2206 | " \n", 2207 | " \n", 2208 | " \n", 2209 | " \n", 2210 | " \n", 2211 | " \n", 2212 | " \n", 2213 | " \n", 2214 | " \n", 2215 | " \n", 2216 | " \n", 2217 | " \n", 2218 | " \n", 2219 | " \n", 2220 | " \n", 2221 | " \n", 2222 | " \n", 2223 | " \n", 2224 | " \n", 2225 | " \n", 2226 | " \n", 2227 | " \n", 2228 | "
movie_idtitletags
019995AvatarIn the 22nd century, a paraplegic Marine is di...
1285Pirates of the Caribbean: At World's EndCaptain Barbossa, long believed to be dead, ha...
2206647SpectreA cryptic message from Bond’s past sends him o...
349026The Dark Knight RisesFollowing the death of District Attorney Harve...
449529John CarterJohn Carter is a war-weary, former military ca...
\n", 2229 | "
" 2230 | ], 2231 | "text/plain": [ 2232 | " movie_id title \\\n", 2233 | "0 19995 Avatar \n", 2234 | "1 285 Pirates of the Caribbean: At World's End \n", 2235 | "2 206647 Spectre \n", 2236 | "3 49026 The Dark Knight Rises \n", 2237 | "4 49529 John Carter \n", 2238 | "\n", 2239 | " tags \n", 2240 | "0 In the 22nd century, a paraplegic Marine is di... \n", 2241 | "1 Captain Barbossa, long believed to be dead, ha... \n", 2242 | "2 A cryptic message from Bond’s past sends him o... \n", 2243 | "3 Following the death of District Attorney Harve... \n", 2244 | "4 John Carter is a war-weary, former military ca... " 2245 | ] 2246 | }, 2247 | "execution_count": 191, 2248 | "metadata": {}, 2249 | "output_type": "execute_result" 2250 | } 2251 | ], 2252 | "source": [ 2253 | "# Converting list to str\n", 2254 | "new_df['tags'] = new_df['tags'].apply(lambda x: \" \".join(x))\n", 2255 | "new_df.head()" 2256 | ] 2257 | }, 2258 | { 2259 | "cell_type": "code", 2260 | "execution_count": 192, 2261 | "metadata": {}, 2262 | "outputs": [ 2263 | { 2264 | "data": { 2265 | "text/plain": [ 2266 | "'In the 22nd century, a paraplegic Marine is dispatched to the moon Pandora on a unique mission, but becomes torn between following orders and protecting an alien civilization. Action Adventure Fantasy ScienceFiction cultureclash future spacewar spacecolony society spacetravel futuristic romance space alien tribe alienplanet cgi marine soldier battle loveaffair antiwar powerrelations mindandsoul 3d SamWorthington ZoeSaldana SigourneyWeaver JamesCameron'" 2267 | ] 2268 | }, 2269 | "execution_count": 192, 2270 | "metadata": {}, 2271 | "output_type": "execute_result" 2272 | } 2273 | ], 2274 | "source": [ 2275 | "new_df.iloc[0]['tags']" 2276 | ] 2277 | }, 2278 | { 2279 | "cell_type": "code", 2280 | "execution_count": 193, 2281 | "metadata": {}, 2282 | "outputs": [ 2283 | { 2284 | "name": "stderr", 2285 | "output_type": "stream", 2286 | "text": [ 2287 | ":2: SettingWithCopyWarning: \n", 2288 | "A value is trying to be set on a copy of a slice from a DataFrame.\n", 2289 | "Try using .loc[row_indexer,col_indexer] = value instead\n", 2290 | "\n", 2291 | "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n", 2292 | " new_df['tags'] = new_df['tags'].apply(lambda x:x.lower())\n" 2293 | ] 2294 | } 2295 | ], 2296 | "source": [ 2297 | "# Converting to lower case\n", 2298 | "new_df['tags'] = new_df['tags'].apply(lambda x:x.lower())" 2299 | ] 2300 | }, 2301 | { 2302 | "cell_type": "code", 2303 | "execution_count": 194, 2304 | "metadata": {}, 2305 | "outputs": [ 2306 | { 2307 | "data": { 2308 | "text/html": [ 2309 | "
\n", 2310 | "\n", 2323 | "\n", 2324 | " \n", 2325 | " \n", 2326 | " \n", 2327 | " \n", 2328 | " \n", 2329 | " \n", 2330 | " \n", 2331 | " \n", 2332 | " \n", 2333 | " \n", 2334 | " \n", 2335 | " \n", 2336 | " \n", 2337 | " \n", 2338 | " \n", 2339 | " \n", 2340 | " \n", 2341 | " \n", 2342 | " \n", 2343 | " \n", 2344 | " \n", 2345 | " \n", 2346 | " \n", 2347 | " \n", 2348 | " \n", 2349 | " \n", 2350 | " \n", 2351 | " \n", 2352 | " \n", 2353 | " \n", 2354 | " \n", 2355 | " \n", 2356 | " \n", 2357 | " \n", 2358 | " \n", 2359 | " \n", 2360 | " \n", 2361 | " \n", 2362 | " \n", 2363 | " \n", 2364 | "
movie_idtitletags
019995Avatarin the 22nd century, a paraplegic marine is di...
1285Pirates of the Caribbean: At World's Endcaptain barbossa, long believed to be dead, ha...
2206647Spectrea cryptic message from bond’s past sends him o...
349026The Dark Knight Risesfollowing the death of district attorney harve...
449529John Carterjohn carter is a war-weary, former military ca...
\n", 2365 | "
" 2366 | ], 2367 | "text/plain": [ 2368 | " movie_id title \\\n", 2369 | "0 19995 Avatar \n", 2370 | "1 285 Pirates of the Caribbean: At World's End \n", 2371 | "2 206647 Spectre \n", 2372 | "3 49026 The Dark Knight Rises \n", 2373 | "4 49529 John Carter \n", 2374 | "\n", 2375 | " tags \n", 2376 | "0 in the 22nd century, a paraplegic marine is di... \n", 2377 | "1 captain barbossa, long believed to be dead, ha... \n", 2378 | "2 a cryptic message from bond’s past sends him o... \n", 2379 | "3 following the death of district attorney harve... \n", 2380 | "4 john carter is a war-weary, former military ca... " 2381 | ] 2382 | }, 2383 | "execution_count": 194, 2384 | "metadata": {}, 2385 | "output_type": "execute_result" 2386 | } 2387 | ], 2388 | "source": [ 2389 | "new_df.head()" 2390 | ] 2391 | }, 2392 | { 2393 | "cell_type": "code", 2394 | "execution_count": 195, 2395 | "metadata": {}, 2396 | "outputs": [ 2397 | { 2398 | "data": { 2399 | "text/plain": [ 2400 | "'in the 22nd century, a paraplegic marine is dispatched to the moon pandora on a unique mission, but becomes torn between following orders and protecting an alien civilization. action adventure fantasy sciencefiction cultureclash future spacewar spacecolony society spacetravel futuristic romance space alien tribe alienplanet cgi marine soldier battle loveaffair antiwar powerrelations mindandsoul 3d samworthington zoesaldana sigourneyweaver jamescameron'" 2401 | ] 2402 | }, 2403 | "execution_count": 195, 2404 | "metadata": {}, 2405 | "output_type": "execute_result" 2406 | } 2407 | ], 2408 | "source": [ 2409 | "new_df.iloc[0]['tags']" 2410 | ] 2411 | }, 2412 | { 2413 | "cell_type": "code", 2414 | "execution_count": 196, 2415 | "metadata": {}, 2416 | "outputs": [], 2417 | "source": [ 2418 | "import nltk\n", 2419 | "from nltk.stem import PorterStemmer" 2420 | ] 2421 | }, 2422 | { 2423 | "cell_type": "code", 2424 | "execution_count": 197, 2425 | "metadata": {}, 2426 | "outputs": [], 2427 | "source": [ 2428 | "ps = PorterStemmer()" 2429 | ] 2430 | }, 2431 | { 2432 | "cell_type": "code", 2433 | "execution_count": 198, 2434 | "metadata": {}, 2435 | "outputs": [], 2436 | "source": [ 2437 | "def stems(text):\n", 2438 | " T = []\n", 2439 | " \n", 2440 | " for i in text.split():\n", 2441 | " T.append(ps.stem(i))\n", 2442 | " \n", 2443 | " return \" \".join(T)" 2444 | ] 2445 | }, 2446 | { 2447 | "cell_type": "code", 2448 | "execution_count": 199, 2449 | "metadata": {}, 2450 | "outputs": [ 2451 | { 2452 | "name": "stderr", 2453 | "output_type": "stream", 2454 | "text": [ 2455 | ":1: SettingWithCopyWarning: \n", 2456 | "A value is trying to be set on a copy of a slice from a DataFrame.\n", 2457 | "Try using .loc[row_indexer,col_indexer] = value instead\n", 2458 | "\n", 2459 | "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n", 2460 | " new_df['tags'] = new_df['tags'].apply(stems)\n" 2461 | ] 2462 | } 2463 | ], 2464 | "source": [ 2465 | "new_df['tags'] = new_df['tags'].apply(stems)" 2466 | ] 2467 | }, 2468 | { 2469 | "cell_type": "code", 2470 | "execution_count": 200, 2471 | "metadata": {}, 2472 | "outputs": [ 2473 | { 2474 | "data": { 2475 | "text/plain": [ 2476 | "'in the 22nd century, a parapleg marin is dispatch to the moon pandora on a uniqu mission, but becom torn between follow order and protect an alien civilization. action adventur fantasi sciencefict cultureclash futur spacewar spacecoloni societi spacetravel futurist romanc space alien tribe alienplanet cgi marin soldier battl loveaffair antiwar powerrel mindandsoul 3d samworthington zoesaldana sigourneyweav jamescameron'" 2477 | ] 2478 | }, 2479 | "execution_count": 200, 2480 | "metadata": {}, 2481 | "output_type": "execute_result" 2482 | } 2483 | ], 2484 | "source": [ 2485 | "new_df.iloc[0]['tags']" 2486 | ] 2487 | }, 2488 | { 2489 | "cell_type": "code", 2490 | "execution_count": 201, 2491 | "metadata": {}, 2492 | "outputs": [], 2493 | "source": [ 2494 | "from sklearn.feature_extraction.text import CountVectorizer\n", 2495 | "cv = CountVectorizer(max_features=5000,stop_words='english')\n" 2496 | ] 2497 | }, 2498 | { 2499 | "cell_type": "code", 2500 | "execution_count": 202, 2501 | "metadata": {}, 2502 | "outputs": [], 2503 | "source": [ 2504 | "vector = cv.fit_transform(new_df['tags']).toarray()" 2505 | ] 2506 | }, 2507 | { 2508 | "cell_type": "code", 2509 | "execution_count": 203, 2510 | "metadata": {}, 2511 | "outputs": [ 2512 | { 2513 | "data": { 2514 | "text/plain": [ 2515 | "array([0, 0, 0, ..., 0, 0, 0], dtype=int64)" 2516 | ] 2517 | }, 2518 | "execution_count": 203, 2519 | "metadata": {}, 2520 | "output_type": "execute_result" 2521 | } 2522 | ], 2523 | "source": [ 2524 | "vector[0]" 2525 | ] 2526 | }, 2527 | { 2528 | "cell_type": "code", 2529 | "execution_count": 204, 2530 | "metadata": {}, 2531 | "outputs": [ 2532 | { 2533 | "data": { 2534 | "text/plain": [ 2535 | "(4806, 5000)" 2536 | ] 2537 | }, 2538 | "execution_count": 204, 2539 | "metadata": {}, 2540 | "output_type": "execute_result" 2541 | } 2542 | ], 2543 | "source": [ 2544 | "vector.shape" 2545 | ] 2546 | }, 2547 | { 2548 | "cell_type": "code", 2549 | "execution_count": 205, 2550 | "metadata": {}, 2551 | "outputs": [ 2552 | { 2553 | "data": { 2554 | "text/plain": [ 2555 | "5000" 2556 | ] 2557 | }, 2558 | "execution_count": 205, 2559 | "metadata": {}, 2560 | "output_type": "execute_result" 2561 | } 2562 | ], 2563 | "source": [ 2564 | "len(cv.get_feature_names())" 2565 | ] 2566 | }, 2567 | { 2568 | "cell_type": "code", 2569 | "execution_count": 207, 2570 | "metadata": {}, 2571 | "outputs": [], 2572 | "source": [ 2573 | "from sklearn.metrics.pairwise import cosine_similarity" 2574 | ] 2575 | }, 2576 | { 2577 | "cell_type": "code", 2578 | "execution_count": 208, 2579 | "metadata": {}, 2580 | "outputs": [], 2581 | "source": [ 2582 | "similarity = cosine_similarity(vector)" 2583 | ] 2584 | }, 2585 | { 2586 | "cell_type": "code", 2587 | "execution_count": 209, 2588 | "metadata": {}, 2589 | "outputs": [ 2590 | { 2591 | "data": { 2592 | "text/plain": [ 2593 | "(4806, 4806)" 2594 | ] 2595 | }, 2596 | "execution_count": 209, 2597 | "metadata": {}, 2598 | "output_type": "execute_result" 2599 | } 2600 | ], 2601 | "source": [ 2602 | "similarity.shape" 2603 | ] 2604 | }, 2605 | { 2606 | "cell_type": "code", 2607 | "execution_count": 211, 2608 | "metadata": {}, 2609 | "outputs": [], 2610 | "source": [ 2611 | "# similarity" 2612 | ] 2613 | }, 2614 | { 2615 | "cell_type": "code", 2616 | "execution_count": 213, 2617 | "metadata": {}, 2618 | "outputs": [ 2619 | { 2620 | "data": { 2621 | "text/plain": [ 2622 | "744" 2623 | ] 2624 | }, 2625 | "execution_count": 213, 2626 | "metadata": {}, 2627 | "output_type": "execute_result" 2628 | } 2629 | ], 2630 | "source": [ 2631 | "new_df[new_df['title'] == 'The Lego Movie'].index[0]" 2632 | ] 2633 | }, 2634 | { 2635 | "cell_type": "code", 2636 | "execution_count": 214, 2637 | "metadata": {}, 2638 | "outputs": [], 2639 | "source": [ 2640 | "def recommend(movie):\n", 2641 | " index = new_df[new_df['title'] == movie].index[0]\n", 2642 | " distances = sorted(list(enumerate(similarity[index])),reverse=True,key = lambda x: x[1])\n", 2643 | " for i in distances[1:6]:\n", 2644 | " print(new_df.iloc[i[0]].title)" 2645 | ] 2646 | }, 2647 | { 2648 | "cell_type": "code", 2649 | "execution_count": 219, 2650 | "metadata": {}, 2651 | "outputs": [ 2652 | { 2653 | "name": "stdout", 2654 | "output_type": "stream", 2655 | "text": [ 2656 | "Spider-Man 3\n", 2657 | "Spider-Man\n", 2658 | "The Amazing Spider-Man\n", 2659 | "Iron Man 2\n", 2660 | "Superman\n" 2661 | ] 2662 | } 2663 | ], 2664 | "source": [ 2665 | "recommend('Spider-Man 2')" 2666 | ] 2667 | }, 2668 | { 2669 | "cell_type": "code", 2670 | "execution_count": 221, 2671 | "metadata": {}, 2672 | "outputs": [], 2673 | "source": [ 2674 | "import pickle" 2675 | ] 2676 | }, 2677 | { 2678 | "cell_type": "code", 2679 | "execution_count": 222, 2680 | "metadata": {}, 2681 | "outputs": [], 2682 | "source": [ 2683 | "pickle.dump(new_df,open('artifacts/movie_list.pkl','wb'))\n", 2684 | "pickle.dump(similarity,open('artifacts/similarity.pkl','wb'))" 2685 | ] 2686 | }, 2687 | { 2688 | "cell_type": "code", 2689 | "execution_count": null, 2690 | "metadata": {}, 2691 | "outputs": [], 2692 | "source": [] 2693 | } 2694 | ], 2695 | "metadata": { 2696 | "kernelspec": { 2697 | "display_name": "Python 3", 2698 | "language": "python", 2699 | "name": "python3" 2700 | }, 2701 | "language_info": { 2702 | "codemirror_mode": { 2703 | "name": "ipython", 2704 | "version": 3 2705 | }, 2706 | "file_extension": ".py", 2707 | "mimetype": "text/x-python", 2708 | "name": "python", 2709 | "nbconvert_exporter": "python", 2710 | "pygments_lexer": "ipython3", 2711 | "version": "3.8.5" 2712 | } 2713 | }, 2714 | "nbformat": 4, 2715 | "nbformat_minor": 4 2716 | } 2717 | -------------------------------------------------------------------------------- /Procfile: -------------------------------------------------------------------------------- 1 | web: sh setup.sh && streamlit run app.py -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Project: Movie Recommender System Using Machine Learning! 2 | 3 | workflow 4 | 5 | Recommendation systems are becoming increasingly important in today’s extremely busy world. People are always short on time with the myriad tasks they need to accomplish in the limited 24 hours. Therefore, the recommendation systems are important as they help them make the right choices, without having to expend their cognitive resources. 6 | 7 | The purpose of a recommendation system basically is to search for content that would be interesting to an individual. Moreover, it involves a number of factors to create personalised lists of useful and interesting content specific to each user/individual. Recommendation systems are Artificial Intelligence based algorithms that skim through all possible options and create a customized list of items that are interesting and relevant to an individual. These results are based on their profile, search/browsing history, what other people with similar traits/demographics are watching, and how likely are you to watch those movies. This is achieved through predictive modeling and heuristics with the data available. 8 | 9 | # Types of Recommendation System : 10 | 11 | ### 1 ) Content Based : 12 | 13 | - Content-based systems, which use characteristic information and takes item attriubutes into consideration . 14 | 15 | - Twitter , Youtube . 16 | 17 | - Which music you are listening , what singer are you watching . Form embeddings for the features . 18 | 19 | - User specific actions or similar items reccomendation . 20 | 21 | - It will create a vector of it . 22 | 23 | - These systems make recommendations using a user's item and profile features. They hypothesize that if a user was interested in an item in the past, they will once again be interested in it in the future 24 | 25 | - One issue that arises is making obvious recommendations because of excessive specialization (user A is only interested in categories B, C, and D, and the system is not able to recommend items outside those categories, even though they could be interesting to them). 26 | 27 | ### 2 ) Collaborative Based : 28 | 29 | - Collaborative filtering systems, which are based on user-item interactions. 30 | 31 | - Clusters of users with same ratings , similar users . 32 | 33 | - Book recommendation , so use cluster mechanism . 34 | 35 | - We take only one parameter , ratings or comments . 36 | 37 | - In short, collaborative filtering systems are based on the assumption that if a user likes item A and another user likes the same item A as well as another item, item B, the first user could also be interested in the second item . 38 | 39 | - Issues are : 40 | 41 | - User-Item nXn matrix , so computationally expensive . 42 | 43 | - Only famous items will get reccomended . 44 | 45 | - New items might not get reccomended at all . 46 | 47 | ### 3 ) Hybrid Based : 48 | 49 | - Hybrid systems, which combine both types of information with the aim of avoiding problems that are generated when working with just one kind. 50 | 51 | - Combination of both and used now a days . 52 | 53 | - Uses : word2vec , embedding . 54 | 55 | # About this project: 56 | 57 | This is a streamlit web application that can recommend various kinds of similar movies based on an user interest. 58 | here is a demo, 59 | 60 | * [Click here to run it live on server](https://movie-recommeder-system.herokuapp.com/) 61 | 62 | 63 | # Demo: 64 | 65 | workflow 66 | 67 | workflow 68 | 69 | workflow 70 | 71 | 72 | # Dataset has been used: 73 | 74 | * [Dataset link](https://www.kaggle.com/tmdb/tmdb-movie-metadata?select=tmdb_5000_movies.csv) 75 | 76 | # Concept used to build the model.pkl file : cosine_similarity 77 | 78 | 1 . Cosine Similarity is a metric that allows you to measure the similarity of the documents. 79 | 80 | 2 . In order to demonstrate cosine similarity function we need vectors. Here vectors are numpy array. 81 | 82 | 3 . Finally, Once we have vectors, We can call cosine_similarity() by passing both vectors. It will calculate the cosine similarity between these two. 83 | 84 | 4 . It will be a value between [0,1]. If it is 0 then both vectors are complete different. But in the place of that if it is 1, It will be completely similar. 85 | 86 | 5 . For more details , check URL : https://www.learndatasci.com/glossary/cosine-similarity/ 87 | 88 | # How to run? 89 | ### STEPS: 90 | 91 | Clone the repository 92 | 93 | ```bash 94 | https://github.com/entbappy/Movie-Recommender-System-Using-Machine-Learning.git 95 | ``` 96 | ### STEP 01- Create a conda environment after opening the repository 97 | 98 | ```bash 99 | conda create -n movie python=3.7.10 -y 100 | ``` 101 | 102 | ```bash 103 | conda activate movie 104 | ``` 105 | 106 | 107 | ### STEP 02- install the requirements 108 | ```bash 109 | pip install -r requirements.txt 110 | ``` 111 | 112 | 113 | ```bash 114 | #run this file to generate the models 115 | 116 | Movie Recommender System Data Analysis.ipynb 117 | ``` 118 | 119 | Now run, 120 | ```bash 121 | streamlit run app.py 122 | ``` 123 | 124 | 125 | ```bash 126 | Author: Bappy Ahmed 127 | Data Scientist 128 | Email: entbappy73@gmail.com 129 | 130 | ``` 131 | -------------------------------------------------------------------------------- /app.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Author: Bappy Ahmed 3 | Email: entbappy73@gmail.com 4 | Date: 2021-Nov-15 5 | ''' 6 | 7 | import pickle 8 | import streamlit as st 9 | import requests 10 | 11 | def fetch_poster(movie_id): 12 | url = "https://api.themoviedb.org/3/movie/{}?api_key=8265bd1679663a7ea12ac168da84d2e8&language=en-US".format(movie_id) 13 | data = requests.get(url) 14 | data = data.json() 15 | poster_path = data['poster_path'] 16 | full_path = "https://image.tmdb.org/t/p/w500/" + poster_path 17 | return full_path 18 | 19 | def recommend(movie): 20 | index = movies[movies['title'] == movie].index[0] 21 | distances = sorted(list(enumerate(similarity[index])), reverse=True, key=lambda x: x[1]) 22 | recommended_movie_names = [] 23 | recommended_movie_posters = [] 24 | for i in distances[1:6]: 25 | # fetch the movie poster 26 | movie_id = movies.iloc[i[0]].movie_id 27 | recommended_movie_posters.append(fetch_poster(movie_id)) 28 | recommended_movie_names.append(movies.iloc[i[0]].title) 29 | 30 | return recommended_movie_names,recommended_movie_posters 31 | 32 | 33 | st.header('Movie Recommender System Using Machine Learning') 34 | movies = pickle.load(open('artifacts/movie_list.pkl','rb')) 35 | similarity = pickle.load(open('artifacts/similarity.pkl','rb')) 36 | 37 | movie_list = movies['title'].values 38 | selected_movie = st.selectbox( 39 | "Type or select a movie from the dropdown", 40 | movie_list 41 | ) 42 | 43 | if st.button('Show Recommendation'): 44 | recommended_movie_names,recommended_movie_posters = recommend(selected_movie) 45 | col1, col2, col3, col4, col5 = st.columns(5) 46 | with col1: 47 | st.text(recommended_movie_names[0]) 48 | st.image(recommended_movie_posters[0]) 49 | with col2: 50 | st.text(recommended_movie_names[1]) 51 | st.image(recommended_movie_posters[1]) 52 | 53 | with col3: 54 | st.text(recommended_movie_names[2]) 55 | st.image(recommended_movie_posters[2]) 56 | with col4: 57 | st.text(recommended_movie_names[3]) 58 | st.image(recommended_movie_posters[3]) 59 | with col5: 60 | st.text(recommended_movie_names[4]) 61 | st.image(recommended_movie_posters[4]) 62 | 63 | -------------------------------------------------------------------------------- /artifacts/.gitignore: -------------------------------------------------------------------------------- 1 | movie_list.pkl 2 | similarity.pkl 3 | -------------------------------------------------------------------------------- /data/.gitignore: -------------------------------------------------------------------------------- 1 | tmdb_5000_credits.csv 2 | tmdb_5000_movies.csv -------------------------------------------------------------------------------- /demo/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/entbappy/Movie-Recommender-System-Using-Machine-Learning/ae06ef2abddf9daacdaf587f335228a494fddffb/demo/1.png -------------------------------------------------------------------------------- /demo/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/entbappy/Movie-Recommender-System-Using-Machine-Learning/ae06ef2abddf9daacdaf587f335228a494fddffb/demo/2.png -------------------------------------------------------------------------------- /demo/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/entbappy/Movie-Recommender-System-Using-Machine-Learning/ae06ef2abddf9daacdaf587f335228a494fddffb/demo/3.png -------------------------------------------------------------------------------- /demo/6.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/entbappy/Movie-Recommender-System-Using-Machine-Learning/ae06ef2abddf9daacdaf587f335228a494fddffb/demo/6.jpeg -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | ### dependency 2 | streamlit 3 | 4 | ### local packages - 5 | -e . 6 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup 2 | 3 | with open("README.md", "r", encoding="utf-8") as f: 4 | long_description = f.read() 5 | 6 | ## edit below variables as per your requirements - 7 | REPO_NAME = "Movie-Recommender-System-Using-Machine-Learning" 8 | AUTHOR_USER_NAME = "entbappy" 9 | SRC_REPO = "src" 10 | LIST_OF_REQUIREMENTS = ['streamlit'] 11 | 12 | 13 | setup( 14 | name=SRC_REPO, 15 | version="0.0.1", 16 | author=AUTHOR_USER_NAME, 17 | description="A small package for Movie Recommender System", 18 | long_description=long_description, 19 | long_description_content_type="text/markdown", 20 | url=f"https://github.com/{AUTHOR_USER_NAME}/{REPO_NAME}", 21 | author_email="entbappy73@gmail.com", 22 | packages=[SRC_REPO], 23 | license="MIT", 24 | python_requires=">=3.7", 25 | install_requires=LIST_OF_REQUIREMENTS 26 | ) 27 | -------------------------------------------------------------------------------- /setup.sh: -------------------------------------------------------------------------------- 1 | mkdir -p ~/.streamlit/ 2 | 3 | echo "\ 4 | [server]\n\ 5 | port = $PORT\n\ 6 | enableCORS = false\n\ 7 | headless = true\n\ 8 | \n\ 9 | " > ~/.streamlit/config.toml -------------------------------------------------------------------------------- /src/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/utils/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | --------------------------------------------------------------------------------