Editing Community Data Science Workshops (Spring 2015)/Day 3 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 3: | Line 3: | ||
For the lecture, you will need two files. Download both of these to your computer by using right or control click on the link and then using ''Save as'' or ''Save link as''. Keep track of where you put the files. | For the lecture, you will need two files. Download both of these to your computer by using right or control click on the link and then using ''Save as'' or ''Save link as''. Keep track of where you put the files. | ||
* | * https://github.com/makoshark/harrypotter-wikipedia-cdsw/raw/master/build_hpwp_dataset.py | ||
* http://communitydata.cc/~mako/hp_wiki. | * http://wiki.communitydata.cc/~mako/hp_wiki.csv | ||
== Overview of the day == | == Overview of the day == | ||
Line 16: | Line 16: | ||
* Lunch (vegetarian Greek!) | * Lunch (vegetarian Greek!) | ||
* Project based work | * Project based work | ||
** | ** [[Harry Potter on Wikipedia]] project on doing analysis using Google Docs | ||
** [[Matplotlib]] | ** [[Community Data Science Workshops/Saturday May 31st Matplotlib Session|Matplotlib]]! | ||
** Room for you to to work on your projects! | ** Room for you to to work on your projects! | ||
* Wrap-up! | * Wrap-up! | ||
== Lecture outline == | == Lecture outline == | ||
* My philosophy about data analysis: ''use the tools you have'' | * My philosophy about data analysis: ''use the tools you have'' | ||
Line 32: | Line 29: | ||
*** loops with a greater than or less than | *** loops with a greater than or less than | ||
** break / continue | ** break / continue | ||
** | ** string.join() | ||
** defining your own functions with <code>def foo(argument):</code> | ** defining your own functions with <code>def foo(argument):</code> | ||
* Walk-through of <code>get_hpwp_dataset.py</code> | * Walk-through of <code>get_hpwp_dataset.py</code> | ||
* Look at dataset with <code>more</code> and/or in spreadsheet | * Look at dataset with <code>more</code> and/or in spreadsheet | ||
* Load data into Python | * Load data into Python | ||
** review of opening files | ** review of opening files | ||
*** we can also open them for reading with <code>open('file', 'r | *** we can also open them for reading with <code>open('file', ''r, encoding="utf-8")</code> | ||
** csv.DictReader() | ** csv.DictReader() | ||
* Basic counting | * Basic counting | ||
** Answer question: ''What proportion of edits to Wikipedia Harry Potter articles are minor?'' | ** Answer question: ''What proportion of edits to Wikipedia Harry Potter articles are minor?'' | ||
*** Count the number of minor edits and calculate proportion | *** Count the number of minor edits and calculate proportion | ||
* Looking at time series data | * Looking at time series data | ||
** "Bin" data by day to generate the trend line | ** "Bin" data by day to generate the trend line | ||
* Exporting and visualizing data | * Exporting and visualizing data | ||
Line 55: | Line 46: | ||
** Export dataset on articles over users | ** Export dataset on articles over users | ||
** Load data into Google Docs | ** Load data into Google Docs | ||