{ "nbformat_minor": 0, "nbformat": 4, "cells": [ { "execution_count": 1, "cell_type": "code", "source": [ "%matplotlib inline\n", "import pandas as pd" ], "outputs": [], "metadata": { "collapsed": false } }, { "execution_count": 2, "cell_type": "code", "source": [ "from IPython.core.display import HTML\n", "css = open('style-table.css').read() + open('style-notebook.css').read()\n", "HTML(''.format(css))" ], "outputs": [ { "execution_count": 2, "output_type": "execute_result", "data": { "text/plain": [ "" ], "text/html": [ "" ] }, "metadata": {} } ], "metadata": { "collapsed": false } }, { "execution_count": 3, "cell_type": "code", "source": [ "titles = pd.DataFrame.from_csv('data/titles.csv', index_col=None)\n", "titles.head()" ], "outputs": [ { "execution_count": 3, "output_type": "execute_result", "data": { "text/plain": [ " title year\n", "0 A L\u00e9lek \u00f3r\u00e1sa 1923\n", "1 Aizaugusa gravi viegli krist 1986\n", "2 Agliyorum 1988\n", "3 0_1_0 2008\n", "4 97 fung lau mung 1994" ], "text/html": [ "
\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
titleyear
0A L\u00e9lek \u00f3r\u00e1sa1923
1Aizaugusa gravi viegli krist1986
2Agliyorum1988
30_1_02008
497 fung lau mung1994
\n", "
" ] }, "metadata": {} } ], "metadata": { "collapsed": false } }, { "execution_count": 4, "cell_type": "code", "source": [ "cast = pd.DataFrame.from_csv('data/cast.csv', index_col=None)\n", "cast.head()" ], "outputs": [ { "execution_count": 4, "output_type": "execute_result", "data": { "text/plain": [ " title year name type \\\n", "0 The Core 2003 Alejandro Abellan actor \n", "1 Il momento di uccidere 1968 Remo De Angelis actor \n", "2 Across the Divide 1921 Thomas Delmar actor \n", "3 Revan 2012 Diego James actor \n", "4 Un homme marche dans la ville 1950 Fabien Loris actor \n", "\n", " character n \n", "0 U.S.S. Soldier NaN \n", "1 Dago 9 \n", "2 Dago 4 \n", "3 Dago NaN \n", "4 Dago 12 " ], "text/html": [ "
\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
titleyearnametypecharactern
0The Core2003Alejandro AbellanactorU.S.S. SoldierNaN
1Il momento di uccidere1968Remo De AngelisactorDago9
2Across the Divide1921Thomas DelmaractorDago4
3Revan2012Diego JamesactorDagoNaN
4Un homme marche dans la ville1950Fabien LorisactorDago12
\n", "
" ] }, "metadata": {} } ], "metadata": { "collapsed": false } }, { "execution_count": null, "cell_type": "code", "source": [], "outputs": [], "metadata": { "collapsed": false } }, { "source": "### Define a year as a \"Superman year\" whose films feature more Superman characters than Batman. How many years in film history have been Superman years?", "cell_type": "markdown", "metadata": { "collapsed": true } }, { "execution_count": null, "cell_type": "code", "source": [], "outputs": [], "metadata": { "collapsed": true } }, { "execution_count": null, "cell_type": "code", "source": [], "outputs": [], "metadata": { "collapsed": true } }, { "source": "### How many years have been \"Batman years\", with more Batman characters than Superman characters?", "cell_type": "markdown", "metadata": { "collapsed": true } }, { "execution_count": null, "cell_type": "code", "source": [], "outputs": [], "metadata": { "collapsed": true } }, { "execution_count": null, "cell_type": "code", "source": [], "outputs": [], "metadata": { "collapsed": true } }, { "source": "### Plot the number of actor roles each year and the number of actress roles each year over the history of film.", "cell_type": "markdown", "metadata": { "collapsed": true } }, { "execution_count": null, "cell_type": "code", "source": [], "outputs": [], "metadata": { "collapsed": true } }, { "execution_count": null, "cell_type": "code", "source": [], "outputs": [], "metadata": { "collapsed": true } }, { "source": "### Plot the number of actor roles each year and the number of actress roles each year, but this time as a kind='area' plot.", "cell_type": "markdown", "metadata": { "collapsed": true } }, { "execution_count": null, "cell_type": "code", "source": [], "outputs": [], "metadata": { "collapsed": true } }, { "execution_count": null, "cell_type": "code", "source": [], "outputs": [], "metadata": { "collapsed": true } }, { "source": "### Plot the difference between the number of actor roles each year and the number of actress roles each year over the history of film.", "cell_type": "markdown", "metadata": { "collapsed": true } }, { "execution_count": null, "cell_type": "code", "source": [], "outputs": [], "metadata": { "collapsed": true } }, { "execution_count": null, "cell_type": "code", "source": [], "outputs": [], "metadata": { "collapsed": true } }, { "source": "### Plot the fraction of roles that have been 'actor' roles each year in the hitsory of film.", "cell_type": "markdown", "metadata": { "collapsed": true } }, { "execution_count": null, "cell_type": "code", "source": [], "outputs": [], "metadata": { "collapsed": true } }, { "execution_count": null, "cell_type": "code", "source": [], "outputs": [], "metadata": { "collapsed": true } }, { "source": "### Plot the fraction of supporting (n=2) roles that have been 'actor' roles each year in the history of film.", "cell_type": "markdown", "metadata": { "collapsed": true } }, { "execution_count": null, "cell_type": "code", "source": [], "outputs": [], "metadata": { "collapsed": true } }, { "execution_count": null, "cell_type": "code", "source": [], "outputs": [], "metadata": { "collapsed": true } }, { "source": "### Build a plot with a line for each rank n=1 through n=3, where the line shows what fraction of that rank's roles were 'actor' roles for each year in the history of film.", "cell_type": "markdown", "metadata": { "collapsed": true } }, { "execution_count": null, "cell_type": "code", "source": [], "outputs": [], "metadata": { "collapsed": true } }, { "execution_count": null, "cell_type": "code", "source": [], "outputs": [], "metadata": { "collapsed": true } } ], "metadata": { "kernelspec": { "display_name": "Python 3", "name": "python3", "language": "python" }, "language_info": { "mimetype": "text/x-python", "nbconvert_exporter": "python", "name": "python", "file_extension": ".py", "version": "3.4.3", "pygments_lexer": "ipython3", "codemirror_mode": { "version": 3, "name": "ipython" } } } }