Editing Community Data Science Course (Spring 2015)/Day 4 Lecture
From CommunityData
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 1: | Line 1: | ||
[[File:Highfivekitten.jpeg|200px|thumb|In which you learn how to use Python and web APIs to meet the likes of her!]] | [[File:Highfivekitten.jpeg|200px|thumb|In which you learn how to use Python and web APIs to meet the likes of her!]] | ||
== Lecture Slides == | |||
* [http://mako.cc/teaching/2014/cdsw-autumn/lecture2-web_apis.pdf Slides (PDF)] — For viewing | |||
* [http://mako.cc/teaching/2014/cdsw-autumn/lecture2-web_apis.odp Slides (ODP Libreoffice Slides Format)] — For editing and modification | |||
== Resources == | |||
* Encoding: | |||
** [http://nedbatchelder.com/text/unipain.html Pragmatic Unicode] | |||
** [https://docs.python.org/2/howto/unicode.html Official Python Unicode documentation] | |||
== Lecture Outline == | == Lecture Outline == | ||
Line 11: | Line 21: | ||
;Outline: | ;Outline: | ||
* What did we learn in Session 1? | |||
* What is an API? | * What is an API? | ||
* How do we use one to fetch interesting datasets? | * How do we use one to fetch interesting datasets? | ||
Line 48: | Line 59: | ||
* the ability to save to files | * the ability to save to files | ||
* the ability to understand (i.e., parse) JSON data that APIs usually give us | * the ability to understand (i.e., parse) JSON data that APIs usually give us | ||
; Session 1 review | |||
* Navigating in the terminal and using it to run programs | |||
* Writing Python: | |||
** using variables to manipulate data | |||
** types of data: strings, integers, lists, dictionaries | |||
** if statements | |||
** for loops | |||
** printing | |||
** importing modules, so you can use code other people have written for you! | |||
Line 55: | Line 78: | ||
* requests | * requests | ||
* open files and write to them | * open files and write to them | ||
* parsing a string (turning the string into a data structure we can manipulate) | |||
Line 76: | Line 100: | ||
* can reflect more complicated data structures | * can reflect more complicated data structures | ||
* Example file at http://mako.cc/cdsw.json | * Example file at http://mako.cc/cdsw.json | ||
* | * download it and parse it: [http://mako.cc/teaching/2014/cdsw-autumn/parse_cdswjson.py parse_cdswjson.py] | ||
; Using other APIs | ; Using other APIs | ||
Line 88: | Line 113: | ||
* authentication | * authentication | ||
* text encoding issues | * text encoding issues | ||