Community Data Science Course (Spring 2015)/Day 5 Lecture: Difference between revisions

From CommunityData
 
Line 17: Line 17:


* My philosophy about data analysis: ''use the tools you have''
* My philosophy about data analysis: ''use the tools you have''
* Four things in Python I have to teach you:
* Three new thing in Python I have to teach you:
** while loops
*** infinite loops
*** loops with a greater than or less than
** break / continue
** string.join()
** string.join()
** defining your own functions with <code>def foo(argument):</code>
** defining your own functions with <code>def foo(argument):</code>
** loading data back into Python (which we'll cover once we have some data)
* 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
** review of opening files
** review of opening files
*** we can also open them for reading
*** we can also open them for reading
** csv module and and csv.reader() function
** csv module and and csv.reader() function
** csv.DictReader()
** csv.DictReader()
* Basic counting
** Answer question: ''What proportion of edits to Wikipedia Harry Potter articles are minor?''
*** Count the number of minor edits and calculate proportion
* Looking at time series data
** "Bin" data by day to generate the trend line
* Exporting and visualizing data
** Export dataset on edits over time
** Export dataset on articles over users
** Load data into Google Docs
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

Latest revision as of 01:44, 28 April 2015

Material for the lecture[edit]

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.

Overview of the day[edit]

  • Lecture
    • Introduce some new programming tools!
    • We're going to walk through some analysis of edits to Harry Potter in Wikipedia, start to finish
    • We'll focus on manipulating data in Python
    • Visualizing things in Google Docs

Lecture outline[edit]

  • My philosophy about data analysis: use the tools you have
  • Three new thing in Python I have to teach you:
    • string.join()
    • defining your own functions with def foo(argument):
    • loading data back into Python (which we'll cover once we have some data)
  • Walk-through of get_hpwp_dataset.py
  • Look at dataset with more and/or in spreadsheet
    • review of opening files
      • we can also open them for reading
    • csv module and and csv.reader() function
    • csv.DictReader()