diff --git a/All.ipynb b/All.ipynb
index d42518b..21c6a6b 100644
--- a/All.ipynb
+++ b/All.ipynb
@@ -6399,21 +6399,1334 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 228,
"metadata": {
- "collapsed": true
+ "collapsed": false
},
- "outputs": [],
- "source": []
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "
\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " title | \n",
+ " year | \n",
+ " name | \n",
+ " type | \n",
+ " character | \n",
+ " n | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | 0 | \n",
+ " The Core | \n",
+ " 2003 | \n",
+ " Alejandro Abellan | \n",
+ " actor | \n",
+ " U.S.S. Soldier | \n",
+ " NaN | \n",
+ "
\n",
+ " \n",
+ " | 1 | \n",
+ " Il momento di uccidere | \n",
+ " 1968 | \n",
+ " Remo De Angelis | \n",
+ " actor | \n",
+ " Dago | \n",
+ " 9 | \n",
+ "
\n",
+ " \n",
+ " | 2 | \n",
+ " Across the Divide | \n",
+ " 1921 | \n",
+ " Thomas Delmar | \n",
+ " actor | \n",
+ " Dago | \n",
+ " 4 | \n",
+ "
\n",
+ " \n",
+ " | 3 | \n",
+ " Revan | \n",
+ " 2012 | \n",
+ " Diego James | \n",
+ " actor | \n",
+ " Dago | \n",
+ " NaN | \n",
+ "
\n",
+ " \n",
+ " | 4 | \n",
+ " Un homme marche dans la ville | \n",
+ " 1950 | \n",
+ " Fabien Loris | \n",
+ " actor | \n",
+ " Dago | \n",
+ " 12 | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
"
+ ],
+ "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 "
+ ]
+ },
+ "execution_count": 228,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "cast.head()"
+ ]
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 243,
"metadata": {
- "collapsed": true
+ "collapsed": false
},
- "outputs": [],
- "source": []
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " title | \n",
+ " year | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | 0 | \n",
+ " The Core | \n",
+ " 2003 | \n",
+ "
\n",
+ " \n",
+ " | 1 | \n",
+ " Il momento di uccidere | \n",
+ " 1968 | \n",
+ "
\n",
+ " \n",
+ " | 2 | \n",
+ " Across the Divide | \n",
+ " 1921 | \n",
+ "
\n",
+ " \n",
+ " | 3 | \n",
+ " Revan | \n",
+ " 2012 | \n",
+ "
\n",
+ " \n",
+ " | 4 | \n",
+ " Un homme marche dans la ville | \n",
+ " 1950 | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
"
+ ],
+ "text/plain": [
+ " title year\n",
+ "0 The Core 2003\n",
+ "1 Il momento di uccidere 1968\n",
+ "2 Across the Divide 1921\n",
+ "3 Revan 2012\n",
+ "4 Un homme marche dans la ville 1950"
+ ]
+ },
+ "execution_count": 243,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "t = titles\n",
+ "\n",
+ "t.head()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 246,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " | \n",
+ " title | \n",
+ " name | \n",
+ " type | \n",
+ " n | \n",
+ "
\n",
+ " \n",
+ " | year | \n",
+ " character | \n",
+ " | \n",
+ " | \n",
+ " | \n",
+ " | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | 1964 | \n",
+ " Lady | \n",
+ " Hamlet | \n",
+ " Kate Beswick | \n",
+ " actress | \n",
+ " NaN | \n",
+ "
\n",
+ " \n",
+ " | Lady | \n",
+ " Hamlet | \n",
+ " Carol Teitel | \n",
+ " actress | \n",
+ " NaN | \n",
+ "
\n",
+ " \n",
+ " | 2000 | \n",
+ " Special Guest Appearance | \n",
+ " Hamlet | \n",
+ " Paul Ferriter | \n",
+ " actor | \n",
+ " 23 | \n",
+ "
\n",
+ " \n",
+ " | Special Guest Appearance | \n",
+ " Hamlet | \n",
+ " Paul Graham (IV) | \n",
+ " actor | \n",
+ " 27 | \n",
+ "
\n",
+ " \n",
+ " | Special Guest Appearance | \n",
+ " Hamlet | \n",
+ " Henry Griffin (II) | \n",
+ " actor | \n",
+ " 28 | \n",
+ "
\n",
+ " \n",
+ " | Special Guest Appearance | \n",
+ " Hamlet | \n",
+ " Ayun Halliday | \n",
+ " actor | \n",
+ " 30 | \n",
+ "
\n",
+ " \n",
+ " | Special Guest Appearance | \n",
+ " Hamlet | \n",
+ " Greg Kotis | \n",
+ " actor | \n",
+ " 31 | \n",
+ "
\n",
+ " \n",
+ " | Special Guest Appearance | \n",
+ " Hamlet | \n",
+ " Barry Manasch | \n",
+ " actor | \n",
+ " 32 | \n",
+ "
\n",
+ " \n",
+ " | Special Guest Appearance | \n",
+ " Hamlet | \n",
+ " Philip McKenney | \n",
+ " actor | \n",
+ " 33 | \n",
+ "
\n",
+ " \n",
+ " | Special Guest Appearance | \n",
+ " Hamlet | \n",
+ " Colin Puth | \n",
+ " actor | \n",
+ " 35 | \n",
+ "
\n",
+ " \n",
+ " | Special Guest Appearance | \n",
+ " Hamlet | \n",
+ " Giancarlo Roma | \n",
+ " actor | \n",
+ " 37 | \n",
+ "
\n",
+ " \n",
+ " | Special Guest Appearance | \n",
+ " Hamlet | \n",
+ " Thomas Roma | \n",
+ " actor | \n",
+ " 38 | \n",
+ "
\n",
+ " \n",
+ " | Special Guest Appearance | \n",
+ " Hamlet | \n",
+ " D.J. Dara | \n",
+ " actress | \n",
+ " 21 | \n",
+ "
\n",
+ " \n",
+ " | Special Guest Appearance | \n",
+ " Hamlet | \n",
+ " Sinead Dolan | \n",
+ " actress | \n",
+ " 22 | \n",
+ "
\n",
+ " \n",
+ " | Special Guest Appearance | \n",
+ " Hamlet | \n",
+ " Sarah Fiol | \n",
+ " actress | \n",
+ " 25 | \n",
+ "
\n",
+ " \n",
+ " | Special Guest Appearance | \n",
+ " Hamlet | \n",
+ " Tanya Gingerich | \n",
+ " actress | \n",
+ " 26 | \n",
+ "
\n",
+ " \n",
+ " | Special Guest Appearance | \n",
+ " Hamlet | \n",
+ " Anne Nixon (II) | \n",
+ " actress | \n",
+ " 34 | \n",
+ "
\n",
+ " \n",
+ " | Special Guest Appearance | \n",
+ " Hamlet | \n",
+ " India Reed Kotis | \n",
+ " actress | \n",
+ " 29 | \n",
+ "
\n",
+ " \n",
+ " | 1964 | \n",
+ " Gentleman | \n",
+ " Hamlet | \n",
+ " Richard Sterne | \n",
+ " actor | \n",
+ " NaN | \n",
+ "
\n",
+ " \n",
+ " | 1969 | \n",
+ " First Player | \n",
+ " Hamlet | \n",
+ " Roger Livesey | \n",
+ " actor | \n",
+ " 11 | \n",
+ "
\n",
+ " \n",
+ " | 1996 | \n",
+ " First Player | \n",
+ " Hamlet | \n",
+ " Ben Thom | \n",
+ " actor | \n",
+ " 42 | \n",
+ "
\n",
+ " \n",
+ " | 1948 | \n",
+ " First Player | \n",
+ " Hamlet | \n",
+ " Harcourt Williams | \n",
+ " actor | \n",
+ " 5 | \n",
+ "
\n",
+ " \n",
+ " | 2009 | \n",
+ " Bernardo | \n",
+ " Hamlet | \n",
+ " Matt Hurley (II) | \n",
+ " actor | \n",
+ " 10 | \n",
+ "
\n",
+ " \n",
+ " | 1948 | \n",
+ " Bernardo | \n",
+ " Hamlet | \n",
+ " Esmond Knight | \n",
+ " actor | \n",
+ " 2 | \n",
+ "
\n",
+ " \n",
+ " | 1913 | \n",
+ " Bernardo | \n",
+ " Hamlet | \n",
+ " G. Richards (II) | \n",
+ " actor | \n",
+ " 12 | \n",
+ "
\n",
+ " \n",
+ " | 1990 | \n",
+ " Bernardo | \n",
+ " Hamlet | \n",
+ " Richard Warwick | \n",
+ " actor | \n",
+ " 13 | \n",
+ "
\n",
+ " \n",
+ " | 1964 | \n",
+ " Bernardo | \n",
+ " Hamlet | \n",
+ " Frederick Young | \n",
+ " actor | \n",
+ " NaN | \n",
+ "
\n",
+ " \n",
+ " | 2009 | \n",
+ " Laertes | \n",
+ " Hamlet | \n",
+ " Hayden Adams | \n",
+ " actor | \n",
+ " 7 | \n",
+ "
\n",
+ " \n",
+ " | 1964 | \n",
+ " Laertes | \n",
+ " Hamlet | \n",
+ " John Cullum | \n",
+ " actor | \n",
+ " NaN | \n",
+ "
\n",
+ " \n",
+ " | 1921 | \n",
+ " Laertes | \n",
+ " Hamlet | \n",
+ " Anton De Verdier | \n",
+ " actor | \n",
+ " 7 | \n",
+ "
\n",
+ " \n",
+ " | ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ "
\n",
+ " \n",
+ " | 1948 | \n",
+ " Lady of the Court | \n",
+ " Hamlet | \n",
+ " Patricia Davidson (II) | \n",
+ " actress | \n",
+ " NaN | \n",
+ "
\n",
+ " \n",
+ " | 1964 | \n",
+ " Fortinbras's Captain | \n",
+ " Hamlet | \n",
+ " Dillon Evans | \n",
+ " actor | \n",
+ " NaN | \n",
+ "
\n",
+ " \n",
+ " | 1996 | \n",
+ " Fortinbras's Captain | \n",
+ " Hamlet | \n",
+ " Jeffery Kissoon | \n",
+ " actor | \n",
+ " 27 | \n",
+ "
\n",
+ " \n",
+ " | Fortinbras's Captain | \n",
+ " Hamlet | \n",
+ " John Spencer-Churchill | \n",
+ " actor | \n",
+ " 32 | \n",
+ "
\n",
+ " \n",
+ " | 2015 | \n",
+ " Polonia | \n",
+ " Hamlet | \n",
+ " Gillian Bevan | \n",
+ " actress | \n",
+ " 4 | \n",
+ "
\n",
+ " \n",
+ " | 1969 | \n",
+ " Court Lady | \n",
+ " Hamlet | \n",
+ " Anjelica Huston | \n",
+ " actress | \n",
+ " 18 | \n",
+ "
\n",
+ " \n",
+ " | 1996 | \n",
+ " Sailor One | \n",
+ " Hamlet | \n",
+ " David Yip | \n",
+ " actor | \n",
+ " 47 | \n",
+ "
\n",
+ " \n",
+ " | Young Hamlet | \n",
+ " Hamlet | \n",
+ " Thomas Szekeres | \n",
+ " actor | \n",
+ " 41 | \n",
+ "
\n",
+ " \n",
+ " | 1990 | \n",
+ " Palace Nobleman | \n",
+ " Hamlet | \n",
+ " Barrie Holland | \n",
+ " actor | \n",
+ " NaN | \n",
+ "
\n",
+ " \n",
+ " | 1964 | \n",
+ " Player Prologue | \n",
+ " Hamlet | \n",
+ " John Hetherington | \n",
+ " actor | \n",
+ " NaN | \n",
+ "
\n",
+ " \n",
+ " | 1973 | \n",
+ " Claudius, King of Denmark | \n",
+ " Hamlet | \n",
+ " Dan Hennessey | \n",
+ " actor | \n",
+ " NaN | \n",
+ "
\n",
+ " \n",
+ " | 1948 | \n",
+ " Spear Carrier | \n",
+ " Hamlet | \n",
+ " Christopher Lee | \n",
+ " actor | \n",
+ " NaN | \n",
+ "
\n",
+ " \n",
+ " | 1996 | \n",
+ " Elsinore Courtier | \n",
+ " Hamlet | \n",
+ " Anthony Maddalena | \n",
+ " actor | \n",
+ " NaN | \n",
+ "
\n",
+ " \n",
+ " | 2000 | \n",
+ " Claudius' Bodyguard | \n",
+ " Hamlet | \n",
+ " John Wills Martin | \n",
+ " actor | \n",
+ " 18 | \n",
+ "
\n",
+ " \n",
+ " | 1948 | \n",
+ " Laertes - His Son | \n",
+ " Hamlet | \n",
+ " Terence Morgan (II) | \n",
+ " actor | \n",
+ " 16 | \n",
+ "
\n",
+ " \n",
+ " | 1996 | \n",
+ " Old Norway | \n",
+ " Hamlet | \n",
+ " John Mills | \n",
+ " actor | \n",
+ " 33 | \n",
+ "
\n",
+ " \n",
+ " | Sailor Two | \n",
+ " Hamlet | \n",
+ " Jimi Mistry | \n",
+ " actor | \n",
+ " 34 | \n",
+ "
\n",
+ " \n",
+ " | 1948 | \n",
+ " Voice of Ghost | \n",
+ " Hamlet | \n",
+ " Laurence Olivier | \n",
+ " actor | \n",
+ " 13 | \n",
+ "
\n",
+ " \n",
+ " | 1913 | \n",
+ " Rosencrants | \n",
+ " Hamlet | \n",
+ " Montagu Rutherford | \n",
+ " actor | \n",
+ " 8 | \n",
+ "
\n",
+ " \n",
+ " | 1969 | \n",
+ " Court lady | \n",
+ " Hamlet | \n",
+ " Jennifer Tudor | \n",
+ " actress | \n",
+ " 23 | \n",
+ "
\n",
+ " \n",
+ " | 1948 | \n",
+ " Claudius - The King | \n",
+ " Hamlet | \n",
+ " Basil Sydney | \n",
+ " actor | \n",
+ " 11 | \n",
+ "
\n",
+ " \n",
+ " | Horatio - His Friend | \n",
+ " Hamlet | \n",
+ " Norman Wooland | \n",
+ " actor | \n",
+ " 14 | \n",
+ "
\n",
+ " \n",
+ " | 1996 | \n",
+ " Hecuba | \n",
+ " Hamlet | \n",
+ " Judi Dench | \n",
+ " actress | \n",
+ " 12 | \n",
+ "
\n",
+ " \n",
+ " | 1921 | \n",
+ " Königin Gertrude | \n",
+ " Hamlet | \n",
+ " Mathilde Brandt | \n",
+ " actress | \n",
+ " 3 | \n",
+ "
\n",
+ " \n",
+ " | 1996 | \n",
+ " Attendant to Gertrude | \n",
+ " Hamlet | \n",
+ " Angela Douglas | \n",
+ " actress | \n",
+ " 16 | \n",
+ "
\n",
+ " \n",
+ " | Attendant to Gertrude | \n",
+ " Hamlet | \n",
+ " Rowena King | \n",
+ " actress | \n",
+ " 26 | \n",
+ "
\n",
+ " \n",
+ " | Attendant to Gertrude | \n",
+ " Hamlet | \n",
+ " Sarah Lam | \n",
+ " actress | \n",
+ " 28 | \n",
+ "
\n",
+ " \n",
+ " | 1948 | \n",
+ " Gertrude - The Queen | \n",
+ " Hamlet | \n",
+ " Eileen Herlie | \n",
+ " actress | \n",
+ " 12 | \n",
+ "
\n",
+ " \n",
+ " | 1973 | \n",
+ " Gertrude, Queen of Denmark | \n",
+ " Hamlet | \n",
+ " Becke Keller | \n",
+ " actress | \n",
+ " NaN | \n",
+ "
\n",
+ " \n",
+ " | 1948 | \n",
+ " Ophelia - and Daughter | \n",
+ " Hamlet | \n",
+ " Jean Simmons | \n",
+ " actress | \n",
+ " 17 | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
299 rows × 4 columns
\n",
+ "
"
+ ],
+ "text/plain": [
+ " title name type n\n",
+ "year character \n",
+ "1964 Lady Hamlet Kate Beswick actress NaN\n",
+ " Lady Hamlet Carol Teitel actress NaN\n",
+ "2000 Special Guest Appearance Hamlet Paul Ferriter actor 23\n",
+ " Special Guest Appearance Hamlet Paul Graham (IV) actor 27\n",
+ " Special Guest Appearance Hamlet Henry Griffin (II) actor 28\n",
+ " Special Guest Appearance Hamlet Ayun Halliday actor 30\n",
+ " Special Guest Appearance Hamlet Greg Kotis actor 31\n",
+ " Special Guest Appearance Hamlet Barry Manasch actor 32\n",
+ " Special Guest Appearance Hamlet Philip McKenney actor 33\n",
+ " Special Guest Appearance Hamlet Colin Puth actor 35\n",
+ " Special Guest Appearance Hamlet Giancarlo Roma actor 37\n",
+ " Special Guest Appearance Hamlet Thomas Roma actor 38\n",
+ " Special Guest Appearance Hamlet D.J. Dara actress 21\n",
+ " Special Guest Appearance Hamlet Sinead Dolan actress 22\n",
+ " Special Guest Appearance Hamlet Sarah Fiol actress 25\n",
+ " Special Guest Appearance Hamlet Tanya Gingerich actress 26\n",
+ " Special Guest Appearance Hamlet Anne Nixon (II) actress 34\n",
+ " Special Guest Appearance Hamlet India Reed Kotis actress 29\n",
+ "1964 Gentleman Hamlet Richard Sterne actor NaN\n",
+ "1969 First Player Hamlet Roger Livesey actor 11\n",
+ "1996 First Player Hamlet Ben Thom actor 42\n",
+ "1948 First Player Hamlet Harcourt Williams actor 5\n",
+ "2009 Bernardo Hamlet Matt Hurley (II) actor 10\n",
+ "1948 Bernardo Hamlet Esmond Knight actor 2\n",
+ "1913 Bernardo Hamlet G. Richards (II) actor 12\n",
+ "1990 Bernardo Hamlet Richard Warwick actor 13\n",
+ "1964 Bernardo Hamlet Frederick Young actor NaN\n",
+ "2009 Laertes Hamlet Hayden Adams actor 7\n",
+ "1964 Laertes Hamlet John Cullum actor NaN\n",
+ "1921 Laertes Hamlet Anton De Verdier actor 7\n",
+ "... ... ... ... ..\n",
+ "1948 Lady of the Court Hamlet Patricia Davidson (II) actress NaN\n",
+ "1964 Fortinbras's Captain Hamlet Dillon Evans actor NaN\n",
+ "1996 Fortinbras's Captain Hamlet Jeffery Kissoon actor 27\n",
+ " Fortinbras's Captain Hamlet John Spencer-Churchill actor 32\n",
+ "2015 Polonia Hamlet Gillian Bevan actress 4\n",
+ "1969 Court Lady Hamlet Anjelica Huston actress 18\n",
+ "1996 Sailor One Hamlet David Yip actor 47\n",
+ " Young Hamlet Hamlet Thomas Szekeres actor 41\n",
+ "1990 Palace Nobleman Hamlet Barrie Holland actor NaN\n",
+ "1964 Player Prologue Hamlet John Hetherington actor NaN\n",
+ "1973 Claudius, King of Denmark Hamlet Dan Hennessey actor NaN\n",
+ "1948 Spear Carrier Hamlet Christopher Lee actor NaN\n",
+ "1996 Elsinore Courtier Hamlet Anthony Maddalena actor NaN\n",
+ "2000 Claudius' Bodyguard Hamlet John Wills Martin actor 18\n",
+ "1948 Laertes - His Son Hamlet Terence Morgan (II) actor 16\n",
+ "1996 Old Norway Hamlet John Mills actor 33\n",
+ " Sailor Two Hamlet Jimi Mistry actor 34\n",
+ "1948 Voice of Ghost Hamlet Laurence Olivier actor 13\n",
+ "1913 Rosencrants Hamlet Montagu Rutherford actor 8\n",
+ "1969 Court lady Hamlet Jennifer Tudor actress 23\n",
+ "1948 Claudius - The King Hamlet Basil Sydney actor 11\n",
+ " Horatio - His Friend Hamlet Norman Wooland actor 14\n",
+ "1996 Hecuba Hamlet Judi Dench actress 12\n",
+ "1921 Königin Gertrude Hamlet Mathilde Brandt actress 3\n",
+ "1996 Attendant to Gertrude Hamlet Angela Douglas actress 16\n",
+ " Attendant to Gertrude Hamlet Rowena King actress 26\n",
+ " Attendant to Gertrude Hamlet Sarah Lam actress 28\n",
+ "1948 Gertrude - The Queen Hamlet Eileen Herlie actress 12\n",
+ "1973 Gertrude, Queen of Denmark Hamlet Becke Keller actress NaN\n",
+ "1948 Ophelia - and Daughter Hamlet Jean Simmons actress 17\n",
+ "\n",
+ "[299 rows x 4 columns]"
+ ]
+ },
+ "execution_count": 246,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "c = cast\n",
+ "c = c[c.title == 'Hamlet']\n",
+ "c = c.set_index(['year', 'character'])#.unstack('type')\n",
+ "c"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 239,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " | \n",
+ " title | \n",
+ " name | \n",
+ " character | \n",
+ " n | \n",
+ "
\n",
+ " \n",
+ " | year | \n",
+ " type | \n",
+ " | \n",
+ " | \n",
+ " | \n",
+ " | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | 1964 | \n",
+ " actress | \n",
+ " Hamlet | \n",
+ " Kate Beswick | \n",
+ " Lady | \n",
+ " NaN | \n",
+ "
\n",
+ " \n",
+ " | actress | \n",
+ " Hamlet | \n",
+ " Carol Teitel | \n",
+ " Lady | \n",
+ " NaN | \n",
+ "
\n",
+ " \n",
+ " | 2000 | \n",
+ " actor | \n",
+ " Hamlet | \n",
+ " Paul Ferriter | \n",
+ " Special Guest Appearance | \n",
+ " 23 | \n",
+ "
\n",
+ " \n",
+ " | actor | \n",
+ " Hamlet | \n",
+ " Paul Graham (IV) | \n",
+ " Special Guest Appearance | \n",
+ " 27 | \n",
+ "
\n",
+ " \n",
+ " | actor | \n",
+ " Hamlet | \n",
+ " Henry Griffin (II) | \n",
+ " Special Guest Appearance | \n",
+ " 28 | \n",
+ "
\n",
+ " \n",
+ " | actor | \n",
+ " Hamlet | \n",
+ " Ayun Halliday | \n",
+ " Special Guest Appearance | \n",
+ " 30 | \n",
+ "
\n",
+ " \n",
+ " | actor | \n",
+ " Hamlet | \n",
+ " Greg Kotis | \n",
+ " Special Guest Appearance | \n",
+ " 31 | \n",
+ "
\n",
+ " \n",
+ " | actor | \n",
+ " Hamlet | \n",
+ " Barry Manasch | \n",
+ " Special Guest Appearance | \n",
+ " 32 | \n",
+ "
\n",
+ " \n",
+ " | actor | \n",
+ " Hamlet | \n",
+ " Philip McKenney | \n",
+ " Special Guest Appearance | \n",
+ " 33 | \n",
+ "
\n",
+ " \n",
+ " | actor | \n",
+ " Hamlet | \n",
+ " Colin Puth | \n",
+ " Special Guest Appearance | \n",
+ " 35 | \n",
+ "
\n",
+ " \n",
+ " | actor | \n",
+ " Hamlet | \n",
+ " Giancarlo Roma | \n",
+ " Special Guest Appearance | \n",
+ " 37 | \n",
+ "
\n",
+ " \n",
+ " | actor | \n",
+ " Hamlet | \n",
+ " Thomas Roma | \n",
+ " Special Guest Appearance | \n",
+ " 38 | \n",
+ "
\n",
+ " \n",
+ " | actress | \n",
+ " Hamlet | \n",
+ " D.J. Dara | \n",
+ " Special Guest Appearance | \n",
+ " 21 | \n",
+ "
\n",
+ " \n",
+ " | actress | \n",
+ " Hamlet | \n",
+ " Sinead Dolan | \n",
+ " Special Guest Appearance | \n",
+ " 22 | \n",
+ "
\n",
+ " \n",
+ " | actress | \n",
+ " Hamlet | \n",
+ " Sarah Fiol | \n",
+ " Special Guest Appearance | \n",
+ " 25 | \n",
+ "
\n",
+ " \n",
+ " | actress | \n",
+ " Hamlet | \n",
+ " Tanya Gingerich | \n",
+ " Special Guest Appearance | \n",
+ " 26 | \n",
+ "
\n",
+ " \n",
+ " | actress | \n",
+ " Hamlet | \n",
+ " Anne Nixon (II) | \n",
+ " Special Guest Appearance | \n",
+ " 34 | \n",
+ "
\n",
+ " \n",
+ " | actress | \n",
+ " Hamlet | \n",
+ " India Reed Kotis | \n",
+ " Special Guest Appearance | \n",
+ " 29 | \n",
+ "
\n",
+ " \n",
+ " | 1964 | \n",
+ " actor | \n",
+ " Hamlet | \n",
+ " Richard Sterne | \n",
+ " Gentleman | \n",
+ " NaN | \n",
+ "
\n",
+ " \n",
+ " | 1969 | \n",
+ " actor | \n",
+ " Hamlet | \n",
+ " Roger Livesey | \n",
+ " First Player | \n",
+ " 11 | \n",
+ "
\n",
+ " \n",
+ " | 1996 | \n",
+ " actor | \n",
+ " Hamlet | \n",
+ " Ben Thom | \n",
+ " First Player | \n",
+ " 42 | \n",
+ "
\n",
+ " \n",
+ " | 1948 | \n",
+ " actor | \n",
+ " Hamlet | \n",
+ " Harcourt Williams | \n",
+ " First Player | \n",
+ " 5 | \n",
+ "
\n",
+ " \n",
+ " | 2009 | \n",
+ " actor | \n",
+ " Hamlet | \n",
+ " Matt Hurley (II) | \n",
+ " Bernardo | \n",
+ " 10 | \n",
+ "
\n",
+ " \n",
+ " | 1948 | \n",
+ " actor | \n",
+ " Hamlet | \n",
+ " Esmond Knight | \n",
+ " Bernardo | \n",
+ " 2 | \n",
+ "
\n",
+ " \n",
+ " | 1913 | \n",
+ " actor | \n",
+ " Hamlet | \n",
+ " G. Richards (II) | \n",
+ " Bernardo | \n",
+ " 12 | \n",
+ "
\n",
+ " \n",
+ " | 1990 | \n",
+ " actor | \n",
+ " Hamlet | \n",
+ " Richard Warwick | \n",
+ " Bernardo | \n",
+ " 13 | \n",
+ "
\n",
+ " \n",
+ " | 1964 | \n",
+ " actor | \n",
+ " Hamlet | \n",
+ " Frederick Young | \n",
+ " Bernardo | \n",
+ " NaN | \n",
+ "
\n",
+ " \n",
+ " | 2009 | \n",
+ " actor | \n",
+ " Hamlet | \n",
+ " Hayden Adams | \n",
+ " Laertes | \n",
+ " 7 | \n",
+ "
\n",
+ " \n",
+ " | 1964 | \n",
+ " actor | \n",
+ " Hamlet | \n",
+ " John Cullum | \n",
+ " Laertes | \n",
+ " NaN | \n",
+ "
\n",
+ " \n",
+ " | 1921 | \n",
+ " actor | \n",
+ " Hamlet | \n",
+ " Anton De Verdier | \n",
+ " Laertes | \n",
+ " 7 | \n",
+ "
\n",
+ " \n",
+ " | ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ "
\n",
+ " \n",
+ " | 1948 | \n",
+ " actress | \n",
+ " Hamlet | \n",
+ " Patricia Davidson (II) | \n",
+ " Lady of the Court | \n",
+ " NaN | \n",
+ "
\n",
+ " \n",
+ " | 1964 | \n",
+ " actor | \n",
+ " Hamlet | \n",
+ " Dillon Evans | \n",
+ " Fortinbras's Captain | \n",
+ " NaN | \n",
+ "
\n",
+ " \n",
+ " | 1996 | \n",
+ " actor | \n",
+ " Hamlet | \n",
+ " Jeffery Kissoon | \n",
+ " Fortinbras's Captain | \n",
+ " 27 | \n",
+ "
\n",
+ " \n",
+ " | actor | \n",
+ " Hamlet | \n",
+ " John Spencer-Churchill | \n",
+ " Fortinbras's Captain | \n",
+ " 32 | \n",
+ "
\n",
+ " \n",
+ " | 2015 | \n",
+ " actress | \n",
+ " Hamlet | \n",
+ " Gillian Bevan | \n",
+ " Polonia | \n",
+ " 4 | \n",
+ "
\n",
+ " \n",
+ " | 1969 | \n",
+ " actress | \n",
+ " Hamlet | \n",
+ " Anjelica Huston | \n",
+ " Court Lady | \n",
+ " 18 | \n",
+ "
\n",
+ " \n",
+ " | 1996 | \n",
+ " actor | \n",
+ " Hamlet | \n",
+ " David Yip | \n",
+ " Sailor One | \n",
+ " 47 | \n",
+ "
\n",
+ " \n",
+ " | actor | \n",
+ " Hamlet | \n",
+ " Thomas Szekeres | \n",
+ " Young Hamlet | \n",
+ " 41 | \n",
+ "
\n",
+ " \n",
+ " | 1990 | \n",
+ " actor | \n",
+ " Hamlet | \n",
+ " Barrie Holland | \n",
+ " Palace Nobleman | \n",
+ " NaN | \n",
+ "
\n",
+ " \n",
+ " | 1964 | \n",
+ " actor | \n",
+ " Hamlet | \n",
+ " John Hetherington | \n",
+ " Player Prologue | \n",
+ " NaN | \n",
+ "
\n",
+ " \n",
+ " | 1973 | \n",
+ " actor | \n",
+ " Hamlet | \n",
+ " Dan Hennessey | \n",
+ " Claudius, King of Denmark | \n",
+ " NaN | \n",
+ "
\n",
+ " \n",
+ " | 1948 | \n",
+ " actor | \n",
+ " Hamlet | \n",
+ " Christopher Lee | \n",
+ " Spear Carrier | \n",
+ " NaN | \n",
+ "
\n",
+ " \n",
+ " | 1996 | \n",
+ " actor | \n",
+ " Hamlet | \n",
+ " Anthony Maddalena | \n",
+ " Elsinore Courtier | \n",
+ " NaN | \n",
+ "
\n",
+ " \n",
+ " | 2000 | \n",
+ " actor | \n",
+ " Hamlet | \n",
+ " John Wills Martin | \n",
+ " Claudius' Bodyguard | \n",
+ " 18 | \n",
+ "
\n",
+ " \n",
+ " | 1948 | \n",
+ " actor | \n",
+ " Hamlet | \n",
+ " Terence Morgan (II) | \n",
+ " Laertes - His Son | \n",
+ " 16 | \n",
+ "
\n",
+ " \n",
+ " | 1996 | \n",
+ " actor | \n",
+ " Hamlet | \n",
+ " John Mills | \n",
+ " Old Norway | \n",
+ " 33 | \n",
+ "
\n",
+ " \n",
+ " | actor | \n",
+ " Hamlet | \n",
+ " Jimi Mistry | \n",
+ " Sailor Two | \n",
+ " 34 | \n",
+ "
\n",
+ " \n",
+ " | 1948 | \n",
+ " actor | \n",
+ " Hamlet | \n",
+ " Laurence Olivier | \n",
+ " Voice of Ghost | \n",
+ " 13 | \n",
+ "
\n",
+ " \n",
+ " | 1913 | \n",
+ " actor | \n",
+ " Hamlet | \n",
+ " Montagu Rutherford | \n",
+ " Rosencrants | \n",
+ " 8 | \n",
+ "
\n",
+ " \n",
+ " | 1969 | \n",
+ " actress | \n",
+ " Hamlet | \n",
+ " Jennifer Tudor | \n",
+ " Court lady | \n",
+ " 23 | \n",
+ "
\n",
+ " \n",
+ " | 1948 | \n",
+ " actor | \n",
+ " Hamlet | \n",
+ " Basil Sydney | \n",
+ " Claudius - The King | \n",
+ " 11 | \n",
+ "
\n",
+ " \n",
+ " | actor | \n",
+ " Hamlet | \n",
+ " Norman Wooland | \n",
+ " Horatio - His Friend | \n",
+ " 14 | \n",
+ "
\n",
+ " \n",
+ " | 1996 | \n",
+ " actress | \n",
+ " Hamlet | \n",
+ " Judi Dench | \n",
+ " Hecuba | \n",
+ " 12 | \n",
+ "
\n",
+ " \n",
+ " | 1921 | \n",
+ " actress | \n",
+ " Hamlet | \n",
+ " Mathilde Brandt | \n",
+ " Königin Gertrude | \n",
+ " 3 | \n",
+ "
\n",
+ " \n",
+ " | 1996 | \n",
+ " actress | \n",
+ " Hamlet | \n",
+ " Angela Douglas | \n",
+ " Attendant to Gertrude | \n",
+ " 16 | \n",
+ "
\n",
+ " \n",
+ " | actress | \n",
+ " Hamlet | \n",
+ " Rowena King | \n",
+ " Attendant to Gertrude | \n",
+ " 26 | \n",
+ "
\n",
+ " \n",
+ " | actress | \n",
+ " Hamlet | \n",
+ " Sarah Lam | \n",
+ " Attendant to Gertrude | \n",
+ " 28 | \n",
+ "
\n",
+ " \n",
+ " | 1948 | \n",
+ " actress | \n",
+ " Hamlet | \n",
+ " Eileen Herlie | \n",
+ " Gertrude - The Queen | \n",
+ " 12 | \n",
+ "
\n",
+ " \n",
+ " | 1973 | \n",
+ " actress | \n",
+ " Hamlet | \n",
+ " Becke Keller | \n",
+ " Gertrude, Queen of Denmark | \n",
+ " NaN | \n",
+ "
\n",
+ " \n",
+ " | 1948 | \n",
+ " actress | \n",
+ " Hamlet | \n",
+ " Jean Simmons | \n",
+ " Ophelia - and Daughter | \n",
+ " 17 | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
299 rows × 4 columns
\n",
+ "
"
+ ],
+ "text/plain": [
+ " title name character n\n",
+ "year type \n",
+ "1964 actress Hamlet Kate Beswick Lady NaN\n",
+ " actress Hamlet Carol Teitel Lady NaN\n",
+ "2000 actor Hamlet Paul Ferriter Special Guest Appearance 23\n",
+ " actor Hamlet Paul Graham (IV) Special Guest Appearance 27\n",
+ " actor Hamlet Henry Griffin (II) Special Guest Appearance 28\n",
+ " actor Hamlet Ayun Halliday Special Guest Appearance 30\n",
+ " actor Hamlet Greg Kotis Special Guest Appearance 31\n",
+ " actor Hamlet Barry Manasch Special Guest Appearance 32\n",
+ " actor Hamlet Philip McKenney Special Guest Appearance 33\n",
+ " actor Hamlet Colin Puth Special Guest Appearance 35\n",
+ " actor Hamlet Giancarlo Roma Special Guest Appearance 37\n",
+ " actor Hamlet Thomas Roma Special Guest Appearance 38\n",
+ " actress Hamlet D.J. Dara Special Guest Appearance 21\n",
+ " actress Hamlet Sinead Dolan Special Guest Appearance 22\n",
+ " actress Hamlet Sarah Fiol Special Guest Appearance 25\n",
+ " actress Hamlet Tanya Gingerich Special Guest Appearance 26\n",
+ " actress Hamlet Anne Nixon (II) Special Guest Appearance 34\n",
+ " actress Hamlet India Reed Kotis Special Guest Appearance 29\n",
+ "1964 actor Hamlet Richard Sterne Gentleman NaN\n",
+ "1969 actor Hamlet Roger Livesey First Player 11\n",
+ "1996 actor Hamlet Ben Thom First Player 42\n",
+ "1948 actor Hamlet Harcourt Williams First Player 5\n",
+ "2009 actor Hamlet Matt Hurley (II) Bernardo 10\n",
+ "1948 actor Hamlet Esmond Knight Bernardo 2\n",
+ "1913 actor Hamlet G. Richards (II) Bernardo 12\n",
+ "1990 actor Hamlet Richard Warwick Bernardo 13\n",
+ "1964 actor Hamlet Frederick Young Bernardo NaN\n",
+ "2009 actor Hamlet Hayden Adams Laertes 7\n",
+ "1964 actor Hamlet John Cullum Laertes NaN\n",
+ "1921 actor Hamlet Anton De Verdier Laertes 7\n",
+ "... ... ... ... ..\n",
+ "1948 actress Hamlet Patricia Davidson (II) Lady of the Court NaN\n",
+ "1964 actor Hamlet Dillon Evans Fortinbras's Captain NaN\n",
+ "1996 actor Hamlet Jeffery Kissoon Fortinbras's Captain 27\n",
+ " actor Hamlet John Spencer-Churchill Fortinbras's Captain 32\n",
+ "2015 actress Hamlet Gillian Bevan Polonia 4\n",
+ "1969 actress Hamlet Anjelica Huston Court Lady 18\n",
+ "1996 actor Hamlet David Yip Sailor One 47\n",
+ " actor Hamlet Thomas Szekeres Young Hamlet 41\n",
+ "1990 actor Hamlet Barrie Holland Palace Nobleman NaN\n",
+ "1964 actor Hamlet John Hetherington Player Prologue NaN\n",
+ "1973 actor Hamlet Dan Hennessey Claudius, King of Denmark NaN\n",
+ "1948 actor Hamlet Christopher Lee Spear Carrier NaN\n",
+ "1996 actor Hamlet Anthony Maddalena Elsinore Courtier NaN\n",
+ "2000 actor Hamlet John Wills Martin Claudius' Bodyguard 18\n",
+ "1948 actor Hamlet Terence Morgan (II) Laertes - His Son 16\n",
+ "1996 actor Hamlet John Mills Old Norway 33\n",
+ " actor Hamlet Jimi Mistry Sailor Two 34\n",
+ "1948 actor Hamlet Laurence Olivier Voice of Ghost 13\n",
+ "1913 actor Hamlet Montagu Rutherford Rosencrants 8\n",
+ "1969 actress Hamlet Jennifer Tudor Court lady 23\n",
+ "1948 actor Hamlet Basil Sydney Claudius - The King 11\n",
+ " actor Hamlet Norman Wooland Horatio - His Friend 14\n",
+ "1996 actress Hamlet Judi Dench Hecuba 12\n",
+ "1921 actress Hamlet Mathilde Brandt Königin Gertrude 3\n",
+ "1996 actress Hamlet Angela Douglas Attendant to Gertrude 16\n",
+ " actress Hamlet Rowena King Attendant to Gertrude 26\n",
+ " actress Hamlet Sarah Lam Attendant to Gertrude 28\n",
+ "1948 actress Hamlet Eileen Herlie Gertrude - The Queen 12\n",
+ "1973 actress Hamlet Becke Keller Gertrude, Queen of Denmark NaN\n",
+ "1948 actress Hamlet Jean Simmons Ophelia - and Daughter 17\n",
+ "\n",
+ "[299 rows x 4 columns]"
+ ]
+ },
+ "execution_count": 239,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "c = cast\n",
+ "c = c[c.title == 'Hamlet']\n",
+ "c = c.set_index(['year', 'type'])#.unstack('type')\n",
+ "c"
+ ]
},
{
"cell_type": "code",
diff --git a/Solutions-1.ipynb b/Solutions-1.ipynb
index ee8586e..b5bbbc6 100644
--- a/Solutions-1.ipynb
+++ b/Solutions-1.ipynb
@@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
- "execution_count": 4,
+ "execution_count": 1,
"metadata": {
"collapsed": false
},
@@ -15,7 +15,7 @@
},
{
"cell_type": "code",
- "execution_count": 5,
+ "execution_count": 2,
"metadata": {
"collapsed": false
},
@@ -64,7 +64,7 @@
""
]
},
- "execution_count": 5,
+ "execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
@@ -77,7 +77,7 @@
},
{
"cell_type": "code",
- "execution_count": 6,
+ "execution_count": 3,
"metadata": {
"collapsed": false
},
@@ -97,80 +97,55 @@
" \n",
" \n",
" | 0 | \n",
- " 3orthographies | \n",
- " 2013 | \n",
+ " A Lélek órása | \n",
+ " 1923 | \n",
"
\n",
" \n",
" | 1 | \n",
- " 11 Minutes (I) | \n",
- " 2014 | \n",
+ " Aizaugusa gravi viegli krist | \n",
+ " 1986 | \n",
"
\n",
" \n",
" | 2 | \n",
- " A Lélek órása | \n",
- " 1923 | \n",
+ " Agliyorum | \n",
+ " 1988 | \n",
"
\n",
" \n",
" | 3 | \n",
- " A Gypsy Girl's Love | \n",
- " 1908 | \n",
+ " 0_1_0 | \n",
+ " 2008 | \n",
"
\n",
" \n",
" | 4 | \n",
- " A Woman Scorned | \n",
- " 1999 | \n",
+ " 97 fung lau mung | \n",
+ " 1994 | \n",
"
\n",
" \n",
"\n",
""
],
"text/plain": [
- " title year\n",
- "0 3orthographies 2013\n",
- "1 11 Minutes (I) 2014\n",
- "2 A Lélek órása 1923\n",
- "3 A Gypsy Girl's Love 1908\n",
- "4 A Woman Scorned 1999"
+ " title year\n",
+ "0 A Lélek órása 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"
]
},
- "execution_count": 6,
+ "execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
- "titles = pd.DataFrame.from_csv('titles.csv', index_col=None)\n",
+ "titles = pd.DataFrame.from_csv('data/titles.csv', index_col=None)\n",
"titles.head()"
]
},
{
"cell_type": "code",
- "execution_count": 7,
- "metadata": {
- "collapsed": false
- },
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "\n",
- "Int64Index: 808880 entries, 0 to 808879\n",
- "Data columns (total 2 columns):\n",
- "title 808880 non-null object\n",
- "year 808880 non-null float64\n",
- "dtypes: float64(1), object(1)\n",
- "memory usage: 18.5+ MB\n"
- ]
- }
- ],
- "source": [
- "titles.info()"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 8,
+ "execution_count": 4,
"metadata": {
"collapsed": false
},
@@ -184,6 +159,7 @@
" \n",
" | \n",
" title | \n",
+ " year | \n",
" name | \n",
" type | \n",
" character | \n",
@@ -193,96 +169,503 @@
"
\n",
" \n",
" | 0 | \n",
- " The Core | \n",
- " Alejandro Abellan | \n",
- " actor | \n",
- " U.S.S. Soldier | \n",
+ " The Core | \n",
+ " 2003 | \n",
+ " Alejandro Abellan | \n",
+ " actor | \n",
+ " U.S.S. Soldier | \n",
" NaN | \n",
"
\n",
" \n",
" | 1 | \n",
- " Il momento di uccidere | \n",
- " Remo De Angelis | \n",
- " actor | \n",
- " Dago | \n",
- " 9 | \n",
+ " Il momento di uccidere | \n",
+ " 1968 | \n",
+ " Remo De Angelis | \n",
+ " actor | \n",
+ " Dago | \n",
+ " 9 | \n",
"
\n",
" \n",
" | 2 | \n",
- " Across the Divide | \n",
- " Thomas Delmar | \n",
- " actor | \n",
- " Dago | \n",
- " 4 | \n",
+ " Across the Divide | \n",
+ " 1921 | \n",
+ " Thomas Delmar | \n",
+ " actor | \n",
+ " Dago | \n",
+ " 4 | \n",
"
\n",
" \n",
" | 3 | \n",
- " Revan | \n",
- " Diego James | \n",
- " actor | \n",
- " Dago | \n",
+ " Revan | \n",
+ " 2012 | \n",
+ " Diego James | \n",
+ " actor | \n",
+ " Dago | \n",
" NaN | \n",
"
\n",
" \n",
" | 4 | \n",
- " Un homme marche dans la ville | \n",
- " Fabien Loris | \n",
- " actor | \n",
- " Dago | \n",
- " 12 | \n",
+ " Un homme marche dans la ville | \n",
+ " 1950 | \n",
+ " Fabien Loris | \n",
+ " actor | \n",
+ " Dago | \n",
+ " 12 | \n",
"
\n",
" \n",
"\n",
""
],
"text/plain": [
- " title name type character n\n",
- "0 The Core Alejandro Abellan actor U.S.S. Soldier NaN\n",
- "1 Il momento di uccidere Remo De Angelis actor Dago 9\n",
- "2 Across the Divide Thomas Delmar actor Dago 4\n",
- "3 Revan Diego James actor Dago NaN\n",
- "4 Un homme marche dans la ville Fabien Loris actor Dago 12"
+ " 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 "
]
},
- "execution_count": 8,
+ "execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
- "cast = pd.DataFrame.from_csv('cast.csv', index_col=None)\n",
+ "cast = pd.DataFrame.from_csv('data/cast.csv', index_col=None)\n",
"cast.head()"
]
},
{
"cell_type": "code",
- "execution_count": 9,
+ "execution_count": 5,
"metadata": {
"collapsed": false
},
"outputs": [
{
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "\n",
- "Int64Index: 5271490 entries, 0 to 5271489\n",
- "Data columns (total 5 columns):\n",
- "title object\n",
- "name object\n",
- "type object\n",
- "character object\n",
- "n float64\n",
- "dtypes: float64(1), object(4)\n",
- "memory usage: 241.3+ MB\n"
- ]
+ "data": {
+ "text/plain": [
+ "306951"
+ ]
+ },
+ "execution_count": 5,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "# How many movies are listed in the titles dataframe?\n",
+ "\n",
+ "len(titles)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 14,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " title | \n",
+ " year | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | 172161 | \n",
+ " Miss Jerry | \n",
+ " 1894 | \n",
+ "
\n",
+ " \n",
+ " | 207934 | \n",
+ " Reproduction of the Corbett and Fitzsimmons Fight | \n",
+ " 1897 | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
"
+ ],
+ "text/plain": [
+ " title year\n",
+ "172161 Miss Jerry 1894\n",
+ "207934 Reproduction of the Corbett and Fitzsimmons Fight 1897"
+ ]
+ },
+ "execution_count": 14,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "# What are the earliest two films listed in the titles dataframe?\n",
+ "\n",
+ "titles.sort('year').head(2)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 18,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "20"
+ ]
+ },
+ "execution_count": 18,
+ "metadata": {},
+ "output_type": "execute_result"
}
],
"source": [
- "cast.info()"
+ "# How many movies have the title \"Hamlet\"?\n",
+ "\n",
+ "len(titles[titles.title == 'Hamlet'])"
]
},
{
+ "cell_type": "code",
+ "execution_count": 27,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "1"
+ ]
+ },
+ "execution_count": 27,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "# How many movies are titled \"North by Northwest\"?\n",
+ "\n",
+ "len(titles[titles.title == 'North by Northwest'])"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 61,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " title | \n",
+ " year | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | 104882 | \n",
+ " Hamlet | \n",
+ " 1910 | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
"
+ ],
+ "text/plain": [
+ " title year\n",
+ "104882 Hamlet 1910"
+ ]
+ },
+ "execution_count": 61,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "# When was the first movie named \"Hamlet\" made?\n",
+ "\n",
+ "titles[titles.title == 'Hamlet'].sort('year').head(1)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 49,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " title | \n",
+ " year | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | 285800 | \n",
+ " Treasure Island | \n",
+ " 1918 | \n",
+ "
\n",
+ " \n",
+ " | 277236 | \n",
+ " Treasure Island | \n",
+ " 1920 | \n",
+ "
\n",
+ " \n",
+ " | 286174 | \n",
+ " Treasure Island | \n",
+ " 1934 | \n",
+ "
\n",
+ " \n",
+ " | 287490 | \n",
+ " Treasure Island | \n",
+ " 1950 | \n",
+ "
\n",
+ " \n",
+ " | 285791 | \n",
+ " Treasure Island | \n",
+ " 1972 | \n",
+ "
\n",
+ " \n",
+ " | 290784 | \n",
+ " Treasure Island | \n",
+ " 1973 | \n",
+ "
\n",
+ " \n",
+ " | 285646 | \n",
+ " Treasure Island | \n",
+ " 1985 | \n",
+ "
\n",
+ " \n",
+ " | 279936 | \n",
+ " Treasure Island | \n",
+ " 1999 | \n",
+ "
\n",
+ " \n",
+ " | 306813 | \n",
+ " Treasure Island | \n",
+ " 2001 | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
"
+ ],
+ "text/plain": [
+ " title year\n",
+ "285800 Treasure Island 1918\n",
+ "277236 Treasure Island 1920\n",
+ "286174 Treasure Island 1934\n",
+ "287490 Treasure Island 1950\n",
+ "285791 Treasure Island 1972\n",
+ "290784 Treasure Island 1973\n",
+ "285646 Treasure Island 1985\n",
+ "279936 Treasure Island 1999\n",
+ "306813 Treasure Island 2001"
+ ]
+ },
+ "execution_count": 49,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "# List all of the \"Treasure Island\" movies from earliest to most recent.\n",
+ "\n",
+ "titles[titles.title == 'Treasure Island'].sort('year')"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 53,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "1691"
+ ]
+ },
+ "execution_count": 53,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "# How many movies were made in the year 1950?\n",
+ "\n",
+ "len(titles[titles.year == 1950])"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 54,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "2298"
+ ]
+ },
+ "execution_count": 54,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "# How many movies were made in the year 1960?\n",
+ "\n",
+ "len(titles[titles.year == 1960])"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 58,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "19674"
+ ]
+ },
+ "execution_count": 58,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "# How many movies were made from 1950 through 1959?\n",
+ "\n",
+ "t = titles\n",
+ "len(t[(t.year >= 1950) & (t.year <= 1959)])"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 59,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "19674"
+ ]
+ },
+ "execution_count": 59,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "len(t[t.year // 10 == 195])"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 69,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " title | \n",
+ " year | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | 24368 | \n",
+ " Batman | \n",
+ " 1989 | \n",
+ "
\n",
+ " \n",
+ " | 28556 | \n",
+ " Batman | \n",
+ " 1943 | \n",
+ "
\n",
+ " \n",
+ " | 305635 | \n",
+ " Batman | \n",
+ " 1966 | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
"
+ ],
+ "text/plain": [
+ " title year\n",
+ "24368 Batman 1989\n",
+ "28556 Batman 1943\n",
+ "305635 Batman 1966"
+ ]
+ },
+ "execution_count": 69,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "# In what years has a movie titled \"Batman\" been released?\n",
+ "\n",
+ "t = titles\n",
+ "t[t.title == 'Batman']"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+ "source": []
+ },
+ {
"cell_type": "markdown",
"metadata": {},
"source": [
diff --git a/script.txt b/script.txt
index b7dbfca..41b563d 100644
--- a/script.txt
+++ b/script.txt
@@ -14,7 +14,7 @@ titles.tail() and .tail(10)
Filtering
h['year'] or h.year
-h.year.size does this even
+h.year.size does this even no
h.year + 1000
h.year - 2000
@@ -50,7 +50,7 @@ h.value_counts()
(While doing exercises:)
-true_false.sum()
+true_false.sum() ?
cast.columns ?
diff --git a/slides.txt b/slides.txt
index 9838b50..22b4074 100644
--- a/slides.txt
+++ b/slides.txt
@@ -1,12 +1,12 @@
- len(df) df.head() df.tail() df.column + value
- df['column'] -or- df.column df.column + df.another_column
-
- df[df.c == value] + - * / // %
- df[(df.c > value) & (df.d < value)] == < > >= <= !=
- df[(df.c < value) | (df.d > value)]
+ len(df) df.head() df.tail() df.column.notnull()
+ df['column'] -or- df.column df.column + value
+ df.column + df.another_column
+ df[df.c == value]
+ df[(df.c > value) & (df.d < value)] Mathematics + - * / // %
+ df[(df.c < value) | (df.d > value)] Comparisons == != < > >= <=
df.sort(['column']) df.column.str.contains(s)
df.sort(['column1', 'column2']) df.column.str.endswith(s)