Editing Community Data Science Workshops (Spring 2015)/Day 3 Lecture

From CommunityData
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

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.


* http://mako.cc/teaching/2015/cdsw-spring/harrypotter-wikipedia-cdsw.zip
* http://mako.cc/teaching/2014/cdsw-autumn/build_hpwp_dataset.py
* http://communitydata.cc/~mako/hp_wiki.tsv
* http://nada.com.washington.edu/~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
** More [[Harry Potter on Wikipedia]] project (or your own topic) on doing analysis using Google Docs
** Project and challenge based continuition of the work in here focusing on Google Docs
** [[Matplotlib]]
** [[Community Data Science Workshops/Saturday May 31st Matplotlib Session|Matplotlib]]!
** Civic Data - More interactive working on projects
** 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 ==
'''Step 1: Pre-Requisites'''


* 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
** "\t".join()
** string.join()
** defining your own functions with <code>def foo(argument):</code>
** defining your own functions with <code>def foo(argument):</code>
'''Step 2: Walking through a Program'''
* 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
'''Step 3: Loading Data Back In'''
* 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', encoding="utf-8")</code>
*** we can also open them for reading with <code>open('file', ''r, encoding="utf-8")</code>
** csv module and and csv.reader() function
** csv.DictReader()
** csv.DictReader()
* Basic counting: <code>hpwp-minor.py</code>
* 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 <code>hpwp-trend.py</code>
* 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 56: Line 48:
** Load data into Google Docs
** Load data into Google Docs


[[Category:Spring_2015_series]]
We mostly worked on these questions in the afternoon:
 
* More advanced counting
** Answer question: ''What are the most edited articles on Harry Potter?''
*** Count the number of edits per articles
** Answer question: ''Who are the most active editors on articles in Harry Potter?''
*** Count the number of edits per user
Please note that all contributions to CommunityData are considered to be released under the Attribution-Share Alike 3.0 Unported (see CommunityData:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

To protect the wiki against automated edit spam, we kindly ask you to solve the following CAPTCHA:

Cancel Editing help (opens in new window)