{ "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": "### Using groupby(), plot the number of films that have been released each decade in the history of cinema.", "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": "### Use groupby() to plot the number of \"Hamlet\" films made each decade.", "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 leading (n=1) roles were available to actors, and how many to actresses, in each year of the 1950s?", "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": "### In the 1950s decade taken as a whole, how many total roles were available to actors, and how many to actresses, for each \"n\" number 1 through 5?", "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": "### Use groupby() to determine how many roles are listed for each of the Pink Panther movies.", "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": "### List, in order by year, each of the films in which Frank Oz has played more than 1 role.", "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": "### List each of the characters that Frank Oz has portrayed at least twice.", "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" } } } }