From 5cb7cbed14f09d4d93dc739a96d264e979e662fc Mon Sep 17 00:00:00 2001 From: Brandon Rhodes Date: Wed, 8 Apr 2015 14:52:53 -0400 Subject: [PATCH] A few emergency notes, to students and myself --- cheat-sheet.txt | 32 +++++++++++++++++++++++++------- script.txt | 5 +++++ 2 files changed, 30 insertions(+), 7 deletions(-) diff --git a/cheat-sheet.txt b/cheat-sheet.txt index 34914a6..e29e13e 100644 --- a/cheat-sheet.txt +++ b/cheat-sheet.txt @@ -17,6 +17,7 @@ 3. Start the IPython Notebook and visit the "pandas-tutorial" folder from inside the .zip + len(df) series + value df[df.c == value] @@ -28,6 +29,12 @@ + import sys + reload(sys) + sys.setdefaultencoding('utf-8') + + + @@ -43,9 +50,14 @@ df.COLUMN series.isnull() df.sort('column') df['COLUMN'] series.order() df.sort(['column1', 'column2']) - s.str.len() s.value_counts() - s.str.contains() s.sort_index() df[['column1', 'column2']] - s.str.startswith() s.plot(...) df.plot(x='a', y='b', kind='bar') +s.str.len() s.value_counts() df[['column1', 'column2']] +s.str.contains() s.sort_index() df.plot(x='a', y='b', kind='scatter') +s.str.startswith() s.plot(...) df.plot(x='a', y='b', kind='bar') + + + import sys + reload(sys) + sys.setdefaultencoding('utf-8') @@ -56,16 +68,22 @@ df['COLUMN'] series.order() df.sort(['column1', 'column2']) s.str.len() s.value_counts() - s.str.contains() s.sort_index() df[['column1', 'column2']] - s.str.startswith() s.plot(...) df.plot(x='a', y='b', kind='bar') + s.str.contains() s.sort_index() df[['column1', 'column2']] + s.str.startswith() s.plot(...) df.plot(x='a', y='b', kind='bar') df.set_index('a').sort_index() df.loc['value'] df.set_index(['a', 'b']).sort_index() df.loc[('v','u')] df.groupby('column') .size() .mean() .min() .max() df.groupby(['column1', 'column2']) .agg(['min', 'max']) + + + "The Pink Panther" + brandon@rhodesmill.org + + len(df) series + value df[df.c == value] df.head() series + series2 df[(df.c >= value) & (df.d < value)] df.tail() series.notnull() df[(df.c < value) | (df.d != value)] @@ -73,8 +91,8 @@ df['COLUMN'] series.order() df.sort(['column1', 'column2']) s.str.len() s.value_counts() - s.str.contains() s.sort_index() df[['column1', 'column2']] - s.str.startswith() s.plot(...) df.plot(x='a', y='b', kind='bar') + s.str.contains() s.sort_index() df[['column1', 'column2']] + s.str.startswith() s.plot(...) df.plot(x='a', y='b', kind='bar') df.set_index('a').sort_index() df.loc['value'] df.set_index(['a', 'b']).sort_index() df.loc[('v','u')] diff --git a/script.txt b/script.txt index 141d66f..89add52 100644 --- a/script.txt +++ b/script.txt @@ -2,6 +2,10 @@ Session 1 ========= +You should do install if you have not already. +We have Internet! But, I have USB keys too. +Format: lesson, exercises, solutions. + Open Exercise-1 Point out .from_csv functions @@ -223,3 +227,4 @@ Thoughts for later (what pairs of co-stars have appeared the most often together) Can you use merge to find who was in movies with each other? +Fix later: second exercise s/hamlet/batman/