https://wiki.communitydata.science/api.php?action=feedcontributions&user=Ddailey&feedformat=atomCommunityData - User contributions [en]2024-03-28T20:11:55ZUser contributionsMediaWiki 1.38.4https://wiki.communitydata.science/index.php?title=Twitter_(CDSW)&diff=188978Twitter (CDSW)2020-02-01T17:41:55Z<p>Ddailey: /* Potential exercises */</p>
<hr />
<div>[[File:Twitter.png|right|260px]]<br />
<br />
__NOTOC__<br />
<br />
In this project, we will explore a few ways to gather data using the Twitter API. Once we've done that, we will extend the example code to create our own dataset of tweets. In the final workshop (Feb 15), we will ask and answer questions with the data we've collected.<br />
<br />
== Goals ==<br />
<br />
* Get set up to build datasets with the Twitter API<br />
* Have fun collecting different types of tweets using a variety of ways to search<br />
* Practice reading and extending other people's code<br />
* Create a few collections of Tweets to use in your projects<br />
<br />
== Prerequisite ==<br />
<br />
To participate in the Twitter afternoon session, you ''must'' have registered with Twitter as a developer before the session by following the [[Twitter authentication setup|Twitter authentication setup instructions]]. If you did not do this, or if you tried but did not succeed, please attend one of the other two sessions instead.<br />
<br />
== Download and test the Twitter project ==<br />
<br />
If you are confused by these steps, go back and refresh your memory with the [[Community_Data_Science_Workshops_(Fall_2015)/Day_0_setup_and_tutorial|Day 0 setup instructions]]<br />
<br />
(Estimated time: 10 minutes)<br />
<br />
===Download the Twitter API project===<br />
<br />
* Download the following zip file: https://github.com/CommunityDataScienceCollective/twitter-cdsw/archive/master.zip<br />
* Extract the zip folder into a new folder on your Desktop.<br />
<br />
===Enter your API information===<br />
<br />
* Start Juypter notebook and navigate to the folder you just created on your desktop.<br />
* Double click to open the file "twitter_authentication.py". This is a python file, meaning it contains python code, but it is not a notebook.<br />
* You will see four lines that include four variables in ALL CAPITALS that are being assigned, in the normal ways we learned about last session, to strings. At the moment, all of the strings say CHANGE_ME.<br />
* Go find the four keys, tokens, and secrets you created and wrote-down when you followed the [[Community Data Science Workshops/Twitter authentication setup|Twitter authentication setup]]. Change every string that says CHANGE_ME into a string that includes the key, token, or secret you downloaded. Remember that since these are strings, we need to include quotations marks around them. Also make sure that you match up the right keys and tokens with the right variables.<br />
<br />
Once you have done this, your example programs are set up to use the Twitter API!<br />
<br />
===Test the Twitter API code===<br />
<br />
Open the notebook "ex0_print_a_tweet.py" in jupyter. Execute all of the cells. You should see the text of 100 tweets in the second to last cell. If you see an error, you probably have a problem with the API information you entered in the previous step. A volunteer can help you.<br />
<br />
<br />
===Making your own notebooks===<br />
<br />
You will do the exercises below in your own notebook, which you will create. In every notebook you make, put the following python code in the first cell:<br />
<br />
import tweepy<br />
from twitter_authentication import CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET<br />
<br />
auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)<br />
auth.set_access_token(ACCESS_TOKEN, ACCESS_TOKEN_SECRET)<br />
api = tweepy.API(auth)<br />
<br />
<br />
This will enable your authenticated Twitter API calls via the variable <code>api</code><br />
<br />
== Potential exercises ==<br />
<br />
<br />
'''Topics and Trends'''<br />
<br />
# Alter code example 2 (ex2_search.ipynb) to produce a list of 1000 tweets about a topic.<br />
# How does twitter interpret a two word query like "data science"<br />
# Eliminate retweets [hint: look at the tweet object! https://dev.twitter.com/overview/api/tweets]<br />
# For each tweet original tweet, list the number of times you see it retweeted.<br />
# Get a list of the URLs that are embedded in Tweets with your topic.<br />
<br />
'''Geolocation from Search API'''<br />
This section will require you to investigate the filter function in example 2 in more detail.<br />
<br />
# Get the last 50 tweets from Ballard.<br />
# Get the last 50 tweets from Times Square.<br />
# Using timestamps, can you estimate whether people tweet more often in Ballard or Times Square?<br />
# A baseball game happened today (May 11) between the Seattle Mariners and the Tampa Bay Rays. Using two geo searches, see if you can tell which city hosted the game. Note: if you do this some other day, you should pick a new sporting event.<br />
<br />
'''Geolocation in the streaming APi'''<br />
<br />
# Alter the streaming algorithm to include a "locations" filter. You need to use the order sw_lng, sw_lat, ne_lng, ne_lat for the four coordinates. (Recall the stop button will stop an active process like the stream.)<br />
# What are people tweeting about in Times Square today? (Bonus points: set up a bounding box around TS and around NYC as a whole.)<br />
# Can you find words that are more likely to appear in Time's Square (hint: you'll need two bounding boxes)?<br />
# Oregon State is playing basketball against UC Berkeley. Set up a bounding box around Berkeley and Corvallis, Oregon. Can you identify tweets about basketball? Who tweets more about the game? Can you tell which team is the home team? <br />
<br />
Geolocation hint: You can use <code>d = api.search(geocode='[lng],[lat],5mi)</code> to get Tweets from a 5 mile radius around a point. Use Google or Bing maps to get a similar bounding box around Fenway Park.<br />
<br />
<br />
'''Who are my followers?'''<br />
<br />
# Alter code example 1 (ex1_get_user_info.ipynb) to get your followers.<br />
# For each of your followers, get *their* followers (investigate time.sleep to throttle your computation)<br />
# Identify the follower you have that also follows the most of your followers.<br />
# How many handles follow you but none of your followers?<br />
# Repeat this for people you follow, rather than that follow you.<br />
<br />
== Congratulations!!!!==<br />
<br />
You now know how to capture data from Twitter that you can use in your research!!! Next workshop we'll play with some fun analytical tools. In the meantime, here are [[Twitter words of warning|a few words of caution about using Twitter data for science]].<br />
<br />
[[Category:Spring_2016_series]]</div>Ddaileyhttps://wiki.communitydata.science/index.php?title=Twitter_(CDSW)&diff=188233Twitter (CDSW)2020-01-29T19:50:11Z<p>Ddailey: </p>
<hr />
<div>[[File:Twitter.png|right|260px]]<br />
<br />
__NOTOC__<br />
<br />
In this project, we will explore a few ways to gather data using the Twitter API. Once we've done that, we will extend the example code to create our own dataset of tweets. In the final workshop (Feb 15), we will ask and answer questions with the data we've collected.<br />
<br />
== Goals ==<br />
<br />
* Get set up to build datasets with the Twitter API<br />
* Have fun collecting different types of tweets using a variety of ways to search<br />
* Practice reading and extending other people's code<br />
* Create a few collections of Tweets to use in your projects<br />
<br />
== Prerequisite ==<br />
<br />
To participate in the Twitter afternoon session, you ''must'' have registered with Twitter as a developer before the session by following the [[Twitter authentication setup|Twitter authentication setup instructions]]. If you did not do this, or if you tried but did not succeed, please attend one of the other two sessions instead.<br />
<br />
== Download and test the Twitter project ==<br />
<br />
If you are confused by these steps, go back and refresh your memory with the [[Community_Data_Science_Workshops_(Fall_2015)/Day_0_setup_and_tutorial|Day 0 setup instructions]]<br />
<br />
(Estimated time: 10 minutes)<br />
<br />
===Download the Twitter API project===<br />
<br />
* Right click the following file, click "Save Target as..." or "Save link as...", and save it to your Desktop directory: https://mako.cc/teaching/2015/cdsw-autumn/twitter-api-cdsw.zip<br />
* The ".zip" extension on the above file indicates that it is a compressed Zip archive. We need to "extract" its contents. To do this on Windows, click on "Start", then "Computer". If you are a Mac, open Finder and navigate to your Desktop directory. Find <code>twitter-api-cdsw.zip</code> on your Desktop and double-click on it to "unzip" it. That will create a folder called <code>twitter-api-cdsw</code> containing several files.<br />
<br />
===Enter your API information===<br />
<br />
<div style="background-color:#CEE7DA; width:80%; padding:1.2em;"><br />
'''On Windows'''<br />
<br />
* Start your text editor (probably Notepad++ if you [[Windows text editor|installed it following our instructions last time]]). Navigate to the directory that contains Twitter API (probably something of the form <code>C:\Users\'''YOURUSERNAME'''\Desktop\twitter-api-cdsw</code>).<br />
<br />
</div><br />
<br />
<div style="background-color:#D8E8FF; width:80%; padding:1.2em;"><br />
'''On Mac'''<br />
<br />
* Start your text editor (probably TextWrangler if you installed it following [[OSX text editor|our instructions]]). Navigate to the directory that contains the Twitter API project (probably something of the form <code>~/Desktop/twitter-api-cdsw</code>).<br />
<br />
</div><br />
<br />
* Open up the file <code>twitter_authentication.py</code> in your text editor.<br />
* You will see four lines that include four variables in ALL CAPITALS that are being assigned, in the normal ways we learned about last session, to strings. At the moment, all of the strings say CHANGE_ME.<br />
* Go find the four keys, tokens, and secrets you created and wrote-down when you followed the [[Community Data Science Workshops/Twitter authentication setup|Twitter authentication setup]]. Change every string that says CHANGE_ME into a string that includes the key, token, or secret you downloaded. Remember that since these are strings, we need to include quotations marks around them. Also make sure that you match up the right keys and tokens with the right variables.<br />
<br />
Once you have done this, your example programs are set up to use the Twitter API!<br />
<br />
===Test the Twitter API code===<br />
<br />
<div style="background-color:#CEE7DA; width:80%; padding:1.2em;"><br />
'''On Windows'''<br />
<br />
Start up PowerShell and navigate to the Desktop\twitter-api-cdsw directory where the Twitter API code lives. For example, if the Twitter API project is at <code>C:\Users\'''YOURUSERNAME'''\Desktop\twitter-api-cdsw</code>,<br />
<br />
cd C:\Users\'''YOURUSERNAME'''\Desktop\twitter-api-cdsw<br />
<br />
</div><br />
<div style="background-color:#D8E8FF; width:80%; padding:1.2em;"><br />
'''On Mac'''<br />
<br />
Start a command prompt and navigate to the Desktop/twitter-api-cdsw directory where the Twitter API code lives. For example, if the Twitter API project is at ~/Desktop/twitter-api-cdsw,<br />
<br />
cd ~/Desktop/twitter-api-cdsw<br />
<br />
</div><br />
<br />
This will change you into the right directory.<br />
<br />
<code>ls</code> will show you the source code files in that directory. One of the files is "<code>twitter1.py</code>", which has a "<code>.py</code>" extension indicating that it is a Python script. Type:<br />
<br />
python twitter1.py<br />
<br />
at the command prompt to execute the <code>twitter1.py</code> Python script. Wait a little while while your computer connects to Twitter. You should see a series of tweets run by your screen. If you don't, let a mentor know.<br />
<br />
== Potential exercises ==<br />
<br />
'''Who are my followers?'''<br />
<br />
# Alter code example 2 (twitter2.py) to get your followers.<br />
# For each of your followers, get *their* followers (investigate time.sleep to throttle your computation)<br />
# Identify the follower you have that also follows the most of your followers.<br />
# How many handles follow you but none of your followers?<br />
# Repeat this for people you follow, rather than that follow you.<br />
<br />
'''Topics and Trends'''<br />
<br />
# Alter code example 3 (twitter3.py) to produce a list of 1000 tweets about a topic.<br />
# Look at those tweets. How does twitter interpret a two word query like "data science"<br />
# Eliminate retweets [hint: look at the tweet object! https://dev.twitter.com/overview/api/tweets]<br />
# For each tweet original tweet, list the number of times you see it retweeted.<br />
# Get a list of the URLs that are associated with your topic.<br />
<br />
'''Geolocation from Search API'''<br />
<br />
# Get the last 50 tweets from Ballard.<br />
# Get the last 50 tweets from Times Square.<br />
# Using timestamps, can you estimate whether people tweet more often in Ballard or Times Square?<br />
# A baseball game happened today (May 11) between the Seattle Mariners and the Tampa Bay Rays. Using two geo searches, see if you can tell which city hosted the game. Note: if you do this some other day, you should pick a new sporting event.<br />
<br />
'''Geolocation'''<br />
<br />
# Alter the streaming algorithm to include a "locations" filter. You need to use the order sw_lng, sw_lat, ne_lng, ne_lat for the four coordinates. (Recall Control C will stop an active process like the stream.)<br />
# What are people tweeting about in Times Square today? (Bonus points: set up a bounding box around TS and around NYC as a whole.)<br />
# Can you find words that are more likely to appear in TS?<br />
# Boston is playing Houston in baseball right now. Set up a bounding box around the Houston and Boston. Can you identify tweets about baseball? Who tweets more about the game? Can you tell which team is the home team? (you can use <code>d = api.search(geocode='-95.355549,29.757480,5mi)</code> to get Tweets from Houston. Use Google or Bing maps to get a similar bounding box around Fenway Park).<br />
<br />
== Congratulations!!!!==<br />
<br />
You now know how to capture data from Twitter that you can use in your research!!! Next workshop we'll play with some fun analytical tools. In the meantime, here are [[Twitter words of warning|a few words of caution about using Twitter data for science]].<br />
<br />
[[Category:Spring_2016_series]]</div>Ddaileyhttps://wiki.communitydata.science/index.php?title=Twitter_authentication_setup&diff=188232Twitter authentication setup2020-01-29T19:48:19Z<p>Ddailey: </p>
<hr />
<div>[[File:Twitter.png|right|200px]]<br />
<br />
Things you will need before you start:<br />
<br />
== Get a Twitter Account and Link It to a Mobile Phone ==<br />
'''A Twitter account.''' To collect tweets from Twitter, you need a Twitter account. If your Twitter profile doesn't have your current mobile number associated with it, you will need to add your mobile number in order to create your new app as part of the process.<br />
<br />
<br />
== Apply to be a Twitter Developer == <br />
<br />
To collect tweets, you need to be approved by Twitter to be a developer. <br />
Follow each of these steps:<br />
<br />
'''1.''' Go to the Twitter development homepage: https://developer.twitter.com/ <br />
<br />
'''2.''' If you're not already signed in to Twitter, click on '''Sign In''' in the top right corner of the page. You can sign in with your normal Twitter account. (It may take you to your Twitter home page when you sign in. If so, return to https://developer.twitter.com/ once you're logged on.) <br />
<br />
'''3.''' Click on the [https://developer.twitter.com/en/apply-for-access "Apply" link] (https://developer.twitter.com/en/apply-for-access). The link should be located in the top right of the page beside "Apps" and your Twitter icon.<br />
<br />
'''4''' Click "Apply for a Developer Account" in the middle of the page.<br />
<br />
'''5''' The next page asks "What is your primary reason for using Twitter developer tools?" and gives you a lot of options. ''Click Student'', which is in the third column. <br />
<br />
'''6''' On the next page, under "what would you like us to call you", put "CDSW_student".<br />
<br />
What you are signing up for is an Individual Developer Account (as opposed to Team Developer Account). <br />
<br />
[[File:Capture20200126.PNG|400px]]<br />
<br />
'''7''' Next, Twitter will ask you about your plans. ''Please follow these instructions carefully to make sure Twitter approves your application.''<br />
<br />
In the field "In your words":<br />
<br />
I am taking a Community Data Science course at the University of Washington. My instructors are Mako Hill (makohill@uw.com), Tommy Guy (guyrt@uw.ed), and Dharma Dailey (ddailey@uw.edu). You can find our workshop details at https://wiki.communitydata.science/Community_Data_Science_Workshops_(Winter_2020).<br />
<br />
Under "The Specifics" check yes for "Are you planning to analyze Twitter data" and enter the following text:<br />
<br />
We are learning to download Twitter data and do basic analysis. For instance, we will try to determine whether an earthquake has happened recently or whether there is a basketball game going on. <br />
<br />
Uncheck the sliders for "Will your app use Tweet, Retweet, like, follow, or Direct Message functionality?" and all other options.<br />
<br />
[[File:Capture20200126_1.PNG|400px]]<br />
<br />
[[File:Capture20200126_2.PNG|400px]]<br />
<br />
<br />
'''8''' Click "next" in the lower right then click "Looks good" on the review page. Finally, accept the terms of service and click "Submit Application" on the next page.<br />
<br />
<br />
<br />
'''9''' Twitter will send an email to the account you used. Click "Confirm your email" in that email to finish setup.<br />
<br />
<br />
<br />
'''If you have any trouble with the steps before this, email us before Saturday.''' If you have trouble on the next steps, we'll be able to help you on Saturday.<br />
<br />
<br />
== Confirm your developer email address ==<br />
<br />
'''10''' When you confirm in the email, you will arrive at https://developer.twitter.com/en/account/get-started. On that page, click "Create an app". This will take you to https://developer.twitter.com/en/apps<br />
<br />
'''11''' Click "Create an app", which takes you to https://developer.twitter.com/en/apps/create. You'll need to fill in a few details about your app.<br />
<br />
App name: "CDSW Sample <Your_First_and_Last_Name>"<br />
<br />
Application Description: "Sample application for the CDSW workshop."<br />
<br />
Website: "https://www.example.com"<br />
<br />
Callback URLs: "https://www.example.com"<br />
<br />
Leave "Enable Sign in with Twitter" unchecked.<br />
<br />
The next few fields are not needed, but scroll to the bottom to find "Tell us how this app will be used".<br />
<br />
Tell us how this app will be used: "Learning data science with python in the Community Data Science workshop. This app is for testing purposes only."<br />
<br />
Finally, click create, and click create again in the modal window.<br />
<br />
*Almost there!!* <br />
<br />
== Generate and copy your individual, private, unique Twitter developer credentials == <br />
'''12''' In the next step, you will access Twitter credentials, which will let you authenticate with Twitter in python.<br />
<br />
You need unique, private credentials to collect tweets. You will be pasting these credentials into your Python code. Be sure if you share your Python code, you ***do not** share your unique developer credentials. <br />
<br />
You should be at a page that looks like:<br />
<br />
[[File:Capture20200126_2.PNG|400px]]<br />
<br />
Click the "Keys and Tokens" tab. You will see a box called "Consumer API keys" with two long strings labeled "API key" and "API secret key". You should copy and paste those into a text file on your desktop.<br />
<br />
Finally, click "Generate" which will open a modal with two new strings called "Access Token" and "Access Token Secret". Copy these two keys to the same file and close the modal.<br />
<br />
You will need all four of these strings in order to have your Twitter application work.<br />
<br />
'''Keep this material secret.''' Your access token and access token secret will allow anybody who has it to post to Twitter as you and to control your account. It is equivalent to your Twitter username and password so please be as careful with it as you would be with your Twitter password!<br />
<br />
== Other documentation ==<br />
Explore how Tweets are structured *[https://developer.twitter.com/en/docs/tweets/data-dictionary/overview/tweet-object Twitter Data Dictionary Tweet Objects]<br />
<br />
In this workshop, we'll be working with TWO different Twitter APIs, "Standard Search" and "Realtime."<br />
<br />
More about the using the Twitter Search API : <br />
* [https://developer.twitter.com/en/docs/tweets/search/overview Official Twitter info on the Search API]<br />
<br />
For this workshop, we'll be working with the "Standard Search", the most limited of Twitter Search API options <br />
* [https://developer.twitter.com/en/docs/tweets/search/overview/standard Twitter "Standard Search"]<br />
<br />
This page has some helpful intel about modifying Standard Search parameters (including sample request and response):<br />
* [https://developer.twitter.com/en/docs/tweets/search/api-reference/get-search-tweets Getting search tweets.]<br />
<br />
Using the Twitter Realtime API : <br />
* [https://developer.twitter.com/en/docs/tweets/filter-realtime/overview Official Documentation Overview of the Realtime API]<br />
<br />
<br />
More about the developer credentials you just generated: <br />
* [https://developer.twitter.com/en/docs/basics/getting-started Official documentation on how to get Tokens from developer.twitter.com]<br />
<br />
[[Category:CDSW]]</div>Ddaileyhttps://wiki.communitydata.science/index.php?title=Twitter_authentication_setup&diff=187525Twitter authentication setup2020-01-27T03:55:14Z<p>Ddailey: </p>
<hr />
<div>[[File:Twitter.png|right|200px]]<br />
<br />
Things you will need before you start:<br />
<br />
==Get a Twitter Account and Link It to a Mobile Phone ==<br />
'''A Twitter account.''' To collect tweets from Twitter, you need a Twitter account. If your Twitter profile doesn't have your current mobile number associated with it, you will need to add your mobile number in order to create your new app as part of the process.<br />
<br />
<br />
== Apply to be a Twitter Developer == <br />
<br />
To collect tweets, you need to be approved by Twitter to be a developer. <br />
Follow each of these steps:<br />
<br />
'''1.''' Go to the Twitter development homepage: https://developer.twitter.com/ <br />
<br />
'''2.''' If you're not already signed in to Twitter, click on '''Sign In''' in the top right corner of the page. You can sign in with your normal Twitter account. (It may take you to your Twitter home page when you sign in. If so, return to https://developer.twitter.com/ once you're logged on.) <br />
<br />
'''3.''' Click on the [https://developer.twitter.com/en/apply-for-access "Apply" link] (https://developer.twitter.com/en/apply-for-access). The link should be located in the top right of the page beside "Apps" and your Twitter icon.<br />
<br />
'''4''' Click "Apply for a Developer Account" in the middle of the page.<br />
<br />
'''5''' The next page asks "What is your primary reason for using Twitter developer tools?" and gives you a lot of options. ''Click Student'', which is in the third column. <br />
<br />
'''6''' On the next page, under "what would you like us to call you", put "CDSW_student".<br />
<br />
What you are signing up for is an Individual Developer Account (as opposed to Team Developer Account). <br />
<br />
[[File:Capture20200126.PNG|400px]]<br />
<br />
'''7''' Next, Twitter will ask you about your plans. ''Please follow these instructions carefully to make sure Twitter approves your application.''<br />
<br />
In the field "In your words":<br />
<br />
I am taking a Community Data Science course at the University of Washington. My instructors are Mako Hill (makohill@uw.com), Tommy Guy (guyrt@uw.ed), and Dharma Dailey (ddailey@uw.edu). You can find our workshop details at https://wiki.communitydata.science/Community_Data_Science_Workshops_(Winter_2020).<br />
<br />
Under "The Specifics" check yes for "Are you planning to analyze Twitter data" and enter the following text:<br />
<br />
We are learning to download Twitter data and do basic analysis. For instance, we will try to determine whether an earthquake has happened recently or whether there is a basketball game going on. <br />
<br />
Uncheck the sliders for "Will your app use Tweet, Retweet, like, follow, or Direct Message functionality?" and all other options.<br />
<br />
[[File:Capture20200126_1.PNG|400px]]<br />
<br />
[[File:Capture20200126_2.PNG|400px]]<br />
<br />
<br />
'''8''' Click "next" in the lower right then click "Looks good" on the review page. Finally, accept the terms of service and click "Submit Application" on the next page.<br />
<br />
<br />
<br />
'''9''' Twitter will send an email to the account you used. Click "Confirm your email" in that email to finish setup.<br />
<br />
<br />
<br />
'''If you have any trouble with the steps before this, email us before Saturday.''' If you have trouble on the next steps, we'll be able to help you on Saturday.<br />
<br />
<br />
== Confirm your developer email address ==<br />
<br />
'''10''' When you confirm in the email, you will arrive at https://developer.twitter.com/en/account/get-started. On that page, click "Create an app". This will take you to https://developer.twitter.com/en/apps<br />
<br />
'''11''' Click "Create an app", which takes you to https://developer.twitter.com/en/apps/create. You'll need to fill in a few details about your app.<br />
<br />
App name: "CDSW Sample <Your_First_and_Last_Name>"<br />
<br />
Application Description: "Sample application for the CDSW workshop."<br />
<br />
Website: "https://www.example.com"<br />
<br />
Callback URLs: "https://www.example.com"<br />
<br />
Leave "Enable Sign in with Twitter" unchecked.<br />
<br />
The next few fields are not needed, but scroll to the bottom to find "Tell us how this app will be used".<br />
<br />
Tell us how this app will be used: "Learning data science with python in the Community Data Science workshop. This app is for testing purposes only."<br />
<br />
Finally, click create, and click create again in the modal window.<br />
<br />
*Almost there!!* <br />
<br />
== Generate and copy your individual, private, unique Twitter developer credentials == <br />
'''12''' In the next step, you will access Twitter credentials, which will let you authenticate with Twitter in python.<br />
<br />
You need unique, private credentials to collect tweets. You will be pasting these credentials into your Python code. Be sure if you share your Python code, you ***do not** share your unique developer credentials. <br />
<br />
You should be at a page that looks like:<br />
<br />
[[File:Capture20200126_2.PNG|400px]]<br />
<br />
Click the "Keys and Tokens" tab. You will see a box called "Consumer API keys" with two long strings labeled "API key" and "API secret key". You should copy and paste those into a text file on your desktop.<br />
<br />
Finally, click "Generate" which will open a modal with two new strings called "Access Token" and "Access Token Secret". Copy these two keys to the same file and close the modal.<br />
<br />
You will need all four of these strings in order to have your Twitter application work.<br />
<br />
'''Keep this material secret.''' Your access token and access token secret will allow anybody who has it to post to Twitter as you and to control your account. It is equivalent to your Twitter username and password so please be as careful with it as you would be with your Twitter password!<br />
<br />
== Other documentation ==<br />
In this workshop, we'll be working with TWO different Twitter APIs, "Standard Search" and "Realtime."<br />
<br />
More about the using the Twitter Search API : <br />
* [https://developer.twitter.com/en/docs/tweets/search/overview Official Twitter info on the Search API]<br />
<br />
For this workshop, we'll be working with the "Standard Search", the most limited of Twitter Search API options <br />
* [https://developer.twitter.com/en/docs/tweets/search/overview/standard Twitter "Standard Search"]<br />
<br />
This page has some helpful intel about modifying Standard Search parameters (including sample request and response):<br />
* [https://developer.twitter.com/en/docs/tweets/search/api-reference/get-search-tweets Getting search tweets.]<br />
<br />
Using the Twitter Realtime API : <br />
* [https://developer.twitter.com/en/docs/tweets/filter-realtime/overview Official Documentation Overview of the Realtime API]<br />
<br />
<br />
More about the developer credentials you just generated: <br />
* [https://developer.twitter.com/en/docs/basics/getting-started Official documentation on how to get Tokens from developer.twitter.com]<br />
<br />
[[Category:CDSW]]</div>Ddaileyhttps://wiki.communitydata.science/index.php?title=Twitter_authentication_setup&diff=187523Twitter authentication setup2020-01-27T03:54:09Z<p>Ddailey: </p>
<hr />
<div>[[File:Twitter.png|right|200px]]<br />
<br />
Things you will need before you start:<br />
<br />
==Get a Twitter Account and Link It to a Mobile Phone ==<br />
'''A Twitter account.''' To collect tweets from Twitter, you need a Twitter account. If your Twitter profile doesn't have your current mobile number associated with it, you will need to add your mobile number in order to create your new app as part of the process.<br />
<br />
<br />
== Apply to be a Twitter Developer == <br />
<br />
To collect tweets, you need to be approved by Twitter to be a developer. <br />
Follow each of these steps:<br />
<br />
'''1.''' Go to the Twitter development homepage: https://developer.twitter.com/ <br />
<br />
'''2.''' If you're not already signed in to Twitter, click on '''Sign In''' in the top right corner of the page. You can sign in with your normal Twitter account. (It may take you to your Twitter home page when you sign in. If so, return to https://developer.twitter.com/ once you're logged on.) <br />
<br />
'''3.''' Click on the [https://developer.twitter.com/en/apply-for-access "Apply" link] (https://developer.twitter.com/en/apply-for-access). The link should be located in the top right of the page beside "Apps" and your Twitter icon.<br />
<br />
'''4''' Click "Apply for a Developer Account" in the middle of the page.<br />
<br />
'''5''' The next page asks "What is your primary reason for using Twitter developer tools?" and gives you a lot of options. ''Click Student'', which is in the third column. <br />
<br />
'''6''' On the next page, under "what would you like us to call you", put "CDSW_student".<br />
<br />
What you are signing up for is an Individual Developer Account (as opposed to Team Developer Account). <br />
<br />
[[File:Capture20200126.PNG|400px]]<br />
<br />
'''7''' Next, Twitter will ask you about your plans. ''Please follow these instructions carefully to make sure Twitter approves your application.''<br />
<br />
In the field "In your words":<br />
<br />
I am taking a Community Data Science course at the University of Washington. My instructors are Mako Hill (makohill@uw.com), Tommy Guy (guyrt@uw.ed), and Dharma Dailey (ddailey@uw.edu). You can find our workshop details at https://wiki.communitydata.science/Community_Data_Science_Workshops_(Winter_2020).<br />
<br />
Under "The Specifics" check yes for "Are you planning to analyze Twitter data" and enter the following text:<br />
<br />
We are learning to download Twitter data and do basic analysis. For instance, we will try to determine whether an earthquake has happened recently or whether there is a basketball game going on. <br />
<br />
Uncheck the sliders for "Will your app use Tweet, Retweet, like, follow, or Direct Message functionality?" and all other options.<br />
<br />
[[File:Capture20200126_1.PNG|400px]]<br />
<br />
[[File:Capture20200126_2.PNG|400px]]<br />
<br />
<br />
'''8''' Click "next" in the lower right then click "Looks good" on the review page. Finally, accept the terms of service and click "Submit Application" on the next page.<br />
<br />
<br />
<br />
'''9''' Twitter will send an email to the account you used. Click "Confirm your email" in that email to finish setup.<br />
<br />
<br />
<br />
'''If you have any trouble with the steps before this, email us before Saturday.''' If you have trouble on the next steps, we'll be able to help you on Saturday.<br />
<br />
<br />
== Confirm Your Developer Email Address ==<br />
<br />
'''10''' When you confirm in the email, you will arrive at https://developer.twitter.com/en/account/get-started. On that page, click "Create an app". This will take you to https://developer.twitter.com/en/apps<br />
<br />
'''11''' Click "Create an app", which takes you to https://developer.twitter.com/en/apps/create. You'll need to fill in a few details about your app.<br />
<br />
App name: "CDSW Sample <Your_First_and_Last_Name>"<br />
<br />
Application Description: "Sample application for the CDSW workshop."<br />
<br />
Website: "https://www.example.com"<br />
<br />
Callback URLs: "https://www.example.com"<br />
<br />
Leave "Enable Sign in with Twitter" unchecked.<br />
<br />
The next few fields are not needed, but scroll to the bottom to find "Tell us how this app will be used".<br />
<br />
Tell us how this app will be used: "Learning data science with python in the Community Data Science workshop. This app is for testing purposes only."<br />
<br />
Finally, click create, and click create again in the modal window.<br />
<br />
*Almost there!!* <br />
<br />
== Generate and copy your individual, private, unique Twitter developer credentials == <br />
'''12''' In the next step, you will access Twitter credentials, which will let you authenticate with Twitter in python.<br />
<br />
You need unique, private credentials to collect tweets. You will be pasting these credentials into your Python code. Be sure if you share your Python code, you ***do not** share your unique developer credentials. <br />
<br />
You should be at a page that looks like:<br />
<br />
[[File:Capture20200126_2.PNG|400px]]<br />
<br />
Click the "Keys and Tokens" tab. You will see a box called "Consumer API keys" with two long strings labeled "API key" and "API secret key". You should copy and paste those into a text file on your desktop.<br />
<br />
Finally, click "Generate" which will open a modal with two new strings called "Access Token" and "Access Token Secret". Copy these two keys to the same file and close the modal.<br />
<br />
You will need all four of these strings in order to have your Twitter application work.<br />
<br />
'''Keep this material secret.''' Your access token and access token secret will allow anybody who has it to post to Twitter as you and to control your account. It is equivalent to your Twitter username and password so please be as careful with it as you would be with your Twitter password!<br />
<br />
== Other documentation ==<br />
In this workshop, we'll be working with TWO different Twitter APIs, "Standard Search" and "Realtime."<br />
<br />
More about the using the Twitter Search API : <br />
* [https://developer.twitter.com/en/docs/tweets/search/overview Official Twitter info on the Search API]<br />
<br />
For this workshop, we'll be working with the "Standard Search", the most limited of Twitter Search API options <br />
* [https://developer.twitter.com/en/docs/tweets/search/overview/standard Twitter "Standard Search"]<br />
<br />
This page has some helpful intel about modifying Standard Search parameters (including sample request and response):<br />
* [https://developer.twitter.com/en/docs/tweets/search/api-reference/get-search-tweets Getting search tweets.]<br />
<br />
Using the Twitter Realtime API : <br />
* [https://developer.twitter.com/en/docs/tweets/filter-realtime/overview Official Documentation Overview of the Realtime API]<br />
<br />
<br />
More about the developer credentials you just generated: <br />
* [https://developer.twitter.com/en/docs/basics/getting-started Official documentation on how to get Tokens from developer.twitter.com]<br />
<br />
[[Category:CDSW]]</div>Ddaileyhttps://wiki.communitydata.science/index.php?title=Twitter_authentication_setup&diff=187522Twitter authentication setup2020-01-27T03:51:39Z<p>Ddailey: </p>
<hr />
<div>[[File:Twitter.png|right|200px]]<br />
<br />
Things you will need before you start:<br />
<br />
==GET A TWITTER ACCOUNT AND LINK IT TO A MOBILE PHONE ==<br />
'''A Twitter account.''' To collect tweets from Twitter, you need a Twitter account. If your Twitter profile doesn't have your current mobile number associated with it, you will need to add your mobile number in order to create your new app as part of the process.<br />
<br />
<br />
== APPLY TO BE A TWITTER DEVELOPER == <br />
<br />
To collect tweets, you need to be approved by Twitter to be a developer. <br />
Follow each of these steps:<br />
<br />
'''1.''' Go to the Twitter development homepage: https://developer.twitter.com/ <br />
<br />
'''2.''' If you're not already signed in to Twitter, click on '''Sign In''' in the top right corner of the page. You can sign in with your normal Twitter account. (It may take you to your Twitter home page when you sign in. If so, return to https://developer.twitter.com/ once you're logged on.) <br />
<br />
'''3.''' Click on the [https://developer.twitter.com/en/apply-for-access "Apply" link] (https://developer.twitter.com/en/apply-for-access). The link should be located in the top right of the page beside "Apps" and your Twitter icon.<br />
<br />
'''4''' Click "Apply for a Developer Account" in the middle of the page.<br />
<br />
'''5''' The next page asks "What is your primary reason for using Twitter developer tools?" and gives you a lot of options. ''Click Student'', which is in the third column. <br />
<br />
'''6''' On the next page, under "what would you like us to call you", put "CDSW_student".<br />
<br />
What you are signing up for is an Individual Developer Account (as opposed to Team Developer Account). <br />
<br />
[[File:Capture20200126.PNG|400px]]<br />
<br />
'''7''' Next, Twitter will ask you about your plans. ''Please follow these instructions carefully to make sure Twitter approves your application.''<br />
<br />
In the field "In your words":<br />
<br />
I am taking a Community Data Science course at the University of Washington. My instructors are Mako Hill (makohill@uw.com), Tommy Guy (guyrt@uw.ed), and Dharma Dailey (ddailey@uw.edu). You can find our workshop details at https://wiki.communitydata.science/Community_Data_Science_Workshops_(Winter_2020).<br />
<br />
Under "The Specifics" check yes for "Are you planning to analyze Twitter data" and enter the following text:<br />
<br />
We are learning to download Twitter data and do basic analysis. For instance, we will try to determine whether an earthquake has happened recently or whether there is a basketball game going on. <br />
<br />
Uncheck the sliders for "Will your app use Tweet, Retweet, like, follow, or Direct Message functionality?" and all other options.<br />
<br />
[[File:Capture20200126_1.PNG|400px]]<br />
<br />
[[File:Capture20200126_2.PNG|400px]]<br />
<br />
<br />
'''8''' Click "next" in the lower right then click "Looks good" on the review page. Finally, accept the terms of service and click "Submit Application" on the next page.<br />
<br />
<br />
<br />
'''9''' Twitter will send an email to the account you used. Click "Confirm your email" in that email to finish setup.<br />
<br />
<br />
<br />
'''If you have any trouble with the steps before this, email us before Saturday.''' If you have trouble on the next steps, we'll be able to help you on Saturday.<br />
<br />
<br />
== CONFIRM YOUR DEVELOPER EMAIL ADDRESS ==<br />
<br />
'''10''' When you confirm in the email, you will arrive at https://developer.twitter.com/en/account/get-started. On that page, click "Create an app". This will take you to https://developer.twitter.com/en/apps<br />
<br />
'''11''' Click "Create an app", which takes you to https://developer.twitter.com/en/apps/create. You'll need to fill in a few details about your app.<br />
<br />
App name: "CDSW Sample <Your_First_and_Last_Name>"<br />
<br />
Application Description: "Sample application for the CDSW workshop."<br />
<br />
Website: "https://www.example.com"<br />
<br />
Callback URLs: "https://www.example.com"<br />
<br />
Leave "Enable Sign in with Twitter" unchecked.<br />
<br />
The next few fields are not needed, but scroll to the bottom to find "Tell us how this app will be used".<br />
<br />
Tell us how this app will be used: "Learning data science with python in the Community Data Science workshop. This app is for testing purposes only."<br />
<br />
Finally, click create, and click create again in the modal window.<br />
<br />
*Almost there!!* <br />
<br />
== ACCESS YOUR PERSONAL, PRIVATE UNIQUE DEVELOPER CREDENTIAL == <br />
'''12''' In the next step, you will access Twitter credentials, which will let you authenticate with Twitter in python.<br />
<br />
You need unique, private credentials to collect tweets. You will be pasting these credentials into your Python code. Be sure if you share your Python code, you ***do not** share your unique developer credentials. <br />
<br />
You should be at a page that looks like:<br />
<br />
[[File:Capture20200126_2.PNG|400px]]<br />
<br />
Click the "Keys and Tokens" tab. You will see a box called "Consumer API keys" with two long strings labeled "API key" and "API secret key". You should copy and paste those into a text file on your desktop.<br />
<br />
Finally, click "Generate" which will open a modal with two new strings called "Access Token" and "Access Token Secret". Copy these two keys to the same file and close the modal.<br />
<br />
You will need all four of these strings in order to have your Twitter application work.<br />
<br />
'''Keep this material secret.''' Your access token and access token secret will allow anybody who has it to post to Twitter as you and to control your account. It is equivalent to your Twitter username and password so please be as careful with it as you would be with your Twitter password!<br />
<br />
== Other documentation ==<br />
In this workshop, we'll be working with TWO different Twitter APIs, "Standard Search" and "Realtime."<br />
<br />
More about the using the Twitter Search API : <br />
* [https://developer.twitter.com/en/docs/tweets/search/overview Official Twitter info on the Search API]<br />
<br />
For this workshop, we'll be working with the "Standard Search", the most limited of Twitter Search API options <br />
* [https://developer.twitter.com/en/docs/tweets/search/overview/standard Twitter "Standard Search"]<br />
<br />
This page has some helpful intel about modifying Standard Search parameters (including sample request and response):<br />
* [https://developer.twitter.com/en/docs/tweets/search/api-reference/get-search-tweets Getting search tweets.]<br />
<br />
Using the Twitter Realtime API : <br />
* [https://developer.twitter.com/en/docs/tweets/filter-realtime/overview Official Documentation Overview of the Realtime API]<br />
<br />
<br />
More about the developer credentials you just generated: <br />
* [https://developer.twitter.com/en/docs/basics/getting-started Official documentation on how to get Tokens from developer.twitter.com]<br />
<br />
[[Category:CDSW]]</div>Ddaileyhttps://wiki.communitydata.science/index.php?title=Twitter_authentication_setup&diff=187520Twitter authentication setup2020-01-27T03:50:03Z<p>Ddailey: </p>
<hr />
<div>[[File:Twitter.png|right|200px]]<br />
<br />
Things you will need before you start:<br />
<br />
***GET A TWITTER ACCOUNT AND LINK IT TO A MOBILE PHONE***<br />
'''A Twitter account.''' To collect tweets from Twitter, you need a Twitter account. If your Twitter profile doesn't have your current mobile number associated with it, you will need to add your mobile number in order to create your new app as part of the process.<br />
<br />
<br />
***APPLY TO BE A TWITTER DEVELOPER*** <br />
<br />
To collect tweets, you need to be approved by Twitter to be a developer. <br />
Follow each of these steps:<br />
<br />
'''1.''' Go to the Twitter development homepage: https://developer.twitter.com/ <br />
<br />
'''2.''' If you're not already signed in to Twitter, click on '''Sign In''' in the top right corner of the page. You can sign in with your normal Twitter account. (It may take you to your Twitter home page when you sign in. If so, return to https://developer.twitter.com/ once you're logged on.) <br />
<br />
'''3.''' Click on the [https://developer.twitter.com/en/apply-for-access "Apply" link] (https://developer.twitter.com/en/apply-for-access). The link should be located in the top right of the page beside "Apps" and your Twitter icon.<br />
<br />
'''4''' Click "Apply for a Developer Account" in the middle of the page.<br />
<br />
'''5''' The next page asks "What is your primary reason for using Twitter developer tools?" and gives you a lot of options. ''Click Student'', which is in the third column. <br />
<br />
'''6''' On the next page, under "what would you like us to call you", put "CDSW_student".<br />
<br />
What you are signing up for is an Individual Developer Account (as opposed to Team Developer Account). <br />
<br />
[[File:Capture20200126.PNG|400px]]<br />
<br />
'''7''' Next, Twitter will ask you about your plans. ''Please follow these instructions carefully to make sure Twitter approves your application.''<br />
<br />
In the field "In your words":<br />
<br />
I am taking a Community Data Science course at the University of Washington. My instructors are Mako Hill (makohill@uw.com), Tommy Guy (guyrt@uw.ed), and Dharma Dailey (ddailey@uw.edu). You can find our workshop details at https://wiki.communitydata.science/Community_Data_Science_Workshops_(Winter_2020).<br />
<br />
Under "The Specifics" check yes for "Are you planning to analyze Twitter data" and enter the following text:<br />
<br />
We are learning to download Twitter data and do basic analysis. For instance, we will try to determine whether an earthquake has happened recently or whether there is a basketball game going on. <br />
<br />
Uncheck the sliders for "Will your app use Tweet, Retweet, like, follow, or Direct Message functionality?" and all other options.<br />
<br />
[[File:Capture20200126_1.PNG|400px]]<br />
<br />
[[File:Capture20200126_2.PNG|400px]]<br />
<br />
<br />
'''8''' Click "next" in the lower right then click "Looks good" on the review page. Finally, accept the terms of service and click "Submit Application" on the next page.<br />
<br />
<br />
<br />
'''9''' Twitter will send an email to the account you used. Click "Confirm your email" in that email to finish setup.<br />
<br />
<br />
<br />
'''If you have any trouble with the steps before this, email us before Saturday.''' If you have trouble on the next steps, we'll be able to help you on Saturday.<br />
<br />
<br />
***CONFIRM YOUR DEVELOPER EMAIL ADDRESS*** <br />
<br />
'''10''' When you confirm in the email, you will arrive at https://developer.twitter.com/en/account/get-started. On that page, click "Create an app". This will take you to https://developer.twitter.com/en/apps<br />
<br />
'''11''' Click "Create an app", which takes you to https://developer.twitter.com/en/apps/create. You'll need to fill in a few details about your app.<br />
<br />
App name: "CDSW Sample <Your_First_and_Last_Name>"<br />
<br />
Application Description: "Sample application for the CDSW workshop."<br />
<br />
Website: "https://www.example.com"<br />
<br />
Callback URLs: "https://www.example.com"<br />
<br />
Leave "Enable Sign in with Twitter" unchecked.<br />
<br />
The next few fields are not needed, but scroll to the bottom to find "Tell us how this app will be used".<br />
<br />
Tell us how this app will be used: "Learning data science with python in the Community Data Science workshop. This app is for testing purposes only."<br />
<br />
Finally, click create, and click create again in the modal window.<br />
<br />
*Almost there!!* <br />
<br />
***ACCESS YOUR PERSONAL, PRIVATE UNIQUE DEVELOPER CREDENTIALS*** <br />
'''12''' In the next step, you will access Twitter credentials, which will let you authenticate with Twitter in python.<br />
<br />
You need unique, private credentials to collect tweets. You will be pasting these credentials into your Python code. Be sure if you share your Python code, you ***do not** share your unique developer credentials. <br />
<br />
You should be at a page that looks like:<br />
<br />
[[File:Capture20200126_2.PNG|400px]]<br />
<br />
Click the "Keys and Tokens" tab. You will see a box called "Consumer API keys" with two long strings labeled "API key" and "API secret key". You should copy and paste those into a text file on your desktop.<br />
<br />
Finally, click "Generate" which will open a modal with two new strings called "Access Token" and "Access Token Secret". Copy these two keys to the same file and close the modal.<br />
<br />
You will need all four of these strings in order to have your Twitter application work.<br />
<br />
'''Keep this material secret.''' Your access token and access token secret will allow anybody who has it to post to Twitter as you and to control your account. It is equivalent to your Twitter username and password so please be as careful with it as you would be with your Twitter password!<br />
<br />
== Other documentation ==<br />
In this workshop, we'll be working with TWO different Twitter APIs, "Standard Search" and "Realtime."<br />
<br />
More about the using the Twitter Search API : <br />
* [https://developer.twitter.com/en/docs/tweets/search/overview Official Twitter info on the Search API]<br />
<br />
For this workshop, we'll be working with the "Standard Search", the most limited of Twitter Search API options <br />
* [https://developer.twitter.com/en/docs/tweets/search/overview/standard Twitter "Standard Search"]<br />
<br />
This page has some helpful intel about modifying Standard Search parameters (including sample request and response):<br />
* [https://developer.twitter.com/en/docs/tweets/search/api-reference/get-search-tweets Getting search tweets.]<br />
<br />
Using the Twitter Realtime API : <br />
* [https://developer.twitter.com/en/docs/tweets/filter-realtime/overview Official Documentation Overview of the Realtime API]<br />
<br />
<br />
More about the developer credentials you just generated: <br />
* [https://developer.twitter.com/en/docs/basics/getting-started Official documentation on how to get Tokens from developer.twitter.com]<br />
<br />
[[Category:CDSW]]</div>Ddaileyhttps://wiki.communitydata.science/index.php?title=Twitter_authentication_setup&diff=187517Twitter authentication setup2020-01-27T03:36:46Z<p>Ddailey: </p>
<hr />
<div>[[File:Twitter.png|right|200px]]<br />
<br />
Things you will need before you start:<br />
<br />
***GET A TWITTER ACCOUNT AND LINK IT TO A MOBILE PHONE***<br />
'''A Twitter account.''' To collect tweets from Twitter, you need a Twitter account. If your Twitter profile doesn't have your current mobile number associated with it, you will need to add your mobile number in order to create your new app as part of the process.<br />
<br />
<br />
***APPLY TO BE A TWITTER DEVELOPER*** <br />
<br />
To collect tweets, you need to be approved by Twitter to be a developer. <br />
Follow each of these steps:<br />
<br />
'''1.''' Go to the Twitter development homepage: https://developer.twitter.com/ <br />
<br />
'''2.''' If you're not already signed in to Twitter, click on '''Sign In''' in the top right corner of the page. You can sign in with your normal Twitter account. (It may take you to your Twitter home page when you sign in. If so, return to https://developer.twitter.com/ once you're logged on.) <br />
<br />
'''3.''' Click on the [https://developer.twitter.com/en/apply-for-access "Apply" link] (https://developer.twitter.com/en/apply-for-access). The link should be located in the top right of the page beside "Apps" and your Twitter icon.<br />
<br />
'''4''' Click "Apply for a Developer Account" in the middle of the page.<br />
<br />
'''5''' The next page asks "What is your primary reason for using Twitter developer tools?" and gives you a lot of options. ''Click Student'', which is in the third column. <br />
<br />
'''6''' On the next page, under "what would you like us to call you", put "CDSW_student".<br />
<br />
What you are signing up for is an Individual Developer Account (as opposed to Team Developer Account). <br />
<br />
[[File:Capture20200126.PNG|400px]]<br />
<br />
'''7''' Next, Twitter will ask you about your plans. ''Please follow these instructions carefully to make sure Twitter approves your application.''<br />
<br />
In the field "In your words":<br />
<br />
I am taking a Community Data Science course at the University of Washington. My instructors are Mako Hill (makohill@uw.com), Tommy Guy (guyrt@uw.ed), and Dharma Dailey (ddailey@uw.edu). You can find our workshop details at https://wiki.communitydata.science/Community_Data_Science_Workshops_(Winter_2020).<br />
<br />
Under "The Specifics" check yes for "Are you planning to analyze Twitter data" and enter the following text:<br />
<br />
We are learning to download Twitter data and do basic analysis. For instance, we will try to determine whether an earthquake has happened recently or whether there is a basketball game going on. <br />
<br />
Uncheck the sliders for "Will your app use Tweet, Retweet, like, follow, or Direct Message functionality?" and all other options.<br />
<br />
[[File:Capture20200126_1.PNG|400px]]<br />
<br />
[[File:Capture20200126_2.PNG|400px]]<br />
<br />
<br />
'''8''' Click "next" in the lower right then click "Looks good" on the review page. Finally, accept the terms of service and click "Submit Application" on the next page.<br />
<br />
<br />
<br />
'''9''' Twitter will send an email to the account you used. Click "Confirm your email" in that email to finish setup.<br />
<br />
<br />
<br />
'''If you have any trouble with the steps before this, email us before Saturday.''' If you have trouble on the next steps, we'll be able to help you on Saturday.<br />
<br />
<br />
***CONFIRM YOUR DEVELOPER EMAIL ADDRESS*** <br />
<br />
'''10''' When you confirm in the email, you will arrive at https://developer.twitter.com/en/account/get-started. On that page, click "Create an app". This will take you to https://developer.twitter.com/en/apps<br />
<br />
'''11''' Click "Create an app", which takes you to https://developer.twitter.com/en/apps/create. You'll need to fill in a few details about your app.<br />
<br />
App name: "CDSW Sample <Your_First_and_Last_Name>"<br />
<br />
Application Description: "Sample application for the CDSW workshop."<br />
<br />
Website: "https://www.example.com"<br />
<br />
Callback URLs: "https://www.example.com"<br />
<br />
Leave "Enable Sign in with Twitter" unchecked.<br />
<br />
The next few fields are not needed, but scroll to the bottom to find "Tell us how this app will be used".<br />
<br />
Tell us how this app will be used: "Learning data science with python in the Community Data Science workshop. This app is for testing purposes only."<br />
<br />
Finally, click create, and click create again in the modal window.<br />
<br />
*Almost there!!* <br />
<br />
***ACCESS YOUR PERSONAL, PRIVATE UNIQUE DEVELOPER CREDENTIALS*** <br />
'''12''' In the next step, you will access Twitter credentials, which will let you authenticate with Twitter in python.<br />
<br />
You need unique, private credentials to collect tweets. You will be pasting these credentials into your Python code. Be sure if you share your Python code, you ***do not** share your unique developer credentials. <br />
<br />
You should be at a page that looks like:<br />
<br />
[[File:Capture20200126_2.PNG|400px]]<br />
<br />
Click the "Keys and Tokens" tab. You will see a box called "Consumer API keys" with two long strings labeled "API key" and "API secret key". You should copy and paste those into a text file on your desktop.<br />
<br />
Finally, click "Generate" which will open a modal with two new strings called "Access Token" and "Access Token Secret". Copy these two keys to the same file and close the modal.<br />
<br />
You will need all four of these strings in order to have your Twitter application work.<br />
<br />
'''Keep this material secret.''' Your access token and access token secret will allow anybody who has it to post to Twitter as you and to control your account. It is equivalent to your Twitter username and password so please be as careful with it as you would be with your Twitter password!<br />
<br />
== Other documentation ==<br />
In this workshop, we'll be working with TWO different Twitter APIs, "Standard Search" and "Realtime."<br />
<br />
More about the using the Twitter Search API : <br />
* [https://developer.twitter.com/en/docs/tweets/search/overview]<br />
<br />
For this workshop, we'll be working with the "Standard Search", the most limited of Twitter API options <br />
* [https://developer.twitter.com/en/docs/tweets/search/overview/standard]<br />
<br />
This page has some helpful intel about modifying Standard Search parameters (including sample request and response):<br />
* [https://developer.twitter.com/en/docs/tweets/search/api-reference/get-search-tweets]<br />
<br />
More about the using the Twitter Realtime API : <br />
* [https://developer.twitter.com/en/docs/tweets/filter-realtime/overview]<br />
<br />
<br />
More about the developer credentials you just generated: <br />
* [https://developer.twitter.com/en/docs/basics/getting-started Official documentation on how to get Tokens from developer.twitter.com]<br />
<br />
[[Category:CDSW]]</div>Ddaileyhttps://wiki.communitydata.science/index.php?title=Twitter_authentication_setup&diff=187508Twitter authentication setup2020-01-27T03:18:02Z<p>Ddailey: </p>
<hr />
<div>[[File:Twitter.png|right|200px]]<br />
<br />
Things you will need before you start:<br />
<br />
* '''A Twitter account.''' If your Twitter profile doesn't have your current mobile number associated with it, you will need to add your mobile number in order to create your new app as part of the process.<br />
<br />
Follow each of these steps:<br />
<br />
'''1.''' Go to the Twitter development homepage: https://developer.twitter.com/ <br />
<br />
'''2.''' If you're not already signed in to Twitter, click on '''Sign In''' in the top right corner of the page. You can sign in with your normal Twitter account. (It may take you to your Twitter home page when you sign in. If so, return to https://developer.twitter.com/ once you're logged on.) <br />
<br />
'''3.''' Click on the [https://developer.twitter.com/en/apply-for-access "Apply" link] (https://developer.twitter.com/en/apply-for-access). The link should be located in the top right of the page beside "Apps" and your Twitter icon.<br />
<br />
'''4''' Click "Apply for a Developer Account" in the middle of the page.<br />
<br />
'''5''' The next page asks "What is your primary reason for using Twitter developer tools?" and gives you a lot of options. ''Click Student'', which is in the third column. <br />
<br />
'''6''' On the next page, under "what would you like us to call you", put "CDSW_student".<br />
<br />
What you are signing up for is an Individual Developer Account (as opposed to Team Developer Account). <br />
<br />
[[File:Capture20200126.PNG|400px]]<br />
<br />
'''7''' Next, Twitter will ask you about your plans. ''Please follow these instructions carefully to make sure Twitter approves your application.''<br />
<br />
In the field "In your words":<br />
<br />
I am taking a Community Data Science course at the University of Washington. My instructors are Mako Hill (makohill@uw.com), Tommy Guy (guyrt@uw.ed), and Dharma Dailey (ddailey@uw.edu). You can find our workshop details at https://wiki.communitydata.science/Community_Data_Science_Workshops_(Winter_2020).<br />
<br />
Under "The Specifics" check yes for "Are you planning to analyze Twitter data" and enter the following text:<br />
<br />
We are learning to download Twitter data and do basic analysis. For instance, we will try to determine whether an earthquake has happened recently or whether there is a basketball game going on. <br />
<br />
Uncheck the sliders for "Will your app use Tweet, Retweet, like, follow, or Direct Message functionality?" and all other options.<br />
<br />
[[File:Capture20200126_1.PNG|400px]]<br />
<br />
[[File:Capture20200126_2.PNG|400px]]<br />
<br />
<br />
'''8''' Click "next" in the lower right then click "Looks good" on the review page. Finally, accept the terms of service and click "Submit Application" on the next page.<br />
<br />
<br />
'''9''' Twitter will send an email to the account you used. Click "Confirm your email" in that email to finish setup.<br />
<br />
<br />
<br />
'''If you have any trouble with the steps before this, email us before Saturday.''' If you have trouble on the next steps, we'll be able to help you on Saturday.<br />
<br />
<br />
'''10''' When you confirm in the email, you will arrive at https://developer.twitter.com/en/account/get-started. On that page, click "Create an app". This will take you to https://developer.twitter.com/en/apps<br />
<br />
'''11''' Click "Create an app", which takes you to https://developer.twitter.com/en/apps/create. You'll need to fill in a few details about your app.<br />
<br />
App name: "CDSW Sample <Your_First_and_Last_Name>"<br />
<br />
Application Description: "Sample application for the CDSW workshop."<br />
<br />
Website: "https://www.example.com"<br />
<br />
Callback URLs: "https://www.example.com"<br />
<br />
Leave "Enable Sign in with Twitter" unchecked.<br />
<br />
The next few fields are not needed, but scroll to the bottom to find "Tell us how this app will be used".<br />
<br />
Tell us how this app will be used: "Learning data science with python in the Community Data Science workshop. This app is for testing purposes only."<br />
<br />
Finally, click create, and click create again in the modal window.<br />
<br />
*Almost there!!* <br />
<br />
'''12''' In the next step, you will access Twitter credentials, which will let you authenticate with Twitter in python.<br />
<br />
You should be at a page that looks like:<br />
<br />
[[File:Capture20200126_2.PNG|400px]]<br />
<br />
Click the "Keys and Tokens" tab. You will see a box called "Consumer API keys" with two long strings labeled "API key" and "API secret key". You should copy and paste those into a text file on your desktop.<br />
<br />
Finally, click "Generate" which will open a modal with two new strings called "Access Token" and "Access Token Secret". Copy these two keys to the same file and close the modal.<br />
<br />
You will need all four of these strings in order to have your Twitter application work.<br />
<br />
'''Keep this material secret.''' Your access token and access token secret will allow anybody who has it to post to Twitter as you and to control your account. It is equivalent to your Twitter username and password so please be as careful with it as you would be with your Twitter password!<br />
<br />
== Other documentation ==<br />
<br />
* [https://developer.twitter.com/en/docs/basics/getting-started Official documentation on how to get Tokens from developer.twitter.com]<br />
<br />
[[Category:CDSW]]</div>Ddaileyhttps://wiki.communitydata.science/index.php?title=Twitter_authentication_setup&diff=187506Twitter authentication setup2020-01-27T03:00:40Z<p>Ddailey: </p>
<hr />
<div>[[File:Twitter.png|right|200px]]<br />
<br />
Things you will need before you start:<br />
<br />
* '''A Twitter account.''' If your Twitter profile doesn't have your current mobile number associated with it, you will need to add your mobile number in order to create your new app as part of the process.<br />
<br />
Follow each of these steps:<br />
<br />
'''1.''' Go to the Twitter development homepage: https://developer.twitter.com/ <br />
<br />
'''2.''' If you're not already signed in to Twitter, click on '''Sign In''' in the top right corner of the page. You can sign in with your normal Twitter account. (It may take you to your Twitter home page when you sign in. If so, return to https://developer.twitter.com/ once you're logged on.) <br />
<br />
'''3.''' Click on the [https://developer.twitter.com/en/apply-for-access "Apply" link] (https://developer.twitter.com/en/apply-for-access). The link should be located in the top right of the page beside "Apps" and your Twitter icon.<br />
<br />
'''4''' Click "Apply for a Developer Account" in the middle of the page.<br />
<br />
'''5''' The next page asks "What is your primary reason for using Twitter developer tools?" and gives you a lot of options. ''Click Student'', which is in the third column. <br />
<br />
'''6''' On the next page, under "what would you like us to call you", put "CDSW_student".<br />
<br />
What you are signing up for is an Individual Developer Account (as opposed to Team Developer Account). <br />
<br />
[[File:Capture20200126.PNG|400px]]<br />
<br />
'''7''' Next, Twitter will ask you about your plans. ''Please follow these instructions carefully to make sure Twitter approves your application.''<br />
<br />
In the field "In your words":<br />
<br />
I am taking a Community Data Science course at the University of Washington. My instructors are Mako Hill (makohill@uw.com), Tommy Guy (guyrt@uw.ed), and Dharma Dailey (ddailey@uw.edu). You can find our workshop details at https://wiki.communitydata.science/Community_Data_Science_Workshops_(Winter_2020).<br />
<br />
Under "The Specifics" check yes for "Are you planning to analyze Twitter data" and enter the following text:<br />
<br />
We are learning to download Twitter data and do basic analysis. For instance, we will try to determine whether an earthquake has happened recently or whether there is a basketball game going on. <br />
<br />
Uncheck the sliders for "Will your app use Tweet, Retweet, like, follow, or Direct Message functionality?" and all other options.<br />
<br />
[[File:Capture20200126_1.PNG|400px]]<br />
<br />
[[File:Capture20200126_2.PNG|400px]]<br />
<br />
<br />
'''8''' Click "next" in the lower right then click "Looks good" on the review page. Finally, accept the terms of service and click "Submit Application" on the next page.<br />
<br />
<br />
'''9''' Twitter will send an email to the account you used. Click "Confirm your email" in that email to finish setup.<br />
<br />
<br />
<br />
'''If you have any trouble with the steps before this, email us before Saturday.''' If you have trouble on the next steps, we'll be able to help you on Saturday.<br />
<br />
<br />
'''10''' When you confirm in the email, you will arrive at https://developer.twitter.com/en/account/get-started. On that page, click "Create an app". This will take you to https://developer.twitter.com/en/apps<br />
<br />
'''11''' Click "Create an app", which takes you to https://developer.twitter.com/en/apps/create. You'll need to fill in a few details about your app.<br />
<br />
App name: "CDSW Sample <Your_First_and_Last_Name>"<br />
<br />
Application Description: "Sample application for the CDSW workshop."<br />
<br />
Website: "https://www.example.com"<br />
<br />
Callback URLs: "https://www.example.com"<br />
<br />
Leave "Enable Sign in with Twitter" unchecked.<br />
<br />
The next few fields are not needed, but scroll to the bottom to find "Tell us how this app will be used".<br />
<br />
Tell us how this app will be used: "Learning data science with python in the Community Data Science workshop. This app is for testing purposes only."<br />
<br />
Finally, click create, and click create again in the modal window.<br />
<br />
*Almost there!!* <br />
<br />
'''12''' In the next step, you will access Twitter credentials, which will let you authenticate with Twitter in python.<br />
<br />
You should be at a page that looks like:<br />
<br />
[[File:Capture20200126_2.PNG|400px]]<br />
<br />
Click the "Keys and Tokens" tab. You will see a box called "Consumer API keys" with two long strings labeled "API key" and "API secret key". You should copy and paste those into a text file on your desktop.<br />
<br />
Finally, click "Generate" which will open a modal with two new strings called "Access Token" and "Access Token Secret". Copy these two keys to the same file and close the modal.<br />
<br />
You will need all four of these strings in order to have your Twitter application work.<br />
<br />
''Keep this material secret.'' Your access token and access token secret will allow anybody who has it to post to Twitter as you and to control your account. It is equivalent to your Twitter username and password so please be as careful with it as you would be with your Twitter password!<br />
<br />
== Other documentation ==<br />
<br />
* [https://developer.twitter.com/en/docs/basics/getting-started Official documentation on how to get Tokens from developer.twitter.com]<br />
<br />
[[Category:CDSW]]</div>Ddaileyhttps://wiki.communitydata.science/index.php?title=Twitter_authentication_setup&diff=187505Twitter authentication setup2020-01-27T02:52:20Z<p>Ddailey: </p>
<hr />
<div>[[File:Twitter.png|right|200px]]<br />
<br />
Things you will need before you start:<br />
<br />
* '''A Twitter account.''' If your Twitter profile doesn't have your current mobile number associated with it, you will need to add your mobile number in order to create your new app as part of the process.<br />
<br />
Follow each of these steps:<br />
<br />
'''1.''' Go to the Twitter development homepage: https://developer.twitter.com/ <br />
<br />
'''2.''' If you're not already signed in to Twitter, click on '''Sign In''' in the top right corner of the page. You can sign in with your normal Twitter account. (It may take you to your Twitter home page when you sign in. If so, return to https://developer.twitter.com/ once you're logged on.) <br />
<br />
'''3.''' Click on the [https://developer.twitter.com/en/apply-for-access "Apply" link] (https://developer.twitter.com/en/apply-for-access). The link should be located in the top right of the page beside "Apps" and your Twitter icon.<br />
<br />
'''4''' Click "Apply for a Developer Account" in the middle of the page.<br />
<br />
'''5''' The next page asks "What is your primary reason for using Twitter developer tools?" and gives you a lot of options. ''Click Student'', which is in the third column. <br />
<br />
'''6''' On the next page, under "what would you like us to call you", put "CDSW_student".<br />
<br />
What you are signing up for is an Individual Developer Account (as opposed to Team Developer Account). <br />
<br />
[[File:Capture20200126.PNG|400px]]<br />
<br />
'''7''' Next, Twitter will ask you about your plans. ''Please follow these instructions carefully to make sure Twitter approves your application.''<br />
<br />
In the field "In your words":<br />
<br />
I am taking a Community Data Science course at the University of Washington. My instructors are Mako Hill (makohill@uw.com), Tommy Guy (guyrt@uw.ed), and Dharma Dailey (ddailey@uw.edu). You can find our workshop details at https://wiki.communitydata.science/Community_Data_Science_Workshops_(Winter_2020).<br />
<br />
Under "The Specifics" check yes for "Are you planning to analyze Twitter data" and enter the following text:<br />
<br />
We are learning to download Twitter data and do basic analysis. For instance, we will try to determine whether an earthquake has happened recently or whether there is a basketball game going on. <br />
<br />
Uncheck the sliders for "Will your app use Tweet, Retweet, like, follow, or Direct Message functionality?" and all other options.<br />
<br />
[[File:Capture20200126_1.PNG|400px]]<br />
<br />
[[File:Capture20200126_2.PNG|400px]]<br />
<br />
<br />
'''8''' Click "next" in the lower right then click "Looks good" on the review page. Finally, accept the terms of service and click "Submit Application" on the next page.<br />
<br />
<br />
'''9''' Twitter will send an email to the account you used. Click "Confirm your email" in that email to finish setup.<br />
<br />
<br />
<br />
'''If you have any trouble with the steps before this, email us before Saturday.''' If you have trouble on the next steps, we'll be able to help you on Saturday.<br />
<br />
<br />
'''10''' When you confirm in the email, you will arrive at https://developer.twitter.com/en/account/get-started. On that page, click "Create an app". This will take you to https://developer.twitter.com/en/apps<br />
<br />
'''11''' Click "Create an app", which takes you to https://developer.twitter.com/en/apps/create. You'll need to fill in a few details about your app.<br />
<br />
App name: "CDSW Sample"<br />
<br />
Application Description: "Sample application for the CDSW workshop."<br />
<br />
Website: "https://www.example.com"<br />
<br />
Callback URLs: "https://www.example.com"<br />
<br />
Leave "Enable Sign in with Twitter" unchecked.<br />
<br />
The next few fields are not needed, but scroll to the bottom to find "Tell us how this app will be used".<br />
<br />
Tell us how this app will be used: "Learning data science with python in the Community Data Science workshop. This app is for testing purposes only."<br />
<br />
Finally, click create, and click create again in the modal window.<br />
<br />
*Almost there!!* <br />
<br />
'''12''' In the next step, you will access Twitter credentials, which will let you authenticate with Twitter in python.<br />
<br />
You should be at a page that looks like:<br />
<br />
[[File:Capture20200126_2.PNG|400px]]<br />
<br />
Click the "Keys and Tokens" tab. You will see a box called "Consumer API keys" with two long strings labeled "API key" and "API secret key". You should copy and paste those into a text file on your desktop.<br />
<br />
Finally, click "Generate" which will open a modal with two new strings called "Access Token" and "Access Token Secret". Copy these two keys to the same file and close the modal.<br />
<br />
You will need all four of these strings in order to have your Twitter application work.<br />
<br />
''Keep this material secret.'' Your access token and access token secret will allow anybody who has it to post to Twitter as you and to control your account. It is equivalent to your Twitter username and password so please be as careful with it as you would be with your Twitter password!<br />
<br />
== Other documentation ==<br />
<br />
* [https://developer.twitter.com/en/docs/basics/getting-started Official documentation on how to get Tokens from developer.twitter.com]<br />
<br />
[[Category:CDSW]]</div>Ddaileyhttps://wiki.communitydata.science/index.php?title=Community_Data_Science_Workshops_(Winter_2020)&diff=186235Community Data Science Workshops (Winter 2020)2020-01-18T23:39:23Z<p>Ddailey: </p>
<hr />
<div><div style="float:right;"><br />
<div style="margin-left:20px; padding-left:1em; text-align: center;"><br />
{| class="infobox" style="width: 600px; background-color:#ADC2E4"<br />
| colspan="2" | '''<div class="plainlinks" style="font-weight:bold; font-size:1.5em; text-align: center;">Registration for Winter 2020 is now closed</div>''' <br />
<br />
<div class="plainlinks" style="margin-left:0em; text-align: center;"><br />
Unfortunately, registration closed on '''January 13'''.<br />
<br />
''Have experience to share? [https://docs.google.com/forms/d/1ycV3HsWV_zaMWzuSSxyI4-_ye1NltVFFUtTbX3O6q6M/viewform Sign up to be a mentor].'' ''If you would like to be notified of future workshops, subscribe to [https://communitydata.science/mailman3/postorius/lists/cdsw-announce.communitydata.science/ our announcement email list].''<br />
</div><br />
|}<br />
</div><br />
[[Image:Cdsw combo images-1.jpg|thumb|600px|[[Community Data Science Workshops/Photos|More photos from past workshops]].]]<br />
<div style="clear: both;"></div><br />
</div><br />
<br />
The '''Community Data Science Workshops in Winter 2020''' are a series of project-based workshops being held at the University of Washington for anyone interested in learning how to use programming and data science tools to ask and answer questions about online communities like [http://en.wikipedia.org/ Wikipedia], [http://twitter.com Twitter], [[:w:Free software|free and open source software, and]] civic media.<br />
<br />
The Winter 2020 workshop series will take place over three Saturdays (plus a short Friday night setup session):<br />
<br />
* Friday, January 17th (6-9pm)<br />
* Saturday, January 18th (9:45-4pm)<br />
* Saturday, February 1st (9:45-4pm)<br />
* Saturday, February 15th (9:45-4pm)<br />
<br />
'''These workshops are for people with absolutely no previous programming experience''' and they bring together researchers and academics with participants and leaders in online communities. The workshops are run entirely by volunteers and are entirely free of charge for participants, generously sponsored by the [http://www.com.washington.edu/ UW Department of Communication] and the [http://escience.washington.edu/ eScience Institute]. Participants from outside UW are encouraged to apply.<br />
<br />
Our goal is that, after the three workshops, participants will be able to use data to produce numbers, hypothesis tests, tables, and graphical visualizations to answer questions like:<br />
<br />
* Are new contributors in Wikipedia this year sticking around longer or contributing more than people who joined last year?<br />
* Who are the most active or influential users of a particular Twitter hashtag?<br />
* Are people who join through a Wikipedia outreach event staying involved? How do they compare to people who decide to join the project outside of the event?<br />
<br />
We've run these workshops five times in 2014, 2015, and 2016 and [[CDSW|the curriculum we used for previous sessions is all online]].<br />
<br />
== Registration ==<br />
<br />
'''''Participants!''''' Unfortunately, the registration period is over. Sorry about that! This is our sixth set of workshops and we do hope to run more of these again in the future. You can find out about future workshops by signing up for [https://communitydata.science/mailman3/postorius/lists/cdsw-announce.communitydata.science/ our announcement mailing list].<br />
<br />
'''''Interested in being a mentor?''''' If you already have experience with Python, please consider helping out at the sessions as a mentor. Being a mentor will involve working with participants and talking them through the challenges they encounter in programming. No special preparation is required. And we'll feed you! Because we want to keep a very high mentor-to-student ratio, recruiting more mentors means we can accept more participants. If you're interested you can [https://forms.gle/6ZxxH77z2m18mhgo6 fill out this form] or email makohill@uw.edu. Also, thank you, thank you, thank you! Here are some [[mentoring]] tips for being successful!<br />
<br />
== Schedule ==<br />
<br />
There will be a mandatory evening setup session '''6:00-9:00pm on Friday January 17''' and three workshops held from '''9:45am-4pm on three Saturdays (January 18 and February 1 and 15)'''. Each Saturday session will involve a period for lecture and technical demonstrations in the morning. This will be followed by a lunch graciously provided by the [http://escience.washington.edu/ eScience Institute at UW]. The rest of the day will be followed by group work on programming and data science projects supported by more experienced mentors.<br />
<br />
'''All sessions are interactive and involve you programming on your own and on your own laptop. Everybody attending should bring a laptop and a power cord so that they don't run out of battery.'''<br />
<br />
=== Session 0: Setup and Programming Tutorial (Friday January 17 evening)===<br />
<br />
Come to the '''[http://www.washington.edu/maps/#!/cmu Communications Building (CMU) 104]''' between 6:00 and 9:00pm. It's OK if you come a little late but you'll want to have as much time as you can to finish the setup and self-directed assignments so come as close to 6:00pm as you can. Most people will finish early but some people will definitely need the full 3 hours. It's hard to know in advance where problems will crop up so please come on time even if you are confident.<br />
<br />
:'''Time''': 6-9pm<br />
:'''Location''': '''[http://www.washington.edu/maps/#!/cmu Communications Building (CMU) 104]'''<br />
: '''Objectives''': During this session, mentors will help you:<br />
<br />
:: set up your development environment<br />
:: learn how to write and execute Python code in a Jupyter Notebook<br />
:: learn about printing and using Python as a calculator<br />
<br />
:'''Material''': <font size="+1">[[CDSW/Day 0 setup and tutorial|Click here for the the setup and tutorial material.]]</font><br />
<br />
'''Note''': Because we expect to hit the ground running on our first full day, we will meet to help participants get software installed and to work through a self-guided tutorial that will help ensure that everyone has the skills and vocabulary to start programming and learning when we meet the following morning.<br />
<br />
=== Session 1: Introduction to Programming (January 18) ===<br />
<br />
Come to '''[http://uw.edu/maps/?sav Savery Hall (SAV) 260] by 9:45am'''.<br />
Plan to be on UW campus by 9:45am. You will need time to get settled and setup. We will start lecturing promptly at 10am. There will be coffee!<br />
<br />
: '''Time:''' 9:45am-4pm<br />
: '''Location:''' [http://uw.edu/maps/?sav Savery Hall (SAV)]<br />
<br />
: '''Schedule'''<br />
:: '''Morning, 10am-12:20 (SAV 260)''': [[CDSW/Day_1_lecture|A 2.5 hour lecture-based introduction to the Python programming language]]<br />
:: '''Lunch, 12:20-1pm (Savery Hall in the downstairs hallway)''': We'll provide lunch (pizza!)<br />
:: '''Afternoon, 1pm-3:30pm (SAV 130, 137, 138, 156):''' Python practice through short projects (see below) on a variety of fun and practical topics:<br />
::* [[Baby_Names | Baby Names]]<br />
::* [[Learnpython.org exercises]]<br />
:: '''Wrap-up, 3:30pm-4pm (SAV 260):''' Wrap-up, next steps, and upcoming opportunities for learning and practicing Python<br />
<br />
: '''Objectives''': Programming is an essential tool for data science and is useful for solving many other problems. The goal of this session will be to introduce programming in the [http://www.python.org/ Python programming language]. Each participant will leave having solved a real problem and will have built their first real programming project.<br />
<br />
=== Session 2: Importing Data from web APIs (February 1) ===<br />
Come to '''[http://uw.edu/maps/?sav Savery Hall (SAV) 260] by 9:45am'''. You will need time to get settled and setup. We will start lecturing promptly at 10am. There will be coffee!<br />
<br />
: '''Time''': 9:45am-4pm<br />
<br />
: '''Location''': [http://uw.edu/maps/?sav Savery Hall (SAV)] <br />
<br />
: '''Schedule''':<br />
:: '''Morning: 10am-12:20 (SAV 260)''': [[CDSW/Day_2_Lecture|A 2.5 hour lecture-based introduction to the web programming and APIs]]<br />
:: '''Lunch: 12:20-1pm (Savery Hall downstairs hallway)''': We'll provide lunch (TBD)<br />
:: '''Afternoon: 1pm-3:30pm (SAV 130, 137, 138, 156)''': Web API practice through short projects (see below) on a variety of fun and practical topics:<br />
::* [[Community_Data_Science_Workshops_(Spring_2016)/Day_2_Projects/Twitter|Twitter]]<br />
::* [[Wikipedia (CDSW)|Wikipedia]]<br />
::* [[Yelp (CDSW)|Yelp]]<br />
:: '''Wrap-up: 3:30pm-4pm''': Wrap-up, next steps, and upcoming opportunities for learning and practicing Python<br />
<br />
: '''Objectives''': An important step in doing data science is collecting data. The goal of this session will be to teach participants how to get data from the [https://en.wikipedia.org/wiki/Application_programming_interface public application programming interfaces] ("APIs") common to many social media and online communities. Although we will use the APIs provided by Wikipedia, Twitter, and Socrata in the session, the principles and techniques are common to many other online communities.<br />
<br />
: An outline for the lecture can be found [[CDSW/Day_2_lecture|here]] and a list of potential projects for the afternoon session are listed below:<br />
<br />
'''Important Note:''' If you plan to attend the Twitter afternoon session, you need to complete the [[Twitter authentication setup]] ''before'' the afternoon setup on Saturday. If you plan to complete the Yelp session, you need to complete the [[Yelp authentication setup]] instructions. There's no promise that we will be running these sessions this weekend unless there is demand but you will need to have done these if you want to attend the session.<br />
<br />
=== Session 3: Data Analysis and Visualization (February 15) ===<br />
Come to '''[http://uw.edu/maps/?sav Savery Hall (SAV) 260] by 9:45am'''. You will need time to get settled and setup. We will start lecturing promptly at 10am. There will be coffee!<br />
<br />
: '''Time''': 9:45am-4pm<br />
<br />
: '''Location:''' [http://uw.edu/maps/?sav Savery Hall (SAV) 260]<br />
<br />
: '''Schedule''':<br />
<br />
:: '''Morning, 10am-12:20 (SAV 260):''' [[CDSW/Day_3_Lecture|2.5 hour interactive lecture]]<br />
:: '''Lunch, 12:20-1pm (TBD):''' We'll provide lunch (TBD)<br />
:: '''Afternoon, 1pm-3:30pm (SAV 130, 137, 138, 156): '''Web API practice through independent projects<br />
::* [[Harry Potter on Wikipedia|Visualization and analysis using Spreadsheets]]<br />
::* [[Matplotlib|Visualization using Python and Matplotlib]]<br />
::* [[Community_Data_Science_Workshops_(Spring_2016)/Day_3_Projects/Twitter|Analyzing data from Twitter]]<br />
::* [[Community_Data_Science_Workshops_(Spring_2016)/Day_3_Projects|Visualization and analysis of civic data from data.seattle.gov]]<br />
::* Independent projects working on issues of ''your'' choosing!<br />
:: '''Wrap-up, 3:30-4pm<br />
<br />
: '''Objectives''': The goal of data science is to use data to answer questions. In our final session, we will use the Python skills we learned in the first session and the datasets we've created in the second to ask and answer common questions about the activity and health of online communities. We will focus on learning how to generate visualizations, create summary statistics, and test hypotheses.<br />
<br />
== Venue and Logistics ==<br />
<br />
=== What to bring ===<br />
# a '''laptop'''<br />
#* for '''Session 0''' make sure that you have about 1GB of space free so you can install Python and all the necessary other software<br />
#* for '''Sessions 1-3''' bring your laptop with Python set up<br />
# a '''power cord'''<br />
# a '''sense of adventure!'''<br />
<br />
=== Location ===<br />
[[File:Ulink-to-savery-hall.png|250px|thumb|right|15 mins from the UW Station to Savery Hall|link=https://tinyurl.com/hr3efyg]]<br />
<br />
For the first Friday setup session, please come to the '''Communications building''' [https://www.openstreetmap.org/export#map=18/47.65669/-122.30538 map]. The direction from the UW Link station is [https://tinyurl.com/jyrskxu here].<br />
<br />
For all the Saturday sessions, please meet at '''Savery Hall 260''' ([http://www.openstreetmap.org/export#map=17/47.65715/-122.30750 map]) on the '''the three Saturday mornings at 9:45'''. Unfortunately, most of the doors to Savery Hall are locked on weekends. The door on the '''west side of the building''' (i.e., the one nearest Kane Hall) should be open. <br />
<br />
'''[http://www.soundtransit.org/Rider-Guide/University-of-Washington-Station The UW Station] on Link is now open''' and Savery Hall is an easy walk on campus from the station. UW is also well served by buses and easily accessible by bicycle with the [https://en.wikipedia.org/wiki/Burke_Gilman_Trail Burke Gilman Trail]. Parking at UW is available but is not free. There is [https://www.washington.edu/facilities/transportation/commuterservices/parking/selfserve self-serve parking] as well as gatehouses that are staffed from 7am on Saturday and can issue you parking passes and point you to an appropriate lot. More details are on the [https://www.washington.edu/facilities/transportation/commuterservices/parking/daily UW Commuter Services website for Visitors and Guests].<br />
<br />
=== Food ===<br />
<br />
Thanks to generous sponsorship by the [http://escience.washington.edu/ eScience Institute at UW], we will provide catered lunches during the Saturday sessions. Although we haven't figured out the menu, the food will all be vegetarian and there will be vegan and gluten free options. If the food we have doesn't doesn't work for you, there is a food court open for lunch in [http://depts.washington.edu/thehub/ the HUB] (the UW student center) that is almost directly next door.<br />
<br />
=== Social Media ===<br />
<br />
* We use the hashtag [http://twitter.com/#!/search?q=%23cdsw #cdsw]<br />
<br />
<br />
=== Contact information ===<br />
<br />
If you have any questions about the events, you can contact [mailto:makohill@uw.edu makohill@uw.edu].<br />
<br />
== About the Organizers ==<br />
<br />
The workshops are being coordinated, organized by [http://mako.cc/academic/ Benjamin Mako Hill], [http://jtmorgan.net/ Jonathan Morgan],[http://dharmadailey.info/ Dharma Dailey], Mika Matsuzaki, [https://guyrt.github.io/ Tommy Guy], Ben Lewis, Emilia Gan, and a long list of other volunteer mentors. The workshops have been designed with lots of help and inspiration from Shauna Gordon-McKeon and Asheesh Laroia of OpenHatch and lots of inspiration from the [http://bostonpythonworkshop.com/ Boston Python Workshop].<br />
<br />
These workshops are an all-volunteer effort. Fundamentally, we're doing this because we're programmers and data scientists who work in online communities and we really believe that the skills you'll learn in these sessions are important and empowering tools.<br />
<br />
<!--<br />
The workshops are being supported by the [http://www.com.washington.edu/ UW Department of Communication] and the [http://escience.washington.edu/ eScience Institute].<br />
--><br />
<br />
If you have any questions or concerns, please contact Benjamin Mako Hill at makohill@uw.edu.<br />
<br />
[[File:Dept.Comm_UW_vertical_small_square.jpg|180px]]<br />
[[File:EScience Logo RGB.png|250px]]<br />
<br />
<br />
[[Category:Winter 2020 series]]</div>Ddaileyhttps://wiki.communitydata.science/index.php?title=Community_Data_Science_Workshops_(Winter_2020)&diff=186234Community Data Science Workshops (Winter 2020)2020-01-18T23:38:58Z<p>Ddailey: </p>
<hr />
<div><div style="float:right;"><br />
<div style="margin-left:20px; padding-left:1em; text-align: center;"><br />
{| class="infobox" style="width: 600px; background-color:#ADC2E4"<br />
| colspan="2" | '''<div class="plainlinks" style="font-weight:bold; font-size:1.5em; text-align: center;">Registration for Winter 2020 is now closed</div>''' <br />
<br />
<div class="plainlinks" style="margin-left:0em; text-align: center;"><br />
Unfortunately, registration closed on '''January 13'''.<br />
<br />
''Have experience to share? [https://docs.google.com/forms/d/1ycV3HsWV_zaMWzuSSxyI4-_ye1NltVFFUtTbX3O6q6M/viewform Sign up to be a mentor].'' ''If you would like to be notified of future workshops, subscribe to [https://communitydata.science/mailman3/postorius/lists/cdsw-announce.communitydata.science/ our announcement email list].''<br />
</div><br />
|}<br />
</div><br />
[[Image:Cdsw combo images-1.jpg|thumb|600px|[[Community Data Science Workshops/Photos|More photos from past workshops]].]]<br />
<div style="clear: both;"></div><br />
</div><br />
<br />
The '''Community Data Science Workshops in Winter 2020''' are a series of project-based workshops being held at the University of Washington for anyone interested in learning how to use programming and data science tools to ask and answer questions about online communities like [http://en.wikipedia.org/ Wikipedia], [http://twitter.com Twitter], [[:w:Free software|free and open source software, and]] civic media.<br />
<br />
The Winter 2020 workshop series will take place over three Saturdays (plus a short Friday night setup session):<br />
<br />
* Friday, January 17th (6-9pm)<br />
* Saturday, January 18th (9:45-4pm)<br />
* Saturday, February 1st (9:45-4pm)<br />
* Saturday, February 15th (9:45-4pm)<br />
<br />
'''These workshops are for people with absolutely no previous programming experience''' and they bring together researchers and academics with participants and leaders in online communities. The workshops are run entirely by volunteers and are entirely free of charge for participants, generously sponsored by the [http://www.com.washington.edu/ UW Department of Communication] and the [http://escience.washington.edu/ eScience Institute]. Participants from outside UW are encouraged to apply.<br />
<br />
Our goal is that, after the three workshops, participants will be able to use data to produce numbers, hypothesis tests, tables, and graphical visualizations to answer questions like:<br />
<br />
* Are new contributors in Wikipedia this year sticking around longer or contributing more than people who joined last year?<br />
* Who are the most active or influential users of a particular Twitter hashtag?<br />
* Are people who join through a Wikipedia outreach event staying involved? How do they compare to people who decide to join the project outside of the event?<br />
<br />
We've run these workshops five times in 2014, 2015, and 2016 and [[CDSW|the curriculum we used for previous sessions is all online]].<br />
<br />
== Registration ==<br />
<br />
'''''Participants!''''' Unfortunately, the registration period is over. Sorry about that! This is our sixth set of workshops and we do hope to run more of these again in the future. You can find out about future workshops by signing up for [https://communitydata.science/mailman3/postorius/lists/cdsw-announce.communitydata.science/ our announcement mailing list].<br />
<br />
'''''Interested in being a mentor?''''' If you already have experience with Python, please consider helping out at the sessions as a mentor. Being a mentor will involve working with participants and talking them through the challenges they encounter in programming. No special preparation is required. And we'll feed you! Because we want to keep a very high mentor-to-student ratio, recruiting more mentors means we can accept more participants. If you're interested you can [https://forms.gle/6ZxxH77z2m18mhgo6 fill out this form] or email makohill@uw.edu. Also, thank you, thank you, thank you! Here are some [[mentoring]] tips for being successful!<br />
<br />
== Schedule ==<br />
<br />
There will be a mandatory evening setup session '''6:00-9:00pm on Friday January 17''' and three workshops held from '''9:45am-4pm on three Saturdays (January 18 and February 1 and 15)'''. Each Saturday session will involve a period for lecture and technical demonstrations in the morning. This will be followed by a lunch graciously provided by the [http://escience.washington.edu/ eScience Institute at UW]. The rest of the day will be followed by group work on programming and data science projects supported by more experienced mentors.<br />
<br />
'''All sessions are interactive and involve you programming on your own and on your own laptop. Everybody attending should bring a laptop and a power cord so that they don't run out of battery.'''<br />
<br />
=== Session 0: Setup and Programming Tutorial (Friday January 17 evening)===<br />
<br />
Come to the '''[http://www.washington.edu/maps/#!/cmu Communications Building (CMU) 104]''' between 6:00 and 9:00pm. It's OK if you come a little late but you'll want to have as much time as you can to finish the setup and self-directed assignments so come as close to 6:00pm as you can. Most people will finish early but some people will definitely need the full 3 hours. It's hard to know in advance where problems will crop up so please come on time even if you are confident.<br />
<br />
:'''Time''': 6-9pm<br />
:'''Location''': '''[http://www.washington.edu/maps/#!/cmu Communications Building (CMU) 104]'''<br />
: '''Objectives''': During this session, mentors will help you:<br />
<br />
:: set up your development environment<br />
:: learn how to write and execute Python code in a Jupyter Notebook<br />
:: learn about printing and using Python as a calculator<br />
<br />
:'''Material''': <font size="+1">[[CDSW/Day 0 setup and tutorial|Click here for the the setup and tutorial material.]]</font><br />
<br />
'''Note''': Because we expect to hit the ground running on our first full day, we will meet to help participants get software installed and to work through a self-guided tutorial that will help ensure that everyone has the skills and vocabulary to start programming and learning when we meet the following morning.<br />
<br />
=== Session 1: Introduction to Programming (January 18) ===<br />
<br />
Come to '''[http://uw.edu/maps/?sav Savery Hall (SAV) 260] by 9:45am'''.<br />
Plan to be on UW campus by 9:45am. You will need time to get settled and setup. We will start lecturing promptly at 10am. There will be coffee!<br />
<br />
: '''Time:''' 9:45am-4pm<br />
: '''Location:''' [http://uw.edu/maps/?sav Savery Hall (SAV)]<br />
<br />
: '''Schedule'''<br />
:: '''Morning, 10am-12:20 (SAV 260)''': [[CDSW/Day_1_lecture|A 2.5 hour lecture-based introduction to the Python programming language]]<br />
:: '''Lunch, 12:20-1pm (Savery Hall in the downstairs hallway)''': We'll provide lunch (pizza!)<br />
:: '''Afternoon, 1pm-3:30pm (SAV 130, 137, 138, 156):''' Python practice through short projects (see below) on a variety of fun and practical topics:<br />
::* [[Baby_Names | Baby Names]]<br />
::* [[Learnpython.org exercises]]<br />
:: '''Wrap-up, 3:30pm-4pm (SAV 260):''' Wrap-up, next steps, and upcoming opportunities for learning and practicing Python<br />
<br />
: '''Objectives''': Programming is an essential tool for data science and is useful for solving many other problems. The goal of this session will be to introduce programming in the [http://www.python.org/ Python programming language]. Each participant will leave having solved a real problem and will have built their first real programming project.<br />
<br />
=== Session 2: Importing Data from web APIs (February 1) ===<br />
Come to '''[http://uw.edu/maps/?sav Savery Hall (SAV) 260] by 9:45am'''. You will need time to get settled and setup. We will start lecturing promptly at 10am. There will be coffee!<br />
<br />
: '''Time''': 9:45am-4pm<br />
<br />
: '''Location''': [http://uw.edu/maps/?sav Savery Hall (SAV)] <br />
<br />
: '''Schedule''':<br />
:: '''Morning: 10am-12:20 (SAV 260)''': [[CDSW/Day_2_Lecture|A 2.5 hour lecture-based introduction to the web programming and APIs]]<br />
:: '''Lunch: 12:20-1pm (Savery Hall downstairs hallway)''': We'll provide lunch (TBD)<br />
:: '''Afternoon: 1pm-3:30pm (SAV 130, 137, 138, 156)''': Web API practice through short projects (see below) on a variety of fun and practical topics:<br />
::* [[Community_Data_Science_Workshops_(Spring_2016)/Day_2_Projects/Twitter|Twitter]]<br />
::* [[Wikipedia (CDSW)|Wikipedia]]<br />
::* [[Yelp (CDSW)|Yelp]]<br />
:: '''Wrap-up: 3:30pm-4pm''': Wrap-up, next steps, and upcoming opportunities for learning and practicing Python<br />
<br />
: '''Objectives''': An important step in doing data science is collecting data. The goal of this session will be to teach participants how to get data from the [https://en.wikipedia.org/wiki/Application_programming_interface public application programming interfaces] ("APIs") common to many social media and online communities. Although we will use the APIs provided by Wikipedia, Twitter, and Socrata in the session, the principles and techniques are common to many other online communities.<br />
<br />
: An outline for the lecture can be found [[CDSW/Day_2_lecture|here]] and a list of potential projects for the afternoon session are listed below:<br />
<br />
'''Important Note:''' If you plan to attend the Twitter afternoon session, you need to complete the [[Twitter authentication setup]] ''before'' the afternoon setup on Saturday. If you plan to complete the Yelp session, you need to complete the [[Yelp authentication setup]] instructions. There's no promise that we will be running these sessions this weekend unless there is demand but you will need to have done these if you want to attend the session.<br />
<br />
=== Session 3: Data Analysis and Visualization (Feb 15) ===<br />
Come to '''[http://uw.edu/maps/?sav Savery Hall (SAV) 260] by 9:45am'''. You will need time to get settled and setup. We will start lecturing promptly at 10am. There will be coffee!<br />
<br />
: '''Time''': 9:45am-4pm<br />
<br />
: '''Location:''' [http://uw.edu/maps/?sav Savery Hall (SAV) 260]<br />
<br />
: '''Schedule''':<br />
<br />
:: '''Morning, 10am-12:20 (SAV 260):''' [[CDSW/Day_3_Lecture|2.5 hour interactive lecture]]<br />
:: '''Lunch, 12:20-1pm (TBD):''' We'll provide lunch (TBD)<br />
:: '''Afternoon, 1pm-3:30pm (SAV 130, 137, 138, 156): '''Web API practice through independent projects<br />
::* [[Harry Potter on Wikipedia|Visualization and analysis using Spreadsheets]]<br />
::* [[Matplotlib|Visualization using Python and Matplotlib]]<br />
::* [[Community_Data_Science_Workshops_(Spring_2016)/Day_3_Projects/Twitter|Analyzing data from Twitter]]<br />
::* [[Community_Data_Science_Workshops_(Spring_2016)/Day_3_Projects|Visualization and analysis of civic data from data.seattle.gov]]<br />
::* Independent projects working on issues of ''your'' choosing!<br />
:: '''Wrap-up, 3:30-4pm<br />
<br />
: '''Objectives''': The goal of data science is to use data to answer questions. In our final session, we will use the Python skills we learned in the first session and the datasets we've created in the second to ask and answer common questions about the activity and health of online communities. We will focus on learning how to generate visualizations, create summary statistics, and test hypotheses.<br />
<br />
== Venue and Logistics ==<br />
<br />
=== What to bring ===<br />
# a '''laptop'''<br />
#* for '''Session 0''' make sure that you have about 1GB of space free so you can install Python and all the necessary other software<br />
#* for '''Sessions 1-3''' bring your laptop with Python set up<br />
# a '''power cord'''<br />
# a '''sense of adventure!'''<br />
<br />
=== Location ===<br />
[[File:Ulink-to-savery-hall.png|250px|thumb|right|15 mins from the UW Station to Savery Hall|link=https://tinyurl.com/hr3efyg]]<br />
<br />
For the first Friday setup session, please come to the '''Communications building''' [https://www.openstreetmap.org/export#map=18/47.65669/-122.30538 map]. The direction from the UW Link station is [https://tinyurl.com/jyrskxu here].<br />
<br />
For all the Saturday sessions, please meet at '''Savery Hall 260''' ([http://www.openstreetmap.org/export#map=17/47.65715/-122.30750 map]) on the '''the three Saturday mornings at 9:45'''. Unfortunately, most of the doors to Savery Hall are locked on weekends. The door on the '''west side of the building''' (i.e., the one nearest Kane Hall) should be open. <br />
<br />
'''[http://www.soundtransit.org/Rider-Guide/University-of-Washington-Station The UW Station] on Link is now open''' and Savery Hall is an easy walk on campus from the station. UW is also well served by buses and easily accessible by bicycle with the [https://en.wikipedia.org/wiki/Burke_Gilman_Trail Burke Gilman Trail]. Parking at UW is available but is not free. There is [https://www.washington.edu/facilities/transportation/commuterservices/parking/selfserve self-serve parking] as well as gatehouses that are staffed from 7am on Saturday and can issue you parking passes and point you to an appropriate lot. More details are on the [https://www.washington.edu/facilities/transportation/commuterservices/parking/daily UW Commuter Services website for Visitors and Guests].<br />
<br />
=== Food ===<br />
<br />
Thanks to generous sponsorship by the [http://escience.washington.edu/ eScience Institute at UW], we will provide catered lunches during the Saturday sessions. Although we haven't figured out the menu, the food will all be vegetarian and there will be vegan and gluten free options. If the food we have doesn't doesn't work for you, there is a food court open for lunch in [http://depts.washington.edu/thehub/ the HUB] (the UW student center) that is almost directly next door.<br />
<br />
=== Social Media ===<br />
<br />
* We use the hashtag [http://twitter.com/#!/search?q=%23cdsw #cdsw]<br />
<br />
<br />
=== Contact information ===<br />
<br />
If you have any questions about the events, you can contact [mailto:makohill@uw.edu makohill@uw.edu].<br />
<br />
== About the Organizers ==<br />
<br />
The workshops are being coordinated, organized by [http://mako.cc/academic/ Benjamin Mako Hill], [http://jtmorgan.net/ Jonathan Morgan],[http://dharmadailey.info/ Dharma Dailey], Mika Matsuzaki, [https://guyrt.github.io/ Tommy Guy], Ben Lewis, Emilia Gan, and a long list of other volunteer mentors. The workshops have been designed with lots of help and inspiration from Shauna Gordon-McKeon and Asheesh Laroia of OpenHatch and lots of inspiration from the [http://bostonpythonworkshop.com/ Boston Python Workshop].<br />
<br />
These workshops are an all-volunteer effort. Fundamentally, we're doing this because we're programmers and data scientists who work in online communities and we really believe that the skills you'll learn in these sessions are important and empowering tools.<br />
<br />
<!--<br />
The workshops are being supported by the [http://www.com.washington.edu/ UW Department of Communication] and the [http://escience.washington.edu/ eScience Institute].<br />
--><br />
<br />
If you have any questions or concerns, please contact Benjamin Mako Hill at makohill@uw.edu.<br />
<br />
[[File:Dept.Comm_UW_vertical_small_square.jpg|180px]]<br />
[[File:EScience Logo RGB.png|250px]]<br />
<br />
<br />
[[Category:Winter 2020 series]]</div>Ddaileyhttps://wiki.communitydata.science/index.php?title=Community_Data_Science_Workshops_(Core)/Day_0_Setup_and_tutorial&diff=185976Community Data Science Workshops (Core)/Day 0 Setup and tutorial2020-01-18T03:15:23Z<p>Ddailey: </p>
<hr />
<div>Welcome to the first Friday evening setup session for the [[Community_Data_Science_Workshops |Community Data Science Workshop Winter 2020]]!<br />
<br />
When you get to UW and get setup, please do the following things:<br />
<br />
* Start your laptop and get on the wireless network.<br />
* Work through the goals on this page in order. It should take between 2 and 3 hours. Lots of mentors will be around to help troubleshoot and to answer questions — don't hesitate to ask!<br />
* When you've finished all of the setup goals, raise your hand and a mentor will come over and go through a checklist with you to make sure you're all set for tomorrow.<br />
<br />
'''Please be sure to do the checkoff before you leave''' — it'll make sure that you are in good shape for tomorrow.<br />
<br />
== Goal #0: Connect to the UW Wireless ==<br />
<br />
If you already have a UW NetID of your own, you should be all set with the network.<br />
<br />
If you are not from UW, you will have to use a temporary shared NetID which we have created for the conference and which we will have written on the whiteboards/blackboard in each rooms. We'll write the username and password up on whiteboard in each of the rooms we are using. Also, make sure you agree with the [http://uw.edu/itconnect/work/appropriate-use/ UW's policy on the ethical use of computers and networks].<br />
<br />
== Goal #1: Set up Python and make a folder for CDSW files ==<br />
<br />
(Estimated time: 5 minutes...if it takes more than 10 minutes, check in with a mentor to see if it's still installing properly)<br />
<br />
First things first: We need to install an environment for working with the Python programming language. Please complete the instructions below for your operating system:<br />
<br />
* [[Windows set up Python (Anaconda)|Windows]] <br />
* [[OSX set up Python (Anaconda)|OS X]]<br />
<br />
'''Note:''' If you are running GNU/Linux or another operating system, please contact a mentor for help!<br />
<br />
* Go ahead and make a folder to use for your CDSW files. A dedicated folder will help you keep track of all the items you download or write as part of the workshop, and make them easier to find later. One of the secrets of data science is being kind to your future self by being extremely organized.<br />
<br />
== Goal #2: Practice running Python code from an existing Jupyter notebook ==<br />
<br />
(Estimated time: 5 minutes)<br />
<br />
We're going to use Jupyter notebooks to write and run Python throughout the workshop. By installing Anaconda, you can now use your computer's web browser to write and run python code files on your computer. Jupyter notebooks can mix together text and code. You can make changes and immediately see what happens. In this section of the setup process, we'll try out your Python setup by running code in an existing notebook.<br />
<div style="font-size:125%">[[Python in Jupyter | &raquo; Click here to get started with Python in Jupyter &laquo;]]</div><br />
<br />
== Goal #3: Download the Saturday projects ==<br />
<br />
(Estimated time: 10 minutes)<br />
<br />
In advance of tomorrow's lecture and afternoon projects, please download the necessary files.<br />
<br />
<font size="+1">[[CDSW/Day_1_baby_names_project_download|&raquo; Click here and follow the instructions to download the Baby Names project. &laquo;]]</font><br />
<br />
== Goal #4: Start learning Python! ==<br />
<br />
(Estimated time: 60 - 90 minutes)<br />
<br />
It's time to start learning, reading, and writing some Python! Tonight, you'll work through a self-directed tutorial. Saturday morning, we'll have an interactive lecture to cover more Python basics.<br />
<br />
<div style="font-size:125%">[[CDSW/Day_0_tutorial| &raquo; Click here and work through tonight's tutorial &laquo;]]</div><br />
<br /><br />
<br />
== Goal #5: Practice Python using LearnPython ==<br />
<br />
(Estimated time: 30 - 60 minutes)<br />
<br />
It's time to use what we've learned in the tutorial and get some practice thinking about and solving problems in Python.<br />
<br />
<div style="font-size:125%">[https://learnpython.org/ &raquo; Click here and complete the first two lessons on Learnpython &laquo;]</div><br />
<br />
Your next task is to work through '''the first two lessons''' (there are ''many'' lessons, so don't just keep hit "Next" or you're never finish!):<br />
<br />
* [https://www.learnpython.org/en/Hello%2C_World%21 Hello, World]<br />
* [https://www.learnpython.org/en/Variables_and_Types Variables and Types]<br />
<br />
<!-- If you feel adventurous, go ahead and learn about lists -- they'll be really useful later! --><br />
<br />
You may find the LearnPython interface is different from your Jupyter Notebook. No worries, it's still Python, even though it looks a bit different. You could do these lessons in Jupyter Notebook by copying & pasting the code in the left-hand boxes from LearnPython into Jupyter Notebook cells and run them from Jupyter.<br />
<br />
== Goal #6: Checkoff ==<br />
<br />
Wave down a mentor when you're ready to check out for the evening. Together you will go through the following check-off steps:<br />
<br />
* Show off your dedicated folder of CDSW files.<br />
* Start Jupyter and make sure the home page loads.<br />
* Navigate to the desktop (in Jupyter!) and create a new Jupyter notebook.<br />
* In that notebook, type: <code>print("Hello World")</code> and then Shift-Enter to run the command.<br />
* To test the baby names project installation: navigate to the babynames directory, load the notebook called "BabyNames.ipynb" and run the first cell. If you get no output, then you have done it correctly!<br />
* Walk through the LearnPython exercise that you had the most difficulty with.<br />
* Exit out of Jupyter (by ending the processes via Control + C in Terminal)<br />
* Tell your mentor if there any topics you'd like to learn more about or projects you have in mind. We're going to compare notes after this setup session and would find this information helpful.<br />
<br />
If you have any other questions about the tutorial, project setup, or learnpython, now is a great time to ask!<br />
<br />
==Congratulations!==<br />
<br />
You are done with the Friday portion of this Workshop. We'll see you at '''9:45am''' tomorrow.<br />
<br />
'''DO NOT BE LATE''': you don't want to miss the beginning of the interactive lecture!<br />
<br />
If you have any questions, comments, or feedback on tonight's material, don't hesitate to let a mentor know.<br />
<br />
[[File:Champagne.png|100px]][[File:Party.png|125px]]<br />
<br />
[[Category:Shared_Pages]]<br />
[[Category:CDSW]]</div>Ddaileyhttps://wiki.communitydata.science/index.php?title=Python_in_Jupyter&diff=185945Python in Jupyter2020-01-18T01:38:22Z<p>Ddailey: </p>
<hr />
<div>We are going to practice writing and running Python programs (often called "scripts").<br />
<br />
=== Download a Jupyter Notebook === <br />
<br />
Save the file CDSW_Jupyter_test_notebook.ipynb from the following link to your desktop: [https://communitydata.science/~groceryheist/CDSW_Jupyter_test_notebook.ipynb CDSW Jupter test notebook] <br />
(To save, (on Windows) right click the link and choose "save link as..." On a Mac, Option + click will do the same). <br />
Save it as a .ipynb file (rename it if you forget).<br />
Make sure you save it on the CDSW folder you've created on your desktop. (Or drag it into that folder).<br />
<br />
<br />
=== Open the Notebook in Jupyter Web Browser === <br />
<br />
Start Jupyter as you were instructed to in a previous step. <br />
In the Jupyter tab in your browser, navigate to your desktop in the list of folders and click on <code>CDSW_Jupyter_test_notebook.ipynb</code>.<br />
<br />
<br />
=== Test the notebook ===<br />
<br />
Following the instructions in the notebook, run the cell (by clicking the "run" button in the tool bar or press "ENTER + SHIFT") that says:<br />
print("hello world")<br />
<br />
You should see "hello world" output right below. If that works you have a working setup for Python and Jupyter. If that doesn't work, you should ask for assistance!<br />
<br />
Feel free to play around in the notebook. Try it out and explore!<br />
<br />
P.S. Feel free to try out Python commands in this notebook. It's for you to play with!<br />
<br />
<br />
=== Success! You have a working Python and Jupyter setup! ===<br />
<br />
[[File:Champagne.png|100px]][[File:Party.png|125px]]<br />
[[Category:CDSW]][[Category:Shared Pages]]</div>Ddaileyhttps://wiki.communitydata.science/index.php?title=Community_Data_Science_Workshops_(Core)/Day_0_Tutorial&diff=185748Community Data Science Workshops (Core)/Day 0 Tutorial2020-01-17T00:09:21Z<p>Ddailey: </p>
<hr />
<div>Welcome to the Friday tutorial!<br />
<br />
This tutorial covers several core programming concepts that we'll build upon during an interactive lecture tomorrow morning. It will take 1-2 hours to complete. There's a break in the middle, and exercises at the middle and end to help review the material.<br />
<br />
To get started, fire up a new Jupyter notebook. Name it as you like. <br />
<br />
This is an interactive tutorial! As you go through this tutorial, any time you see something that looks like this:<br />
<br />
<syntaxhighlight lang="python"><br />
a = "Hello"<br />
</syntaxhighlight><br />
<br />
you should type the expression in a cell of your Jupyter notebook, then hold Shift and hit Return (or Enter) after every line and check the output, making sure it matches your expectations.<br />
<br />
No copying and pasting! You'll learn the concepts better if you type them out yourself.<br />
<br />
==Math== <br />
<br />
[[File:Calculator.png|100px]]<br />
<br />
Math in Python looks a lot like math you type into a calculator. A Jupyter notebook makes a great calculator if you need to crunch some numbers and don't have a good calculator handy.<br />
<br />
===Addition===<br />
<br />
<syntaxhighlight lang="python"><br />
2 + 2<br />
1.5 + 2.25<br />
</syntaxhighlight><br />
===Subtraction===<br />
<syntaxhighlight lang="python"><br />
4 - 2<br />
100 - .5<br />
0 - 2<br />
</syntaxhighlight><br />
===Multiplication===<br />
<syntaxhighlight lang="python"><br />
2 * 3<br />
</syntaxhighlight><br />
===Division===<br />
<br />
First, lets try some basic fractions:<br />
<br />
<syntaxhighlight lang="python"><br />
1 / 2<br />
</syntaxhighlight><br />
<br />
Sure enough, Python says that the answer is 0.5 which is the same as 1/2.<br />
<br />
Let's try the same thing:<br />
<br />
<syntaxhighlight lang="python"><br />
4 / 2<br />
</syntaxhighlight><br />
<br />
Hey now! That last result is a little strange. When you divide a number in Python, even if the answer doesn't need a decimal place (like <code>4/2</code> which equals 2), you get an answer with a decimal point!<br />
<br />
What's going on here is that in Python, division produces an what's called a <code>float</code> which essentially means a number with a decimal point.<br />
<br />
When the Python interpreter goes to do the division, it knows that (unlike multiplication for example) division can lead to numbers that aren't whole numbers (like <code>1/2</code>) so it makes sure that the result will always include a decimal place just in case it's needed.<br />
<br />
<br />
This shouldn't be important for this workshop but it might be worth knowing that older versions of Python (before version 3) would always round down and return integers instead of giving numbers with decimal places.<br />
<br />
==Types==<br />
<br />
[[File:Geometry.png|150px]]<br />
<br />
There's a helpful '''function''' (more on what a function is in a second) called <code>type</code> that tells you what kind of thing -- what '''data type''' -- Python thinks something is. We can check for ourselves that Python considers '1' and '1.0' to be different data types:<br />
<syntaxhighlight lang="python"><br />
type(1)<br />
type(1.0)<br />
</syntaxhighlight><br />
So now we've seen two data types: '''integers''' and '''floats'''.<br />
<br />
By the way, what is a "function"? Here are the important ideas about functions:<br />
<br />
* A function encapsulates a useful bit of work and gives that work a name.<br />
* You provide input to a function and it produces output. For example, the <code>type</code> function takes data as an input, and produces what type of data the data is (e.g. an integer or a float) as output.<br />
* To use a function, write the name of the function, followed by an open parenthesis, then what the function needs as input (we call that input the '''arguments''' to the function), and then a close parenthesis.<br />
* Programmers have a lot of slang around functions. They'll say that functions "take" arguments, or that they "give" or "pass" arguments to a function. "call" and "invoke" are both synonyms for using a function.<br />
<br />
In the example above, "type" was the name of the function. <code>type</code> takes one argument; we first gave <code>type</code> an argument of 1 and then gave it an argument of 1.0.<br />
<br />
==== Diagram of "calling" a function ====<br />
<br />
[[File:Function_diagram.png]]<br />
<br />
===Jupyter history===<br />
<br />
In your Jupyter notebook, any time you want to re-run a command, you can select that cell again and repeat the same Shift+Enter action to re-run the cell.<br />
<br />
==Variables==<br />
<br />
[[File:Fraction.png|100px]]<br />
<br />
A lot of work gets done in Python using variables. Variables are a lot like the variables in math class, except that in Python variables can be of any data type, not just numbers.<br />
<syntaxhighlight lang="python"><br />
type(4)<br />
x = 4<br />
x<br />
type(x)<br />
2 * x<br />
</syntaxhighlight><br />
Giving a name to something, so that you can refer to it by that name, is called '''assignment'''. Above, we assigned the name 'x' to 4, and after that we can use <code>x</code> wherever we want to use the number 4. You'll see that there wasn't any output here when you ''assigned'' 4 to <code>x</code>; that's fine! Not all Python operations have output, and in fact most of the time that's what you expect.<br />
<br />
Variables can't have spaces or other special characters, and they need to start with a letter. Here are some valid variable names:<br />
<syntaxhighlight lang="python"><br />
magic_number = 1500<br />
amountOfFlour = .75<br />
my_name = "Jessica"<br />
</syntaxhighlight><br />
<br />
Projects develop naming conventions: maybe multi-word variable names use underscores (like <code>magic_number</code>), or "camel case" (like <code>amountOfFlour</code>). The most<br />
important thing is to be consistent within a project, because it makes the code more readable.<br />
<br />
==Output==<br />
<br />
[[File:Pacman.png|100px]]<br />
<br />
Notice how if you type a 4 and hit enter, the Python interpreter spits a 4 back<br />
out:<br />
<syntaxhighlight lang="python"><br />
4<br />
</syntaxhighlight><br />
But if you assign 4 to a variable, nothing is printed:<br />
<syntaxhighlight lang="python"><br />
x = 4<br />
</syntaxhighlight><br />
You can think of it as that something needs to get the output. Without an assignment, the winner is the screen. With assignment, the output goes to the variable.<br />
<br />
You can reassign variables if you want:<br />
<syntaxhighlight lang="python"><br />
x = 4<br />
x<br />
x = 5<br />
x<br />
</syntaxhighlight><br />
Sometimes reassigning a variable is an accident and causes bugs in programs.<br />
<syntaxhighlight lang="python"><br />
x = 3<br />
y = 4<br />
x * y<br />
x * x<br />
2 * x - 1 * y<br />
</syntaxhighlight><br />
Order of operations works pretty much like how you learned in school. If you're unsure of an ordering, you can add parentheses like on a calculator:<br />
<syntaxhighlight lang="python"><br />
(2 * x) - (1 * y)<br />
</syntaxhighlight><br />
Note that the spacing doesn't matter:<br />
<syntaxhighlight lang="python"><br />
x = 4<br />
</syntaxhighlight><br />
and<br />
<syntaxhighlight lang="python"><br />
x=4<br />
</syntaxhighlight><br />
are both valid Python and mean the same thing.<br />
<syntaxhighlight lang="python"><br />
(2 * x) - (1 * y)<br />
</syntaxhighlight><br />
and<br />
<syntaxhighlight lang="python"><br />
(2*x)-(1*y)<br />
</syntaxhighlight><br />
are also both valid and mean the same thing. You should strive to be consistent with whatever spacing you like or a job requires, since it makes reading the code easier.<br />
<br />
You aren't cheating and skipping typing these exercises out, are you? Good! :)<br />
<br />
==Strings==<br />
<br />
[[File:Letter.png|100px]]<br />
<br />
So far we've seen two data types: '''integers''' and '''floats'''. Another useful data type is a '''string''', which is just what Python calls a bunch of characters (like numbers, letters, whitespace, and punctuation) put together. Strings are indicated by being surrounded by quotes:<br />
<syntaxhighlight lang="python"><br />
"Hello"<br />
"Python, I'm your #1 fan!"<br />
</syntaxhighlight><br />
Like with the math data types above, we can use the <code>type</code> function to check the type of strings:<br />
<syntaxhighlight lang="python"><br />
type("Hello")<br />
type(1)<br />
type("1")<br />
</syntaxhighlight><br />
===String Concatenation===<br />
<br />
You can smoosh strings together (called "concatenation") using the '+' sign:<br />
<syntaxhighlight lang="python"><br />
"Hello" + "World"<br />
<br />
name = "Jessica"<br />
"Hello " + name<br />
</syntaxhighlight><br />
How about concatenating different data types?<br />
<syntaxhighlight lang="python"><br />
"Hello" + 1<br />
</syntaxhighlight><br />
Hey now! The output from the previous example was really different and interesting; let's break down exactly what happened: (you'll see a ''slightly'' different "Traceback" statement, that difference doesn't matter.)<br />
<br />
<pre><br />
In[ ]: "Hello" + 1<br />
Traceback (most recent call last):<br />
File "<stdin>", line 1, in <module><br />
TypeError: cannot concatenate 'str' and 'int' objects<br />
</pre><br />
<br />
Python is giving us a '''traceback'''. A traceback is details on what was happening when Python encountered an Exception or Error -- something it doesn't know how to handle.<br />
<br />
There are many kinds of Python errors, with descriptive names to help us humans understand what went wrong. In this case we are getting a <code>TypeError</code>: we tried to do some operation on a data type that isn't supported for that data type.<br />
<br />
Python gives us a helpful error message as part of the TypeError:<br />
<br />
<code>"cannot concatenate 'str' and 'int' objects"</code><br />
<br />
We saw above that we can concatenate strings:<br />
<br />
"Hello" + "World"<br />
<br />
works just fine.<br />
<br />
However,<br />
<br />
"Hello" + 1<br />
<br />
produces a <code>TypeError</code>. We are telling Python to concatenate a string and an integer, and that's not something Python understands how to do.<br />
<br />
We can convert an integer into a string ourselves, using the <code>str</code> function:<br />
<br />
"Hello" + str(1)<br />
<br />
Like the <code>type</code> function from before, the <code>str</code> function takes 1 argument. In the above example it took the integer 1. <code>str</code> takes a Python object as input and produces a string version of that input as output.<br />
<br />
===String length===<br />
<br />
There's another useful function that works on strings called <code>len</code>. <code>len</code> returns the length of a string as an integer:<br />
<br />
<syntaxhighlight lang="python"><br />
len("Hello")<br />
len("")<br />
fish = "humuhumunukunukuapua'a"<br />
name_length = len(fish)<br />
fish + " is a Hawaiian fish whose name is " + str(name_length) + " characters long."<br />
</syntaxhighlight><br />
<br />
===Quotes===<br />
<br />
We've been using double quotes around our strings, but you can use either double or single quotes:<br />
<syntaxhighlight lang="python"><br />
'Hello'<br />
"Hello"<br />
</syntaxhighlight><br />
Like with spacing above, use whichever quotes make the most sense for you, but be consistent.<br />
<br />
You do have to be careful about using quotes inside of strings:<br />
<br />
'I'm a happy camper'<br />
<br />
This gives us another '''traceback''', for a new kind of error, a <code>SyntaxError</code>. When Python looks at that expression, it sees the string 'I' and then<br />
<br />
<code>m a happy camper'</code><br />
<br />
which it doesn't understand -- it's not 'valid' Python. Those letters aren't variables (we haven't assigned them to anything), and that trailing quote isn't balanced. So it raises a <code>SyntaxError</code>.<br />
<br />
We can use double quotes to avoid this problem:<br />
<br />
"I'm a happy camper"<br />
<br />
One fun thing about strings in Python is that you can multiply them:<br />
<syntaxhighlight lang="python"><br />
"A" * 40<br />
"ABC" * 12<br />
h = "Happy"<br />
b = "Birthday"<br />
(h + b) * 10<br />
</syntaxhighlight><br />
==Part 1 Practice==<br />
<br />
[[File:Detective.png|100px]]<br />
<br />
Read the following expressions, but don't execute them. Guess what the output will be. After you've made a guess, copy and paste the expressions into your Jupyter notebook and check your guess.<br />
<br />
1.<br />
<syntaxhighlight lang="python"><br />
total = 1.5 - 1/2<br />
total<br />
type(total)<br />
</syntaxhighlight><br />
<br />
2.<br />
<syntaxhighlight lang="python"><br />
a = "quick"<br />
b = "brown"<br />
c = "fox jumps over the lazy dog"<br />
"The " + a * 3 + " " + b * 3 + " " + c<br />
</syntaxhighlight><br />
==End of Part 1==<br />
<br />
Congratulations! You've learned about and practiced math, strings, variables, data types, exceptions, tracebacks, and executing Python from the Python prompt.<br />
<br />
Take a break, stretch, meet some neighbors, and ask the staff if you have any questions about this material.<br />
<br />
[[File:Fireworks.png|200px]]<br />
<br />
==Making choices==<br />
<br />
We can use these expressions that <i>evaluate</i> to booleans to make decisions and conditionally execute code.<br />
<br />
[[File:Fork.png|100px]]<br />
<br />
====if statements====<br />
<br />
The simplest way to make a choice in Python is with the <code>if</code> keyword. Here's an example (don't try to type this one, just look at it for now):<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;<code>if 6 > 5:</code><br /><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<code>print("Six is greater than five!")</code><br />
<br />
That is our first multi-line piece of code, and the way to type it into a Jupyter notebook is a little different. Let's break down how to do this (type this out step by step):<br />
<br />
First, type the <code>if 6 > 5:</code>, then hit enter. ''Not'' Shift + Enter, because this time we want to write more than one line before we ask Jupyter to run it!<br />
<br />
Once you've hit enter, you'll see that your carat is indented already for you; Jupyter understands that you're now inside the <code>if</code> ''code block'', and adjusts your indentation position for you. In Python, all lines of a block are at the same indentation level, and the block ends when you reduce your indentation again.<br />
<br />
Write <code>print("Six is greater than five!")</code>, then hit enter, and now hit Shift+Enter to run this if statement!<br />
<ol><br />
<li>First, type the<br /><br />
<br /><br />
&nbsp;&nbsp;&nbsp;&nbsp;<code>if 6 > 5:</code><br /><br />
<br /><br />
part, and press Enter. The next line will have <code>...</code> as a prompt, instead of the usual <code>&gt;&gt;&gt;</code>. This is Python telling us that we are in the middle of a '''code block''', and so long as we indent our code it should be a part of this code block.</li><br />
<br />
<li>Press the spacebar 4 times to indent.</li><br />
<li>Type<br /><br />
<br /><br />
&nbsp;&nbsp;&nbsp;&nbsp;<code>print("Six is greater than five!")</code><br /><br /></li><br />
<li>Press Enter to end the line. The prompt will still be a <code>...</code></li><br />
<li>Press Enter one more time to tell Python you are done with this code block. The code block will now execute.</li><br />
</ol><br />
<br />
All together, it will look like this:<br />
<br />
<pre><br />
if 6 > 5:<br />
print("Six is greater than five!")<br />
<br />
Six is greater than five!<br />
</pre><br />
<br />
What is going on here? When Python encounters the <code>if</code> keyword, it <i>evaluates</i> the <i>expression</i> following the keyword and before the colon. If that expression is '''True''', Python executes the code in the indented code block under the <code>if</code> line. If that expression is '''False''', Python skips over the code block.<br />
<br />
In this case, because 6 really is greater than 5, Python executes the code block under the if statement, and we see "Six is greater than five!" printed to the screen. Guess what will happen with these other expressions, then type them out and see if your guess was correct:<br />
<br />
<pre><br />
if 0 > 2:<br />
print("Zero is greater than two!")<br />
</pre><br />
<br />
<pre><br />
if "banana" in "bananarama":<br />
print("I miss the 80s.")<br />
</pre><br />
<br />
====more choices: <code>if</code> and <code>else</code>====<br />
<br />
'''<code>if</code>''' lets you execute some code only if a condition is <code>True</code>. What if you want to execute different code if a condition is <code>False</code>?<br />
<br />
Use the '''<code>else</code>''' keyword, together with <code>if</code>, to execute different code when the <code>if</code> condition isn't <code>True</code>. Try this:<br />
<br />
<syntaxhighlight lang="python"><br />
sister_age = 15<br />
brother_age = 12<br />
if sister_age > brother_age:<br />
print("sister is older")<br />
else:<br />
print("brother is older")<br />
</syntaxhighlight><br />
<br />
Like with <code>if</code>, the code block under the <code>else</code> condition must be indented so Python knows that it is a part of the <code>else</code> block.<br />
<br />
====compound conditionals: <code>and</code> and <code>or</code>====<br />
<br />
You can check multiple expressions together using the '''<code>and</code>''' and '''<code>or</code>''' keywords. If two expressions are joined by an <code>and</code>, they '''both''' have to be <code>True</code> for the overall expression to be <code>True</code>. If two expressions are joined by an <code>or</code>, as long as '''at least one''' is <code>True</code>, the overall expression is <code>True</code>.<br />
<br />
Try typing these out and see what you get:<br />
<br />
<syntaxhighlight lang="python"><br />
1 > 0 and 1 < 2<br />
</syntaxhighlight><br />
<br />
<syntaxhighlight lang="python"><br />
1 < 2 and "x" in "abc"<br />
</syntaxhighlight><br />
<br />
<syntaxhighlight lang="python"><br />
"a" in "hello" or "e" in "hello"<br />
</syntaxhighlight><br />
<br />
<syntaxhighlight lang="python"><br />
1 <= 0 or "a" not in "abc"<br />
</syntaxhighlight><br />
<br />
Guess what will happen when you enter these next two examples, and then type them out and see if you are correct. If you have trouble with the indenting, call over a staff member and practice together. It is important to be comfortable with indenting for tomorrow.<br />
<br />
<syntaxhighlight lang="python"><br />
temperature = 32<br />
if temperature > 60 and temperature < 75:<br />
print("It's nice and cozy in here!")<br />
else:<br />
print("Too extreme for me.")<br />
</syntaxhighlight><br />
<br />
<syntaxhighlight lang="python"><br />
hour = 11<br />
if hour < 7 or hour > 23:<br />
print("Go away!")<br />
print("I'm sleeping!")<br />
else:<br />
print("Welcome to the cheese shop!")<br />
print("Can I interest you in some choice gouda?")<br />
</syntaxhighlight><br />
<br />
You can have as many lines of code as you want in <code>if</code> and <code>else</code> blocks; just make sure to indent them so Python knows they are a part of the block.<br />
<br />
====even more choices: <code>elif</code>====<br />
<br />
If you need to execute code conditional based on more than two cases, you can use the '''<code>elif</code>''' keyword to check more cases. You can have as many <code>elif</code> cases as you want; Python will go down the code checking each <code>elif</code> until it finds a <code>True</code> condition or reaches the default <code>else</code> block.<br />
<br />
<syntaxhighlight lang="python"><br />
sister_age = 15<br />
brother_age = 12<br />
if sister_age > brother_age:<br />
print("sister is older")<br />
elif sister_age == brother_age:<br />
print("sister and brother are the same age")<br />
else:<br />
print("brother is older")<br />
</syntaxhighlight><br />
<br />
You don't have to have an <code>else</code> block, if you don't need it. That just means there isn't default code to execute when none of the <code>if</code> or <code>elif</code> conditions are <code>True</code>:<br />
<br />
<syntaxhighlight lang="python"><br />
color = "orange"<br />
if color == "green" or color == "red":<br />
print("Christmas color!")<br />
elif color == "black" or color == "orange":<br />
print("Halloween color!")<br />
elif color == "pink":<br />
print("Valentine's Day color!")<br />
</syntaxhighlight><br />
<br />
If color had been "purple", that code wouldn't have printed anything.<br />
<br />
'''Remember that '=' is for assignment and '==' is for comparison.'''<br />
<br />
====In summary: the structure of if/elif/else====<br />
<br />
Here's a diagram of <code>if/elif/else</code>:<br />
<br />
[[File:If-elif-else.png]]<br />
<br />
Do you understand the difference between <code>elif</code> and <code>else</code>? When do you indent? When do you use a colon? If you're not sure, talk about it with a neighbor or staff member.<br />
<br />
==Booleans==<br />
<br />
Please return to the interactive Python interpreter for the rest of the tutorial. And remember: type out the examples. You'll thank yourself tomorrow. :)<br />
<br />
[[File:Scales.png|100px]]<br />
<br />
So far, the code we've written has been <i>unconditional</i>: no choice is getting made, and the code is always run. Python has another data type called a '''boolean''' that is helpful for writing code that makes decisions. There are two booleans: <code>True</code> and <code>False</code>.<br />
<syntaxhighlight lang="python"><br />
True<br />
<br />
type(True)<br />
<br />
False<br />
<br />
type(False)<br />
</syntaxhighlight><br />
You can test if Python objects are equal or unequal. The result is a boolean:<br />
<syntaxhighlight lang="python"><br />
0 == 0<br />
<br />
0 == 1<br />
</syntaxhighlight><br />
Use <code>==</code> to test for equality. Recall that <code>=</code> is used for <i>assignment</i>.<br />
<br />
This is an important idea and can be a source of bugs until you get used to it: '''= is assignment, == is comparison'''.<br />
<br />
Use <code>!=</code> to test for inequality:<br />
<syntaxhighlight lang="python"><br />
"a" != "a"<br />
<br />
"a" != "A"<br />
</syntaxhighlight><br />
<code>&lt;</code>, <code>&lt;=</code>, <code>&gt;</code>, and <code>&gt;=</code> have the same meaning as in math class. The result of these tests is a boolean:<br />
<syntaxhighlight lang="python"><br />
1 > 0<br />
<br />
2 >= 3<br />
<br />
-1 < 0<br />
<br />
.5 <= 1<br />
</syntaxhighlight><br />
You can check for containment with the <code>in</code> keyword, which also results in a boolean:<br />
<syntaxhighlight lang="python"><br />
"H" in "Hello"<br />
<br />
"X" in "Hello"<br />
</syntaxhighlight><br />
Or check for a lack of containment with <code>not in</code>:<br />
<syntaxhighlight lang="python"><br />
"a" not in "abcde"<br />
<br />
"Perl" not in "Python Workshop"<br />
</syntaxhighlight><br />
==End of Part 2==<br />
<br />
Congratulations! You've learned about and practiced executing Python scripts, booleans, conditionals, and making choices with if, elif, and else. This is a huge, huge accomplishment!<br />
<br />
[[File:Champagne.png|100px]][[File:Party.png|125px]]<br />
<br />
Take a break, stretch, meet some neighbors, and ask the staff if you have any questions about this material.<br />
<br />
[[Category:Shared_Pages]]<br />
[[Category:CDSW]]</div>Ddaileyhttps://wiki.communitydata.science/index.php?title=Community_Data_Science_Workshops_(Core)/Workshop/Baby_Names/Setup&diff=185746Community Data Science Workshops (Core)/Workshop/Baby Names/Setup2020-01-16T23:50:19Z<p>Ddailey: </p>
<hr />
<div>In this section, we'll download everything we need for tomorrow's projects.<br />
<br />
==Baby Names==<br />
<br />
[[File:Being a twin means you always have a pillow or blanket handy.jpg|350px]]<br />
<br />
===Download the Baby Names project===<br />
<br />
You'll be playing with data from the list of all baby names in the US (used more than five times in a year) from the last several years:<br />
<br />
# Right click the following file, click "Save Target as..." or "Save link as...", and save it to your Desktop directory: https://github.com/CommunityDataScienceCollective/CDSW_Babynames/archive/master.zip<br />
# The ".zip" extension on the above file indicates that it is a compressed Zip archive. We need to "extract" its contents. Find CDSW_Babynames-master.zip on your Desktop and double-click on it to "unzip" it. That will create a folder called "CDSW_Babynames-master" containing several files. (Mac users can drag the "CDSW_Babynames-master" folder from Downloads to Desktop). (Windows users can navigate to the Desktop by clicking on "Start", then "Computer", and navigate to your Desktop directory). <br />
<br />
<br />
===Test the Baby Names code===<br />
Launch Jupyter Notebook through the Anaconda Navigator and navigate to the "CDSW_Babynames-master" directory where the Baby Names code lives. Open <code> BabyNames.ipynb</code>. <br />
<br />
;Running cells<br />
To test that everything is working, we will run the first two cells in this notebook. "Run" means executing the code in the cell. You can run a cell two ways: 1) by clicking the "run" button, or 2) by clicking the grey part of the cell and then typing SHIFT + ENTER (or "RETURN") at the same time.<br />
<br />
'''Step 1:''' Run the first cells that reads:<br />
<br />
import ssadata<br />
<br />
If you are running this cell for the first time, it will look like nothing has happened! That's expected. But if you are curious about what just you just did, ask a mentor!<br />
<br />
'''Step 2:''' Run the second cell that reads:<br />
<br />
for name in ssadata.boys.keys():<br />
if name == "mako":<br />
print("There were " + str(ssadata.boys[name]) + " boys named " + name)<br />
<br />
This time, you should get the output <br />
<br />
<code>There were 10 boys named mako </code><br />
<br />
If this doesn't work, let a mentor know!<br />
<br />
===Success!===<br />
<br />
You've completed setup for the Baby Names project. If you are curious, you can try running the next few cells in the notebook too, and check out their output!<br />
<br />
==State Capitals==<br />
<br />
During the lecture on Saturday, we'll also look at an example Python script that quizzes you on state capitals .<br />
<br />
# Save the following file to your Desktop directory: https://communitydata.science/~mako/State_Capitals.ipynb. (Windows users can save the file by right clicking on the file link and choosing "Save Target as..." or "Save link as...".) (Mac users can save the file with Option + Clicking on the link.)<br />
<br />
;Tip: ''If you want to keep all your CDSW code together, you can create a new folder on your desktop called "CDSW" and move both this notebook (State_Capitals.ipynb) and the babynames directory (CDSW_Babynames-master) into it.''<br />
<br />
==Success!==<br />
<br />
You are done downloading the Saturday projects. You can move on to the [[CDSW/Day_0_setup_and_tutorial|next step]].<br />
<br />
[[File:Champagne.png|100px]][[File:Party.png|125px]]<br />
<br />
[[Category:CDSW]][[Category:Shared Pages]]</div>Ddaileyhttps://wiki.communitydata.science/index.php?title=Community_Data_Science_Workshops_(Core)/Workshop/Baby_Names/Setup&diff=185745Community Data Science Workshops (Core)/Workshop/Baby Names/Setup2020-01-16T23:47:42Z<p>Ddailey: </p>
<hr />
<div>In this section, we'll download everything we need for tomorrow's projects.<br />
<br />
==Baby Names==<br />
<br />
[[File:Being a twin means you always have a pillow or blanket handy.jpg|350px]]<br />
<br />
===Download the Baby Names project===<br />
<br />
You'll be playing with data from the list of all baby names in the US (used more than five times in a year) from the last several years:<br />
<br />
# Right click the following file, click "Save Target as..." or "Save link as...", and save it to your Desktop directory: https://github.com/CommunityDataScienceCollective/CDSW_Babynames/archive/master.zip<br />
# The ".zip" extension on the above file indicates that it is a compressed Zip archive. We need to "extract" its contents. Find CDSW_Babynames-master.zip on your Desktop and double-click on it to "unzip" it. That will create a folder called "CDSW_Babynames-master" containing several files. (For Mac users, drag the "CDSW_Babynames-master" folder from Downloads to Desktop). (For Windows users navigate to the Desktop by clicking on "Start", then "Computer", and navigate to your Desktop directory). <br />
<br />
<br />
===Test the Baby Names code===<br />
Launch Jupyter Notebook through the Anaconda Navigator and navigate to the "CDSW_Babynames-master" directory where the Baby Names code lives. Open <code> BabyNames.ipynb</code>. <br />
<br />
;Running cells<br />
To test that everything is working, we will run the first two cells in this notebook. "Run" means executing the code in the cell. You can run a cell two ways: 1) by clicking the "run" button, or 2) by clicking the grey part of the cell and then typing SHIFT + ENTER (or "RETURN") at the same time.<br />
<br />
'''Step 1:''' Run the first cells that reads:<br />
<br />
import ssadata<br />
<br />
If you are running this cell for the first time, it will look like nothing has happened! That's expected. But if you are curious about what just you just did, ask a mentor!<br />
<br />
'''Step 2:''' Run the second cell that reads:<br />
<br />
for name in ssadata.boys.keys():<br />
if name == "mako":<br />
print("There were " + str(ssadata.boys[name]) + " boys named " + name)<br />
<br />
This time, you should get the output <br />
<br />
<code>There were 10 boys named mako </code><br />
<br />
If this doesn't work, let a mentor know!<br />
<br />
===Success!===<br />
<br />
You've completed setup for the Baby Names project. If you are curious, you can try running the next few cells in the notebook too, and check out their output!<br />
<br />
==State Capitals==<br />
<br />
During the lecture on Saturday, we'll also look at an example Python script that quizzes you on state capitals .<br />
<br />
# Save the following file to your Desktop directory: https://communitydata.science/~mako/State_Capitals.ipynb. (Windows users, save the file by right clicking the on the file link or "Save Target as..." or "Save link as...".) (Mac users can save the file by Option + Clicking on the link)<br />
<br />
;Tip: ''If you want to keep all your CDSW code together, you can create a new folder on your desktop called "CDSW" and move both this notebook (State_Capitals.ipynb) and the babynames directory (CDSW_Babynames-master) into it.''<br />
<br />
==Success!==<br />
<br />
You are done downloading the Saturday projects. You can move on to the [[CDSW/Day_0_setup_and_tutorial|next step]].<br />
<br />
[[File:Champagne.png|100px]][[File:Party.png|125px]]<br />
<br />
[[Category:CDSW]][[Category:Shared Pages]]</div>Ddaileyhttps://wiki.communitydata.science/index.php?title=Community_Data_Science_Workshops_(Core)/Workshop/Baby_Names/Setup&diff=185744Community Data Science Workshops (Core)/Workshop/Baby Names/Setup2020-01-16T23:36:56Z<p>Ddailey: </p>
<hr />
<div>In this section, we'll download everything we need for tomorrow's projects.<br />
<br />
==Baby Names==<br />
<br />
[[File:Being a twin means you always have a pillow or blanket handy.jpg|350px]]<br />
<br />
===Download the Baby Names project===<br />
<br />
You'll be playing with data from the list of all baby names in the US (used more than five times in a year) from the last several years:<br />
<br />
# Right click the following file, click "Save Target as..." or "Save link as...", and save it to your Desktop directory: https://github.com/CommunityDataScienceCollective/CDSW_Babynames/archive/master.zip<br />
# The ".zip" extension on the above file indicates that it is a compressed Zip archive. We need to "extract" its contents. Find CDSW_Babynames-master.zip on your Desktop and double-click on it to "unzip" it. That will create a folder called "CDSW_Babynames-master" containing several files. (For Mac users, drag the "CDSW_Babynames-master" folder from Downloads to Desktop). (For Windows users navigate to the Desktop by clicking on "Start", then "Computer", and navigate to your Desktop directory). <br />
<br />
<br />
===Test the Baby Names code===<br />
Launch Jupyter Notebook through the Anaconda Navigator and navigate to the "CDSW_Babynames-master" directory where the Baby Names code lives. Open <code> BabyNames.ipynb</code>. <br />
<br />
;Running cells<br />
To test that everything is working, we will run the first two cells in this notebook. "Run" means executing the code in the cell. You can run a cell two ways: 1) by clicking the "run" button, or 2) by clicking the grey part of the cell and then typing SHIFT + ENTER (or "RETURN") at the same time.<br />
<br />
'''Step 1:''' Run the first cells that reads:<br />
<br />
import ssadata<br />
<br />
If you are running this cell for the first time, it will look like nothing has happened! That's expected. But if you are curious about what just you just did, ask a mentor!<br />
<br />
'''Step 2:''' Run the second cell that reads:<br />
<br />
for name in ssadata.boys.keys():<br />
if name == "mako":<br />
print("There were " + str(ssadata.boys[name]) + " boys named " + name)<br />
<br />
This time, you should get the output <br />
<br />
<code>There were 10 boys named mako </code><br />
<br />
If this doesn't work, let a mentor know!<br />
<br />
===Success!===<br />
<br />
You've completed setup for the Baby Names project. If you are curious, you can try running the next few cells in the notebook too, and check out their output!<br />
<br />
==State Capitals==<br />
<br />
During the lecture on Saturday, we'll also look at an example Python script that quizzes you on state capitals .<br />
<br />
# Save the following file to your Desktop directory: https://communitydata.science/~mako/State_Capitals.ipynb. (Windows users, save the file by right clicking the on the file link or "Save Target as..." or "Save link as...".) (Mac users can save the file by Option + Clicking on the link)<br />
<br />
;Tip: ''If you want to keep all your CDSW code together, you can create a new folder on your desktop called "CDSW" and move both this notebook and the babynames directory into it.''<br />
<br />
==Success!==<br />
<br />
You are done downloading the Saturday projects. You can move on to the [[CDSW/Day_0_setup_and_tutorial|next step]].<br />
<br />
[[File:Champagne.png|100px]][[File:Party.png|125px]]<br />
<br />
[[Category:CDSW]][[Category:Shared Pages]]</div>Ddaileyhttps://wiki.communitydata.science/index.php?title=Community_Data_Science_Workshops_(Core)/Workshop/Baby_Names/Setup&diff=185743Community Data Science Workshops (Core)/Workshop/Baby Names/Setup2020-01-16T23:30:04Z<p>Ddailey: </p>
<hr />
<div>In this section, we'll download everything we need for tomorrow's projects.<br />
<br />
==Baby Names==<br />
<br />
[[File:Being a twin means you always have a pillow or blanket handy.jpg|350px]]<br />
<br />
===Download the Baby Names project===<br />
<br />
You'll be playing with data from the list of all baby names in the US (used more than five times in a year) from the last several years:<br />
<br />
# Right click the following file, click "Save Target as..." or "Save link as...", and save it to your Desktop directory: https://github.com/CommunityDataScienceCollective/CDSW_Babynames/archive/master.zip<br />
# The ".zip" extension on the above file indicates that it is a compressed Zip archive. We need to "extract" its contents. Find CDSW_Babynames-master.zip on your Desktop and double-click on it to "unzip" it. That will create a folder called "CDSW_Babynames-master" containing several files. (For Mac users, drag the "CDSW_Babynames-master" folder from Downloads to Desktop). (For Windows users navigate to the Desktop by clicking on "Start", then "Computer", and navigate to your Desktop directory). <br />
<br />
<br />
===Test the Baby Names code===<br />
Launch Jupyter Notebook through the Anaconda Navigator and navigate to the "CDSW_Babynames-master" directory where the Baby Names code lives. Open <code> BabyNames.ipynb</code>. <br />
<br />
;Running cells<br />
To test that everything is working, we will run the first two cells in this notebook. "Run" means executing the code in the cell. You can run a cell two ways: 1) by clicking the "run" button, or 2) by clicking the grey part of the cell and then typing SHIFT + ENTER (or "RETURN") at the same time.<br />
<br />
'''Step 1:''' Run the first cells that reads:<br />
<br />
import ssadata<br />
<br />
If you are running this cell for the first time, it will look like nothing has happened! That's expected. But if you are curious about what just you just did, ask a mentor!<br />
<br />
'''Step 2:''' Run the second cell that reads:<br />
<br />
for name in ssadata.boys.keys():<br />
if name == "mako":<br />
print("There were " + str(ssadata.boys[name]) + " boys named " + name)<br />
<br />
This time, you should get the output <br />
<br />
<code>There were 10 boys named mako </code><br />
<br />
If this doesn't work, let a mentor know!<br />
<br />
===Success!===<br />
<br />
You've completed setup for the Baby Names project. If you are curious, you can try running the next few cells in the notebook too, and check out their output!<br />
<br />
==State Capitals==<br />
<br />
During the lecture on Saturday, we'll also look at an example Python script that quizzes you on state capitals .<br />
<br />
# Right click the following file, click "Save Target as..." or "Save link as...", and save it to your Desktop directory: https://communitydata.science/~mako/State_Capitals.ipynb<br />
<br />
;Tip: ''If you want to keep all your CDSW code together, you can create a new folder on your desktop called "CDSW" and move both this notebook and the babynames directory into it.''<br />
<br />
==Success!==<br />
<br />
You are done downloading the Saturday projects. You can move on to the [[CDSW/Day_0_setup_and_tutorial|next step]].<br />
<br />
[[File:Champagne.png|100px]][[File:Party.png|125px]]<br />
<br />
[[Category:CDSW]][[Category:Shared Pages]]</div>Ddaileyhttps://wiki.communitydata.science/index.php?title=Community_Data_Science_Workshops_(Core)/Workshop/Baby_Names/Setup&diff=185738Community Data Science Workshops (Core)/Workshop/Baby Names/Setup2020-01-16T23:16:52Z<p>Ddailey: </p>
<hr />
<div>In this section, we'll download everything we need for tomorrow's projects.<br />
<br />
==Baby Names==<br />
<br />
[[File:Being a twin means you always have a pillow or blanket handy.jpg|350px]]<br />
<br />
===Download the Baby Names project===<br />
<br />
You'll be playing with data from the list of all baby names in the US (used more than five times in a year) from the last several years:<br />
<br />
# Right click the following file, click "Save Target as..." or "Save link as...", and save it to your Desktop directory: https://github.com/CommunityDataScienceCollective/CDSW_Babynames/archive/master.zip<br />
# The ".zip" extension on the above file indicates that it is a compressed Zip archive. We need to "extract" its contents. Find CDSW_Babynames-master.zip on your Desktop and double-click on it to "unzip" it. That will create a folder called "CDSW_Babynames-master" containing several files. (For Mac users, drag the folder from Downloads to Desktop). (For Windows users navigate to the Desktop by clicking on "Start", then "Computer", and navigate to your Desktop directory). <br />
<br />
<br />
===Test the Baby Names code===<br />
Launch Jupyter Notebook through the Anaconda Navigator and navigate to the "CDSW_Babynames-master" directory where the Baby Names code lives. Open <code> BabyNames.ipynb</code>. <br />
<br />
;Running cells<br />
To test that everything is working, we will run the first two cells in this notebook. "Run" means executing the code in the cell. You can run a cell two ways: 1) by clicking the "run" button, or 2) by clicking the grey part of the cell and then typing SHIFT + ENTER (or "RETURN") at the same time.<br />
<br />
'''Step 1:''' Run the first cells that reads:<br />
<br />
import ssadata<br />
<br />
If you are running this cell for the first time, it will look like nothing has happened! That's expected. But if you are curious about what just you just did, ask a mentor!<br />
<br />
'''Step 2:''' Run the second cell that reads:<br />
<br />
for name in ssadata.boys.keys():<br />
if name == "mako":<br />
print("There were " + str(ssadata.boys[name]) + " boys named " + name)<br />
<br />
This time, you should get the output <br />
<br />
<code>There were 10 boys named mako </code><br />
<br />
If this doesn't work, let a mentor know!<br />
<br />
===Success!===<br />
<br />
You've completed setup for the Baby Names project. If you are curious, you can try running the next few cells in the notebook too, and check out their output!<br />
<br />
==State Capitals==<br />
<br />
During the lecture on Saturday, we'll also look at an example Python script that quizzes you on state capitals .<br />
<br />
# Right click the following file, click "Save Target as..." or "Save link as...", and save it to your Desktop directory: https://communitydata.science/~mako/State_Capitals.ipynb<br />
<br />
;Tip: ''If you want to keep all your CDSW code together, you can create a new folder on your desktop called "CDSW" and move both this notebook and the babynames directory into it.''<br />
<br />
==Success!==<br />
<br />
You are done downloading the Saturday projects. You can move on to the [[CDSW/Day_0_setup_and_tutorial|next step]].<br />
<br />
[[File:Champagne.png|100px]][[File:Party.png|125px]]<br />
<br />
[[Category:CDSW]][[Category:Shared Pages]]</div>Ddaileyhttps://wiki.communitydata.science/index.php?title=Community_Data_Science_Workshops_(Core)/Workshop/Baby_Names/Setup&diff=185735Community Data Science Workshops (Core)/Workshop/Baby Names/Setup2020-01-16T23:13:28Z<p>Ddailey: </p>
<hr />
<div>In this section, we'll download everything we need for tomorrow's projects.<br />
<br />
==Baby Names==<br />
<br />
[[File:Being a twin means you always have a pillow or blanket handy.jpg|350px]]<br />
<br />
===Download the Baby Names project===<br />
<br />
You'll be playing with data from the list of all baby names in the US (used more than five times in a year) from the last several years:<br />
<br />
# Right click the following file, click "Save Target as..." or "Save link as...", and save it to your Desktop directory: https://github.com/CommunityDataScienceCollective/CDSW_Babynames/archive/master.zip<br />
# The ".zip" extension on the above file indicates that it is a compressed Zip archive. We need to "extract" its contents. Find CDSW_Babynames-master.zip on your Desktop and double-click on it to "unzip" it. That will create a folder called "CDSW_Babynames-master" containing several files. (To find the file on a Windows computer, click on "Start", then "Computer", and navigate to your Desktop directory). <br />
<br />
<br />
===Test the Baby Names code===<br />
Launch Jupyter Notebook through the Anaconda Navigator and navigate to the "CDSW_Babynames-master" directory where the Baby Names code lives. Open <code> BabyNames.ipynb</code>. <br />
<br />
;Running cells<br />
To test that everything is working, we will run the first two cells in this notebook. "Run" means executing the code in the cell. You can run a cell two ways: 1) by clicking the "run" button, or 2) by clicking the grey part of the cell and then typing SHIFT + ENTER (or "RETURN") at the same time.<br />
<br />
'''Step 1:''' Run the first cells that reads:<br />
<br />
import ssadata<br />
<br />
If you are running this cell for the first time, it will look like nothing has happened! That's expected. But if you are curious about what just you just did, ask a mentor!<br />
<br />
'''Step 2:''' Run the second cell that reads:<br />
<br />
for name in ssadata.boys.keys():<br />
if name == "mako":<br />
print("There were " + str(ssadata.boys[name]) + " boys named " + name)<br />
<br />
This time, you should get the output <br />
<br />
<code>There were 10 boys named mako </code><br />
<br />
If this doesn't work, let a mentor know!<br />
<br />
===Success!===<br />
<br />
You've completed setup for the Baby Names project. If you are curious, you can try running the next few cells in the notebook too, and check out their output!<br />
<br />
==State Capitals==<br />
<br />
During the lecture on Saturday, we'll also look at an example Python script that quizzes you on state capitals .<br />
<br />
# Right click the following file, click "Save Target as..." or "Save link as...", and save it to your Desktop directory: https://communitydata.science/~mako/State_Capitals.ipynb<br />
<br />
;Tip: ''If you want to keep all your CDSW code together, you can create a new folder on your desktop called "CDSW" and move both this notebook and the babynames directory into it.''<br />
<br />
==Success!==<br />
<br />
You are done downloading the Saturday projects. You can move on to the [[CDSW/Day_0_setup_and_tutorial|next step]].<br />
<br />
[[File:Champagne.png|100px]][[File:Party.png|125px]]<br />
<br />
[[Category:CDSW]][[Category:Shared Pages]]</div>Ddaileyhttps://wiki.communitydata.science/index.php?title=MacOS_terminal_navigation&diff=185721MacOS terminal navigation2020-01-16T19:58:40Z<p>Ddailey: </p>
<hr />
<div>[[File:Utilities-terminal.png|200px]]<br />
<br />
== Practice navigating from the terminal ==<br />
<br />
The filesystem on your computer is like a tree made up of folders (also called "directories") and files. The filesystem has a root directory called <tt>/</tt>, and everything on your computer lives in subdirectories of this root directory.<br />
<br />
We often navigate the filesystem graphically by clicking on graphical folders. We can do the exact same navigation from the terminal.<br />
<br />
There are three commands that we'll be using in the terminal to navigate the filesystem on your computer:<br />
* <code>ls</code><br />
* <code>pwd</code><br />
* <code>cd</code><br />
<br />
<code>ls</code> lists the contents of a directory.<br /><br />
<code>pwd</code> gives the full directory path to your current directory.<br /><br />
<code>cd</code> moves you into a new directory (it stands for "change directory").<br />
<br />
Let's practice using these commands.<br />
<br />
===Open a terminal===<br />
<br />
You can find the Terminal application through Spotlight, or navigate to Applications/Utilities/Terminal.<br />
If you are using Anaconda Navigator, you can open terminal clicking on the play arrow button in the Environments -> base(root) window. <br />
<br />
===Practice using <code>ls</code>, <code>pwd</code>, and <code>cd</code>===<br />
(that's a letter l in "ls", not the number 1)<br />
<br />
Type each of these commands and hit enter:<br />
<br />
<pre>ls</pre><br />
This lists all the files in your current directory.<br />
<br />
<br /><br />
<br />
<pre>pwd</pre><br />
This displays the full directory path to your current directory. (It's stands for "print working directory.")<br />
<br />
<br /><br />
<br />
<pre>cd /</pre><br />
This will change you into the <code>/</code> root directory.<br />
<br />
<br /><br />
<br />
<pre>ls</pre><br />
This lists the contents of the <code>/</code> root directory.<br />
<br />
<br /><br />
<br />
<pre>cd Users</pre><br />
This will change you into the <code>Users</code> subdirectory of the <code>/</code> root directory. <br />
<br />
<br /><br />
<br />
<pre>ls</pre><br />
You should see a list of all the files in <code>/Users</code>, including the directory for your username. The directory for your username (e.g. <tt>/Users/Jessica</tt> is often called your "home directory".<br />
<br />
<br /><br />
<br />
<pre>pwd</pre><br />
This displays the full directory path to your current directory, <code>/Users</code>.<br />
<br />
<br /><br />
<br />
<pre>cd ..</pre><br />
<code>..</code> means "parent directory", so this command moved you up to the parent directory. You were in <code>/Users</code>, so now you are in <code>/</code>, the root directory.<br />
<br />
<br /><br />
<br />
<pre>ls</pre><br />
This lists the contents of the root directory, confirming where you are.<br />
<br />
If you want to get back to your home directory, you can do:<br />
<br />
<pre>cd Users</pre><br />
<br />
<pre>cd YOURNAME</pre><br />
<br />
where YOURNAME is the name of your User directory.<br />
<br />
One helpful tip is that you can start typing a directory, then hit the <code>TAB</code> key and the terminal will autocomplete it.<br />
<br />
===Tips===<br />
<br />
* You can use Tab to auto-complete directory and file names. So from inside the root directory <tt>/</tt>, if you type <code>cd Us</code> and hit Tab, the terminal will auto-complete the directory name, and you can then hit enter to change into the <code>/Users</code> directory.<br />
* The terminal maintains a command history. You can use the up arrow to cycle through old commands.<br />
<br />
===Check your understanding===<br />
<br />
Answer these questions. Experiment at the terminal prompt if you need to! If you aren't sure about an answer, ask a helper.<br />
<br />
# What directory are you in after starting a new terminal prompt?<br />
# After starting a new terminal prompt, how would you get to the root directory?<br />
# How do you check what files and directories are in your current working directory?<br />
# If you are in directory <tt>/Users</tt>, and you want to get to <tt>/Users/jesstess/projects</tt>, how would you do that?<br />
# What are 2 ways to avoid typing out a full navigation command? (hint: one requires that you've run the command before)<br />
# What is the difference between a terminal prompt and a Python prompt?<br />
<br />
===Success!===<br />
<br />
You've practiced using <code>ls</code>, <code>pwd</code>, and <code>cd</code> to navigate your computer's filesystem from the terminal.<br />
<br />
[[File:Champagne.png|100px]][[File:Party.png|125px]]<br />
<br />
[[Category:CDSW]][[Category:Shared Pages]]</div>Ddaileyhttps://wiki.communitydata.science/index.php?title=Python_in_Jupyter&diff=185720Python in Jupyter2020-01-16T19:56:03Z<p>Ddailey: </p>
<hr />
<div>We are going to practice writing and running Python programs (often called "scripts").<br />
<br />
TODO:<br />
* Download a sample notebook<br />
* Make sure the notebook is in your desktop (this keeps things simple)<br />
* Open the notebook in jupyter tab in browser.<br />
* Notebook itself should encourage them to run some cells.<br />
* Terminal navigation instructions below should be updated to work for MacOS and Windows<br />
* [[Windows terminal navigation|terminal navigation on Windows]] and [[MacOS_terminal_navigation|terminal navigation on Mac]] instructions should be checked/updated, too.<br />
<br />
<br />
===Download and start your text editor ===<br />
[[File:Anaconda home window.png|frameless|400px]]<br />
<br />
# Launch Anaconda Navigator<br />
# Find the '''"VSCode"''' application in the Anaconda Navigator '''"Home"''' window. If it is not yet installed, click "Install" (this may take a few minutes)<br />
# Launch the VSCode text editor.<br />
<br />
===Write and save a short Python script===<br />
<br />
# Click "New file" to start a new, blank text file.<br />
# Add the following line to your new text file:<br />
<br />
<pre><br />
print("Hello World!")<br />
</pre><br />
<br />
# Save the script as <code>hello.py</code> in your Desktop directory. The <code>.py</code> extension indicates that this file contains Python code.<br />
<br />
=== Navigate to the script in your terminal ===<br />
<br />
# Start a new terminal prompt. See the [[Windows terminal navigation|terminal navigation on Windows]] or [[MacOS_terminal_navigation|terminal navigation on Mac]] instructions for the steps to do this. Recall that on Windows a terminal prompt will look like <code>C:\</code> and a Python prompt will look like <code>>>></code>. Make sure you are at a terminal prompt and not a Python prompt; if you are at a Python prompt, you can type <code>exit()</code> on a line by itself and then press enter to exit Python and return to a terminal prompt.<br />
# Navigate to your Desktop directory from a PowerShell terminal prompt, using the <code>ls</code> and <code>cd</code> commands. See the [[Windows terminal navigation|terminal navigation on Windows]] or [[MacOS_terminal_navigation|terminal navigation on Mac]] instructions for a refresher on using these commands. Don't hesitate to get help from a mentor on this step if you need it -- it's a new way of navigating around your computer, so it may be unintuitive at first!<br />
<br />
=== Run the script ===<br />
# Once you are in your Desktop directory, you'll see <code>hello.py</code> in the output of <code>ls</code>.<br />
# Type<br />
<br />
<pre><br />
python hello.py<br />
</pre><br />
<br />
and press enter. Doing this will cause Python to execute the contents of that script -- it should print "Hello World!" to the screen. What you've done here is run the Python application with an argument -- the name of a file, in this case "hello.py". Python knows that when you give it a file name as an argument, it should execute the contents of the provided file. You get the same result as if you typed<br />
<br />
<pre><br />
print("Hello World!")<br />
</pre><br />
<br />
at a Python prompt and press enter.<br />
<br />
=== Success ===<br />
<br />
You created and ran your first Python script!<br />
<br />
* When you run the <code>python</code> command by itself, you start a Python prompt. You can execute Python code interactively at that prompt.<br />
* When you run the <code>python</code> command with a file name as an argument, Python executes the Python code in that file.<br />
<br />
[[File:Champagne.png|100px]][[File:Party.png|125px]]<br />
<br />
[[Category:CDSW]][[Category:Shared Pages]]</div>Ddaileyhttps://wiki.communitydata.science/index.php?title=MacOS_terminal_navigation&diff=185718MacOS terminal navigation2020-01-16T19:37:09Z<p>Ddailey: </p>
<hr />
<div>[[File:Utilities-terminal.png|200px]]<br />
<br />
== Practice navigating from the terminal ==<br />
<br />
The filesystem on your computer is like a tree made up of folders (also called "directories") and files. The filesystem has a root directory called <tt>/</tt>, and everything on your computer lives in subdirectories of this root directory.<br />
<br />
We often navigate the filesystem graphically by clicking on graphical folders. We can do the exact same navigation from the terminal.<br />
<br />
There are three commands that we'll be using in the terminal to navigate the filesystem on your computer:<br />
* <code>ls</code><br />
* <code>pwd</code><br />
* <code>cd</code><br />
<br />
<code>ls</code> lists the contents of a directory.<br /><br />
<code>pwd</code> gives the full directory path to your current directory.<br /><br />
<code>cd</code> moves you into a new directory (it stands for "change directory").<br />
<br />
Let's practice using these commands.<br />
<br />
===Open a terminal===<br />
<br />
You can find the Terminal application through Spotlight, or navigate to Applications/Utilities/Terminal.<br />
If you are using Anaconda Navigator, you can open terminal clicking on the play arrow button in the Environments -> base(root) window. <br />
<br />
===Practice using <code>ls</code>, <code>pwd</code>, and <code>cd</code>===<br />
(that's an l the letter, not the number 1)<br />
<br />
Type each of these commands and hit enter:<br />
<br />
<pre>ls</pre><br />
This lists all the files in your current directory.<br />
<br />
<br /><br />
<br />
<pre>pwd</pre><br />
This displays the full directory path to your current directory. (It's stands for "print working directory.")<br />
<br />
<br /><br />
<br />
<pre>cd /</pre><br />
This will change you into the <code>/</code> root directory.<br />
<br />
<br /><br />
<br />
<pre>ls</pre><br />
This lists the contents of the <code>/</code> root directory.<br />
<br />
<br /><br />
<br />
<pre>cd Users</pre><br />
This will change you into the <code>Users</code> subdirectory of the <code>/</code> root directory. <br />
<br />
<br /><br />
<br />
<pre>ls</pre><br />
You should see a list of all the files in <code>/Users</code>, including the directory for your username. The directory for your username (e.g. <tt>/Users/Jessica</tt> is often called your "home directory".<br />
<br />
<br /><br />
<br />
<pre>pwd</pre><br />
This displays the full directory path to your current directory, <code>/Users</code>.<br />
<br />
<br /><br />
<br />
<pre>cd ..</pre><br />
<code>..</code> means "parent directory", so this command moved you up to the parent directory. You were in <code>/Users</code>, so now you are in <code>/</code>, the root directory.<br />
<br />
<br /><br />
<br />
<pre>ls</pre><br />
This lists the contents of the root directory, confirming where you are.<br />
<br />
If you want to get back to your home directory, you can do:<br />
<br />
<pre>cd Users</pre><br />
<br />
<pre>cd YOURNAME</pre><br />
<br />
where YOURNAME is the name of your User directory.<br />
<br />
One helpful tip is that you can start typing a directory, then hit the <code>TAB</code> key and the terminal will autocomplete it.<br />
<br />
===Tips===<br />
<br />
* You can use Tab to auto-complete directory and file names. So from inside the root directory <tt>/</tt>, if you type <code>cd Us</code> and hit Tab, the terminal will auto-complete the directory name, and you can then hit enter to change into the <code>/Users</code> directory.<br />
* The terminal maintains a command history. You can use the up arrow to cycle through old commands.<br />
<br />
===Check your understanding===<br />
<br />
Answer these questions. Experiment at the terminal prompt if you need to! If you aren't sure about an answer, ask a helper.<br />
<br />
# What directory are you in after starting a new terminal prompt?<br />
# After starting a new terminal prompt, how would you get to the root directory?<br />
# How do you check what files and directories are in your current working directory?<br />
# If you are in directory <tt>/Users</tt>, and you want to get to <tt>/Users/jesstess/projects</tt>, how would you do that?<br />
# What are 2 ways to avoid typing out a full navigation command? (hint: one requires that you've run the command before)<br />
# What is the difference between a terminal prompt and a Python prompt?<br />
<br />
===Success!===<br />
<br />
You've practiced using <code>ls</code>, <code>pwd</code>, and <code>cd</code> to navigate your computer's filesystem from the terminal.<br />
<br />
[[File:Champagne.png|100px]][[File:Party.png|125px]]<br />
<br />
[[Category:CDSW]][[Category:Shared Pages]]</div>Ddaileyhttps://wiki.communitydata.science/index.php?title=Python_in_Jupyter&diff=185668Python in Jupyter2020-01-16T07:58:03Z<p>Ddailey: /* Download and start your text editor */</p>
<hr />
<div>We are going to practice writing and running Python programs (often called "scripts").<br />
<br />
TODO:<br />
* Download a sample notebook<br />
* Make sure the notebook is in your desktop (this keeps things simple)<br />
* Open the notebook in jupyter tab in browser.<br />
* Notebook itself should encourage them to run some cells.<br />
* Terminal navigation instructions below should be updated to work for MacOS and Windows<br />
* [[Windows terminal navigation|terminal navigation on Windows]] and [[MacOS_terminal_navigation|terminal navigation on Mac]] instructions should be checked/updated, too.<br />
<br />
<br />
===Download and start your text editor ===<br />
[[File:Anaconda home window.png|frameless|400px]]<br />
<br />
# Launch Anaconda Navigator<br />
# Find the '''"VSCode"''' application in the Anaconda Navigator '''"Home"''' window. If it is not yet installed, click "Install" (this may take a few minutes)<br />
# Launch the VSCode text editor.<br />
<br />
===Write and save a short Python script===<br />
<br />
# Click "New file" to start a new, blank text file.<br />
# Add the following line to your new text file:<br />
<br />
<pre><br />
print("Hello World!")<br />
</pre><br />
<br />
# Save the script as <code>hello.py</code> in your Desktop directory. The <code>.py</code> extension indicates that this file contains Python code.<br />
<br />
=== Navigate to the script in your terminal ===<br />
<br />
# Start a new terminal prompt. See the [[Windows terminal navigation|terminal navigation on Windows]] or [[MacOS_terminal_navigation|terminal navigation on Mac]] instructions for the steps to do this. Recall that on Windows a terminal prompt will look like <code>C:\</code> and a Python prompt will look like <code>>>></code>. Make sure you are at a terminal prompt and not a Python prompt; if you are at a Python prompt, you can type <code>exit()</code> on a line by itself and then press enter to exit Python and return to a terminal prompt.<br />
# Navigate to your Desktop directory from a PowerShell terminal prompt, using the <code>ls</code> and <code>cd</code> commands. See the [[Windows terminal navigation|terminal navigation on Windows]] instructions for a refresher on using these commands. Don't hesitate to get help from a mentor on this step if you need it -- it's a new way of navigating around your computer, so it may be unintuitive at first!<br />
<br />
=== Run the script ===<br />
# Once you are in your Desktop directory, you'll see <code>hello.py</code> in the output of <code>ls</code>.<br />
# Type<br />
<br />
<pre><br />
python hello.py<br />
</pre><br />
<br />
and press enter. Doing this will cause Python to execute the contents of that script -- it should print "Hello World!" to the screen. What you've done here is run the Python application with an argument -- the name of a file, in this case "hello.py". Python knows that when you give it a file name as an argument, it should execute the contents of the provided file. You get the same result as if you typed<br />
<br />
<pre><br />
print("Hello World!")<br />
</pre><br />
<br />
at a Python prompt and press enter.<br />
<br />
=== Success ===<br />
<br />
You created and ran your first Python script!<br />
<br />
* When you run the <code>python</code> command by itself, you start a Python prompt. You can execute Python code interactively at that prompt.<br />
* When you run the <code>python</code> command with a file name as an argument, Python executes the Python code in that file.<br />
<br />
[[File:Champagne.png|100px]][[File:Party.png|125px]]<br />
<br />
[[Category:CDSW]][[Category:Shared Pages]]</div>Ddaileyhttps://wiki.communitydata.science/index.php?title=Python_in_Jupyter&diff=185666Python in Jupyter2020-01-16T07:57:16Z<p>Ddailey: </p>
<hr />
<div>We are going to practice writing and running Python programs (often called "scripts").<br />
<br />
TODO:<br />
* Download a sample notebook<br />
* Make sure the notebook is in your desktop (this keeps things simple)<br />
* Open the notebook in jupyter tab in browser.<br />
* Notebook itself should encourage them to run some cells.<br />
* Terminal navigation instructions below should be updated to work for MacOS and Windows<br />
* [[Windows terminal navigation|terminal navigation on Windows]] and [[MacOS_terminal_navigation|terminal navigation on Mac]] instructions should be checked/updated, too.<br />
<br />
<br />
===Download and start your text editor ===<br />
[[File:Anaconda home window.png|frameless|400px]]<br />
<br />
# Launch Anaconda Navigator<br />
# Find the "VSCode" application in the Anaconda Navigator "Home" window. If it is not yet installed, click "Install" (this may take a few minutes)<br />
# Launch the VSCode text editor.<br />
<br />
===Write and save a short Python script===<br />
<br />
# Click "New file" to start a new, blank text file.<br />
# Add the following line to your new text file:<br />
<br />
<pre><br />
print("Hello World!")<br />
</pre><br />
<br />
# Save the script as <code>hello.py</code> in your Desktop directory. The <code>.py</code> extension indicates that this file contains Python code.<br />
<br />
=== Navigate to the script in your terminal ===<br />
<br />
# Start a new terminal prompt. See the [[Windows terminal navigation|terminal navigation on Windows]] or [[MacOS_terminal_navigation|terminal navigation on Mac]] instructions for the steps to do this. Recall that on Windows a terminal prompt will look like <code>C:\</code> and a Python prompt will look like <code>>>></code>. Make sure you are at a terminal prompt and not a Python prompt; if you are at a Python prompt, you can type <code>exit()</code> on a line by itself and then press enter to exit Python and return to a terminal prompt.<br />
# Navigate to your Desktop directory from a PowerShell terminal prompt, using the <code>ls</code> and <code>cd</code> commands. See the [[Windows terminal navigation|terminal navigation on Windows]] instructions for a refresher on using these commands. Don't hesitate to get help from a mentor on this step if you need it -- it's a new way of navigating around your computer, so it may be unintuitive at first!<br />
<br />
=== Run the script ===<br />
# Once you are in your Desktop directory, you'll see <code>hello.py</code> in the output of <code>ls</code>.<br />
# Type<br />
<br />
<pre><br />
python hello.py<br />
</pre><br />
<br />
and press enter. Doing this will cause Python to execute the contents of that script -- it should print "Hello World!" to the screen. What you've done here is run the Python application with an argument -- the name of a file, in this case "hello.py". Python knows that when you give it a file name as an argument, it should execute the contents of the provided file. You get the same result as if you typed<br />
<br />
<pre><br />
print("Hello World!")<br />
</pre><br />
<br />
at a Python prompt and press enter.<br />
<br />
=== Success ===<br />
<br />
You created and ran your first Python script!<br />
<br />
* When you run the <code>python</code> command by itself, you start a Python prompt. You can execute Python code interactively at that prompt.<br />
* When you run the <code>python</code> command with a file name as an argument, Python executes the Python code in that file.<br />
<br />
[[File:Champagne.png|100px]][[File:Party.png|125px]]<br />
<br />
[[Category:CDSW]][[Category:Shared Pages]]</div>Ddaileyhttps://wiki.communitydata.science/index.php?title=Python_in_Jupyter&diff=185664Python in Jupyter2020-01-16T07:57:02Z<p>Ddailey: </p>
<hr />
<div>We are going to practice writing and running Python programs (often called "scripts").<br />
<br />
TODO:<br />
* Download a sample notebook<br />
* Make sure the notebook is in your desktop (this keeps things simple)<br />
* Open the notebook in jupyter tab in browser.<br />
* Notebook itself should encourage them to run some cells.<br />
* Terminal navigation instructions below should be updated to work for MacOS and Windows<br />
* [[Windows terminal navigation|terminal navigation on Windows]] and [[MacOS_terminal_navigation|terminal navigation on Mac]] instructions should be checked/updated, too.<br />
<br />
<br />
===Download and start your text editor ===<br />
[[File:File:Anaconda home window.png|frameless|400px]]<br />
<br />
# Launch Anaconda Navigator<br />
# Find the "VSCode" application in the Anaconda Navigator "Home" window. If it is not yet installed, click "Install" (this may take a few minutes)<br />
# Launch the VSCode text editor.<br />
<br />
===Write and save a short Python script===<br />
<br />
# Click "New file" to start a new, blank text file.<br />
# Add the following line to your new text file:<br />
<br />
<pre><br />
print("Hello World!")<br />
</pre><br />
<br />
# Save the script as <code>hello.py</code> in your Desktop directory. The <code>.py</code> extension indicates that this file contains Python code.<br />
<br />
=== Navigate to the script in your terminal ===<br />
<br />
# Start a new terminal prompt. See the [[Windows terminal navigation|terminal navigation on Windows]] or [[MacOS_terminal_navigation|terminal navigation on Mac]] instructions for the steps to do this. Recall that on Windows a terminal prompt will look like <code>C:\</code> and a Python prompt will look like <code>>>></code>. Make sure you are at a terminal prompt and not a Python prompt; if you are at a Python prompt, you can type <code>exit()</code> on a line by itself and then press enter to exit Python and return to a terminal prompt.<br />
# Navigate to your Desktop directory from a PowerShell terminal prompt, using the <code>ls</code> and <code>cd</code> commands. See the [[Windows terminal navigation|terminal navigation on Windows]] instructions for a refresher on using these commands. Don't hesitate to get help from a mentor on this step if you need it -- it's a new way of navigating around your computer, so it may be unintuitive at first!<br />
<br />
=== Run the script ===<br />
# Once you are in your Desktop directory, you'll see <code>hello.py</code> in the output of <code>ls</code>.<br />
# Type<br />
<br />
<pre><br />
python hello.py<br />
</pre><br />
<br />
and press enter. Doing this will cause Python to execute the contents of that script -- it should print "Hello World!" to the screen. What you've done here is run the Python application with an argument -- the name of a file, in this case "hello.py". Python knows that when you give it a file name as an argument, it should execute the contents of the provided file. You get the same result as if you typed<br />
<br />
<pre><br />
print("Hello World!")<br />
</pre><br />
<br />
at a Python prompt and press enter.<br />
<br />
=== Success ===<br />
<br />
You created and ran your first Python script!<br />
<br />
* When you run the <code>python</code> command by itself, you start a Python prompt. You can execute Python code interactively at that prompt.<br />
* When you run the <code>python</code> command with a file name as an argument, Python executes the Python code in that file.<br />
<br />
[[File:Champagne.png|100px]][[File:Party.png|125px]]<br />
<br />
[[Category:CDSW]][[Category:Shared Pages]]</div>Ddaileyhttps://wiki.communitydata.science/index.php?title=File:Anaconda_home_window.png&diff=185661File:Anaconda home window.png2020-01-16T07:54:09Z<p>Ddailey: A screen shot of the "home" window that shows VS Code (the program we want CDSW participants to download).</p>
<hr />
<div>== Summary ==<br />
A screen shot of the "home" window that shows VS Code (the program we want CDSW participants to download).</div>Ddaileyhttps://wiki.communitydata.science/index.php?title=Python_in_Jupyter&diff=185658Python in Jupyter2020-01-16T07:49:39Z<p>Ddailey: /* Download and start your text editor */</p>
<hr />
<div>We are going to practice writing and running Python programs (often called "scripts").<br />
<br />
TODO:<br />
* Download a sample notebook<br />
* Make sure the notebook is in your desktop (this keeps things simple)<br />
* Open the notebook in jupyter tab in browser.<br />
* Notebook itself should encourage them to run some cells.<br />
* Terminal navigation instructions below should be updated to work for MacOS and Windows<br />
* [[Windows terminal navigation|terminal navigation on Windows]] and [[MacOS_terminal_navigation|terminal navigation on Mac]] instructions should be checked/updated, too.<br />
<br />
<br />
===Download and start your text editor ===<br />
[[File:Macos-anaconda-nav-hub.png|frameless|400px]]<br />
<br />
# Launch Anaconda Navigator<br />
# Find the "VSCode" application in the Anaconda Navigator "Home" window. If it is not yet installed, click "Install" (this may take a few minutes)<br />
# Launch the VSCode text editor.<br />
<br />
===Write and save a short Python script===<br />
<br />
# Click "New file" to start a new, blank text file.<br />
# Add the following line to your new text file:<br />
<br />
<pre><br />
print("Hello World!")<br />
</pre><br />
<br />
# Save the script as <code>hello.py</code> in your Desktop directory. The <code>.py</code> extension indicates that this file contains Python code.<br />
<br />
=== Navigate to the script in your terminal ===<br />
<br />
# Start a new terminal prompt. See the [[Windows terminal navigation|terminal navigation on Windows]] or [[MacOS_terminal_navigation|terminal navigation on Mac]] instructions for the steps to do this. Recall that on Windows a terminal prompt will look like <code>C:\</code> and a Python prompt will look like <code>>>></code>. Make sure you are at a terminal prompt and not a Python prompt; if you are at a Python prompt, you can type <code>exit()</code> on a line by itself and then press enter to exit Python and return to a terminal prompt.<br />
# Navigate to your Desktop directory from a PowerShell terminal prompt, using the <code>ls</code> and <code>cd</code> commands. See the [[Windows terminal navigation|terminal navigation on Windows]] instructions for a refresher on using these commands. Don't hesitate to get help from a mentor on this step if you need it -- it's a new way of navigating around your computer, so it may be unintuitive at first!<br />
<br />
=== Run the script ===<br />
# Once you are in your Desktop directory, you'll see <code>hello.py</code> in the output of <code>ls</code>.<br />
# Type<br />
<br />
<pre><br />
python hello.py<br />
</pre><br />
<br />
and press enter. Doing this will cause Python to execute the contents of that script -- it should print "Hello World!" to the screen. What you've done here is run the Python application with an argument -- the name of a file, in this case "hello.py". Python knows that when you give it a file name as an argument, it should execute the contents of the provided file. You get the same result as if you typed<br />
<br />
<pre><br />
print("Hello World!")<br />
</pre><br />
<br />
at a Python prompt and press enter.<br />
<br />
=== Success ===<br />
<br />
You created and ran your first Python script!<br />
<br />
* When you run the <code>python</code> command by itself, you start a Python prompt. You can execute Python code interactively at that prompt.<br />
* When you run the <code>python</code> command with a file name as an argument, Python executes the Python code in that file.<br />
<br />
[[File:Champagne.png|100px]][[File:Party.png|125px]]<br />
<br />
[[Category:CDSW]][[Category:Shared Pages]]</div>Ddaileyhttps://wiki.communitydata.science/index.php?title=OSX_set_up_Python_(Anaconda)&diff=185650OSX set up Python (Anaconda)2020-01-16T07:08:36Z<p>Ddailey: </p>
<hr />
<div>== Download and install Python ==<br />
<br />
We're going to be installing Python using a software collection that includes Python. The collection is called '''Anaconda'''. Anaconda includes the Python programming language and a bunch of different pieces of software that are useful for data science and analysis. Although the collection includes all free software, it is put together by a commercial company called '''Continuum Analytics'''.<br />
<br />
'''Note:''' Even if you already have a version of Python on your computer, we suggest you follow these instructions and download Anaconda. This will help ensure that you can follow along during our in-class activities, and will make it easier for mentors to help you if you get stuck on something.<br />
<br />
=== Download option #1 ===<br />
<br />
<font size="+1">Try to download the installer from [https://communitydata.science/~mako/Anaconda3-2019.10-MacOSX-x86_64.pkg this file which contains Anaconda and Python 3.7 for MacOS].</font><br />
<br />
=== Download option #2 ===<br />
If option 1 above doesn't work for any reason, download the Python 3.7 option from [https://www.anaconda.com/distribution/#download-section Anaconda's website]. If necessary, scroll down to the "Anaconda 2019.10 for macOS Installer" section. <br />
<br />
=== Installation ===<br />
<br />
{{Notice|If you are on MacOS 10.15 (Catalina), '''you must follow an additional step'''. If you don't, Anaconda won't work quite right! }}<br />
<br />
To install Anaconda, simply open the package and follow the prompts. You may be asked to enter your password by Package Installer.<br />
<br />
<gallery><br />
file:Macos-anaconda-37.png|Make sure you download the version for Python3|alt=Dialog box confirming that the downloaded file is called "Anaconda3-2019-MacOSX-x86_64.pkg<br />
file:Macos-anaconda-hello.png|Opening the file with Package Installer will guide you through the setup process|alt=Package Installer window greeting the user<br />
file:Macos-anaconda-auth.png|You may be prompted for your password|alt=Package Installer prompting the user for a password<br />
File:Macos-anaconda-installing.png|Package Installer will install Anaconda3|alt=Package installer showing progress through the installation<br />
</gallery><br />
<br />
=== Install notes ===<br />
<br />
*If you get stuck during the install process, ask a neighbor or raise your hand for help. [http://docs.continuum.io/anaconda/install.html#mac-install These instructions] may also be helpful. <br />
<br />
* At the end of the installer, you may be prompted if you'd like to send the installation package to the trash. Doing so won't damage the installation and will free up ~600MB of disk space on your computer.<br />
<br />
[[File:Macos-anaconda-self-delete.png|thumb|none|200px|Prompt from Package Installer asking if it is OK to trash the installation package.]]<br />
<br />
* If you are using MacOS 10.15 (Catalina) or above, you will need to configure the system to recognize Anaconda. To do so, open Terminal.app (either using Command-space or opening '''Applications > Utilities > Terminal.app''' and entering the following:<br />
<br />
<nowiki>/opt/anaconda3/bin/conda init zsh<br />
</nowiki><br />
<br />
You should end up with something like this:<br />
<br />
[[file:Macos-conda-zsh.png|thumb|none|alt=A terminal window showing the result of configuring Conda and MacOS Catalina.]]<br />
<br />
Quit Terminal (either with Command-Q or the menu option '''Terminal > Quit Terminal''').<br />
<br />
== Test your Python install ==<br />
<br />
To use Anaconda on MacOS, you will primarily use the Anaconda Navigator; It lets you manage the installed python tools, create custom setups, and launch tools like Jupyter. <br />
<br />
The easiest way to launch the Anaconda Navigator is from inside the Applications folder:<br />
<br />
[[File:Macos-anaconda-navigator.png|200px]]<br />
<br />
The navigator will start up and greet you with a list of installed and available tools:<br />
<br />
[[File:Macos-anaconda-nav-hub.png|frameless|400px]]<br />
<br />
From the left hand side, choose '''Environments''', then choose the small "play" button. A menu will appear; choose the option 'Open with Python'. This will open an interactive Python window that we're going to use to test Python out with.<br />
<br />
[[File:Macos-anaconda-environments.png|frameless|400px]]<br />
<br />
Enter into the window '''print("Hello, World!")'''. You should see the text '''"Hello, World!"''' echoed back at you. <br />
Enter into the window '''<tt>exit()</tt>''' and you'll shut down the Python session and get a helpful '''<tt>[Process Completed]</tt>''' from the terminal, telling you your session is over.<br />
<br />
[[File:Macos-conda-python-hello.png|frameless|400px]]<br />
<br />
Press '''Command-Q''' or choose '''Terminal > Quit Terminal''' from the menu to close Terminal.<br />
<br />
Success! You've gotten Anaconda and Python working on your Mac!<br />
<br />
== Success! ==<br />
<br />
You have installed and configured Python. You can move on to the [[CDSW/Day_0_setup_and_tutorial|next step]].<br />
<br />
[[Category:CDSW]]</div>Ddaileyhttps://wiki.communitydata.science/index.php?title=OSX_set_up_Python_(Anaconda)&diff=185649OSX set up Python (Anaconda)2020-01-16T07:07:12Z<p>Ddailey: </p>
<hr />
<div>== Download and install Python ==<br />
<br />
We're going to be installing Python using a software collection that includes Python. The collection is called '''Anaconda'''. Anaconda includes the Python programming language and a bunch of different pieces of software that are useful for data science and analysis. Although the collection includes all free software, it is put together by a commercial company called '''Continuum Analytics'''.<br />
<br />
'''Note:''' Even if you already have a version of Python on your computer, we suggest you follow these instructions and download Anaconda. This will help ensure that you can follow along during our in-class activities, and will make it easier for mentors to help you if you get stuck on something.<br />
<br />
=== Download option #1 ===<br />
<br />
<font size="+1">Try to download the installer from [https://communitydata.science/~mako/Anaconda3-2019.10-MacOSX-x86_64.pkg this file which contains Anaconda and Python 3.7 for MacOS].</font><br />
<br />
=== Download option #2 ===<br />
If option 1 above doesn't work for any reason, download the Python 3.7 option from [https://www.anaconda.com/distribution/#download-section Anaconda's website]. If necessary, scroll down to the "Anaconda 2019.10 for macOS Installer" section. <br />
<br />
=== Installation ===<br />
<br />
{{Notice|If you are on MacOS 10.15 (Catalina), '''you must follow an additional step'''. If you don't, Anaconda won't work quite right! }}<br />
<br />
To install Anaconda, simply open the package and follow the prompts. You may be asked to enter your password by Package Installer.<br />
<br />
<gallery><br />
file:Macos-anaconda-37.png|Make sure you download the version for Python3|alt=Dialog box confirming that the downloaded file is called "Anaconda3-2019-MacOSX-x86_64.pkg<br />
file:Macos-anaconda-hello.png|Opening the file with Package Installer will guide you through the setup process|alt=Package Installer window greeting the user<br />
file:Macos-anaconda-auth.png|You may be prompted for your password|alt=Package Installer prompting the user for a password<br />
File:Macos-anaconda-installing.png|Package Installer will install Anaconda3|alt=Package installer showing progress through the installation<br />
</gallery><br />
<br />
=== Install notes ===<br />
<br />
*If you get stuck during the install process, ask a neighbor or raise your hand for help. [http://docs.continuum.io/anaconda/install.html#mac-install These instructions] may also be helpful. <br />
<br />
* At the end of the installer, you may be prompted if you'd like to send the installation package to the trash. Doing so won't damage the installation and will free up ~600MB of disk space on your computer.<br />
<br />
[[File:Macos-anaconda-self-delete.png|thumb|none|200px|Prompt from Package Installer asking if it is OK to trash the installation package.]]<br />
<br />
* If you are using MacOS 10.15 (Catalina) or above, you will need to configure the system to recognize Anaconda. To do so, open Terminal.app (either using Command-space or opening '''Applications > Utilities > Terminal.app''' and entering the following:<br />
<br />
<nowiki>/opt/anaconda3/bin/conda init zsh<br />
</nowiki><br />
<br />
You should end up with something like this:<br />
<br />
[[file:Macos-conda-zsh.png|thumb|none|alt=A terminal window showing the result of configuring Conda and MacOS Catalina.]]<br />
<br />
Quit Terminal (either with Command-Q or the menu option '''Terminal > Quit Terminal''').<br />
<br />
== Test your Python install ==<br />
<br />
To use Anaconda on MacOS, you will primarily use the Anaconda Navigator; It lets you manage the installed python tools, create custom setups, and launch tools like Jupyter. <br />
<br />
The easiest way to launch the Anaconda Navigator is from inside the Applications folder:<br />
<br />
[[File:Macos-anaconda-navigator.png|200px]]<br />
<br />
The navigator will start up and greet you with a list of installed and available tools:<br />
<br />
[[File:Macos-anaconda-nav-hub.png|frameless|400px]]<br />
<br />
From the left hand side, choose '''Environments''', then choose the small "play" button. A menu will appear; choose the option 'Open with Python'. This will open an interactive Python window that we're going to use to test Python out with.<br />
<br />
[[File:Macos-anaconda-environments.png|frameless|400px]]<br />
<br />
Enter into the window '''print("Hello, World!")'''. You should see the text '''"Hello, World!"''' echoed back at you. <br />
Enter into the window '''<tt>exit()</tt>''' and you'll shut down the Python session and get a helpful <tt>[Process Completed]</tt> from the terminal, telling you your session is over.<br />
<br />
[[File:Macos-conda-python-hello.png|frameless|400px]]<br />
<br />
Press '''Command-Q''' or choose '''Terminal > Quit Terminal''' from the menu to close Terminal.<br />
<br />
Success! You've gotten Anaconda and Python working on your Mac!<br />
<br />
== Success! ==<br />
<br />
You have installed and configured Python. You can move on to the [[CDSW/Day_0_setup_and_tutorial|next step]].<br />
<br />
[[Category:CDSW]]</div>Ddaileyhttps://wiki.communitydata.science/index.php?title=OSX_set_up_Python_(Anaconda)&diff=185645OSX set up Python (Anaconda)2020-01-16T06:21:20Z<p>Ddailey: </p>
<hr />
<div>== Download and install Python ==<br />
<br />
We're going to be installing Python using a software collection that includes Python. The collection is called '''Anaconda'''. Anaconda includes the Python programming language and a bunch of different pieces of software that are useful for data science and analysis. Although the collection includes all free software, it is put together by a commercial company called '''Continuum Analytics'''.<br />
<br />
'''Note:''' Even if you already have a version of Python on your computer, we suggest you follow these instructions and download Anaconda. This will help ensure that you can follow along during our in-class activities, and will make it easier for mentors to help you if you get stuck on something.<br />
<br />
=== Download option #1 ===<br />
<br />
<font size="+1">Try to download the installer from [https://communitydata.science/~mako/Anaconda3-2019.10-MacOSX-x86_64.pkg this file which contains Anaconda and Python 3.7 for MacOS].</font><br />
<br />
=== Download option #2 ===<br />
If option 1 above doesn't work for any reason, download the Python 3.7 option from [https://www.anaconda.com/distribution/#download-section Anaconda's website]. If necessary, scroll down to the "Anaconda 2019.10 for macOS Installer" section. <br />
<br />
=== Installation ===<br />
<br />
{{Notice|If you are on MacOS 10.15 (Catalina), '''you must follow an additional step'''. If you don't, Anaconda won't work quite right! }}<br />
<br />
To install Anaconda, simply open the package and follow the prompts. You may be asked to enter your password by Package Installer.<br />
<br />
<gallery><br />
file:Macos-anaconda-37.png|Make sure you download the version for Python3|alt=Dialog box confirming that the downloaded file is called "Anaconda3-2019-MacOSX-x86_64.pkg<br />
file:Macos-anaconda-hello.png|Opening the file with Package Installer will guide you through the setup process|alt=Package Installer window greeting the user<br />
file:Macos-anaconda-auth.png|You may be prompted for your password|alt=Package Installer prompting the user for a password<br />
File:Macos-anaconda-installing.png|Package Installer will install Anaconda3|alt=Package installer showing progress through the installation<br />
</gallery><br />
<br />
=== Install notes ===<br />
<br />
*If you get stuck during the install process, ask a neighbor or raise your hand for help. [http://docs.continuum.io/anaconda/install.html#mac-install These instructions] may also be helpful. <br />
<br />
* At the end of the installer, you may be prompted if you'd like to send the installation package to the trash. Doing so won't damage the installation and will free up ~600MB of disk space on your computer.<br />
<br />
[[File:Macos-anaconda-self-delete.png|thumb|none|200px|Prompt from Package Installer asking if it is OK to trash the installation package.]]<br />
<br />
* If you are using MacOS 10.15 (Catalina) or above, you will need to configure the system to recognize Anaconda. To do so, open Terminal.app (either using Command-space or opening '''Applications > Utilities > Terminal.app''' and entering the following:<br />
<br />
<nowiki>/opt/anaconda3/bin/conda init zsh<br />
</nowiki><br />
<br />
You should end up with something like this:<br />
<br />
[[file:Macos-conda-zsh.png|thumb|none|alt=A terminal window showing the result of configuring Conda and MacOS Catalina.]]<br />
<br />
Quit Terminal (either with Command-Q or the menu option '''Terminal > Quit Terminal''').<br />
<br />
== Test your Python install ==<br />
<br />
To use Anaconda on MacOS, you will primarily use the Anaconda Navigator; It lets you manage the installed python tools, create custom setups, and launch tools like Jupyter. <br />
<br />
The easiest way to launch the Anaconda Navigator is from inside the Applications folder:<br />
<br />
[[File:Macos-anaconda-navigator.png|200px]]<br />
<br />
The navigator will start up and greet you with a list of installed and available tools:<br />
<br />
[[File:Macos-anaconda-nav-hub.png|frameless|400px]]<br />
<br />
From the left hand side, choose '''Environments''', then choose the small "play" button. A menu will appear; choose the option 'Open with Python'. This will open an interactive Python window that we're going to use to test Python out with.<br />
<br />
[[File:Macos-anaconda-environments.png|frameless|400px]]<br />
<br />
Enter into the window <tt>print("Hello, World!")</tt>. You should see the text "<tt>Hello, World!</tt>" echoed back at you. Enter <tt>exit()</tt> and you'll shut down the Python session and get a helpful <tt>[Process Completed]</tt> from the terminal, telling you your session is over.<br />
<br />
[[File:Macos-conda-python-hello.png|frameless|400px]]<br />
<br />
Press Command-Q or choose '''Terminal > Quit Terminal''' from the menu to close Terminal.<br />
<br />
Success! You've gotten Anaconda and Python working on your Mac!<br />
<br />
== Success! ==<br />
<br />
You have installed and configured Python. You can move on to the [[CDSW/Day_0_setup_and_tutorial|next step]].<br />
<br />
[[Category:CDSW]]</div>Ddaileyhttps://wiki.communitydata.science/index.php?title=Community_Data_Science_Workshops_(Winter_2020)&diff=185639Community Data Science Workshops (Winter 2020)2020-01-16T04:52:19Z<p>Ddailey: </p>
<hr />
<div><div style="float:right;"><br />
<div style="margin-left:20px; padding-left:1em; text-align: center;"><br />
{| class="infobox" style="width: 600px; background-color:#ADC2E4"<br />
| colspan="2" | '''<div class="plainlinks" style="font-weight:bold; font-size:1.5em; text-align: center;">Registration for Winter 2020 is now closed</div>''' <br />
<br />
<div class="plainlinks" style="margin-left:0em; text-align: center;"><br />
Unfortunately, registration closed on '''January 13'''.<br />
<br />
''Have experience to share? [https://docs.google.com/forms/d/1ycV3HsWV_zaMWzuSSxyI4-_ye1NltVFFUtTbX3O6q6M/viewform Sign up to be a mentor].'' ''If you would like to be notified of future workshops, subscribe to [https://communitydata.science/mailman3/postorius/lists/cdsw-announce.communitydata.science/ our announcement email list].''<br />
</div><br />
|}<br />
</div><br />
[[Image:Cdsw combo images-1.jpg|thumb|600px|[[Community Data Science Workshops/Photos|More photos from past workshops]].]]<br />
<div style="clear: both;"></div><br />
</div><br />
<br />
The '''Community Data Science Workshops in Winter 2020''' are a series of project-based workshops being held at the University of Washington for anyone interested in learning how to use programming and data science tools to ask and answer questions about online communities like [http://en.wikipedia.org/ Wikipedia], [http://twitter.com Twitter], [[:w:Free software|free and open source software, and]] civic media.<br />
<br />
The Winter 2020 workshop series will take place over three Saturdays (plus a short Friday night setup session):<br />
<br />
* Friday, January 17th (6-9pm)<br />
* Saturday, January 18th (9:45-4pm)<br />
* Saturday, February 1st (9:45-4pm)<br />
* Saturday, February 15th (9:45-4pm)<br />
<br />
'''These workshops are for people with absolutely no previous programming experience''' and they bring together researchers and academics with participants and leaders in online communities. The workshops are run entirely by volunteers and are entirely free of charge for participants, generously sponsored by the [http://www.com.washington.edu/ UW Department of Communication] and the [http://escience.washington.edu/ eScience Institute]. Participants from outside UW are encouraged to apply.<br />
<br />
Our goal is that, after the three workshops, participants will be able to use data to produce numbers, hypothesis tests, tables, and graphical visualizations to answer questions like:<br />
<br />
* Are new contributors in Wikipedia this year sticking around longer or contributing more than people who joined last year?<br />
* Who are the most active or influential users of a particular Twitter hashtag?<br />
* Are people who join through a Wikipedia outreach event staying involved? How do they compare to people who decide to join the project outside of the event?<br />
<br />
We've run these workshops five times in 2014, 2015, and 2016 and [[CDSW|the curriculum we used for previous sessions is all online]].<br />
<br />
== Registration ==<br />
<br />
'''''Participants!''''' Unfortunately, the registration period is over. Sorry about that! This is our sixth set of workshops and we do hope to run more of these again in the future. You can find out about future workshops by signing up for [https://communitydata.science/mailman3/postorius/lists/cdsw-announce.communitydata.science/ our announcement mailing list].<br />
<br />
'''''Interested in being a mentor?''''' If you already have experience with Python, please consider helping out at the sessions as a mentor. Being a mentor will involve working with participants and talking them through the challenges they encounter in programming. No special preparation is required. And we'll feed you! Because we want to keep a very high mentor-to-student ratio, recruiting more mentors means we can accept more participants. If you're interested you can [https://forms.gle/6ZxxH77z2m18mhgo6 fill out this form] or email makohill@uw.edu. Also, thank you, thank you, thank you!<br />
<br />
== Schedule ==<br />
<br />
There will be a mandatory evening setup session '''6:00-9:00pm on Friday January 17''' and three workshops held from '''9:45am-4pm on three Saturdays (January 18 and February 1 and 15)'''. Each Saturday session will involve a period for lecture and technical demonstrations in the morning. This will be followed by a lunch graciously provided by the [http://escience.washington.edu/ eScience Institute at UW]. The rest of the day will be followed by group work on programming and data science projects supported by more experienced mentors.<br />
<br />
'''All sessions are interactive and involve you programming on your own and on your own laptop. Everybody attending should bring a laptop and a power cord so that they don't run out of battery.'''<br />
<br />
=== Session 0: Setup and Programming Tutorial (Friday January 17 evening)===<br />
<br />
Come to the '''[http://www.washington.edu/maps/#!/cmu Communications Building (CMU) 104]''' between 6:00 and 9:00pm. It's OK if you come a little late but you'll want to have as much time as you can to finish the setup and self-directed assignments so come as close to 6:00pm as you can. Most people will finish early but some people will definitely need the full 3 hours. It's hard to know in advance where problems will crop up so please come on time even if you are confident.<br />
<br />
:'''Time''': 6-9pm<br />
:'''Location''': '''[http://www.washington.edu/maps/#!/cmu Communications Building (CMU) 104]'''<br />
: '''Objectives''': During this session, mentors will help you:<br />
<br />
:: set up your development environment<br />
:: learn how to write and execute Python code in a Jupyter Notebook<br />
:: learn about printing and using Python as a calculator<br />
<br />
:'''Material''': <font size="+1">[[CDSW/Day 0 setup and tutorial|Click here for the the setup and tutorial material.]]</font><br />
<br />
'''Note''': Because we expect to hit the ground running on our first full day, we will meet to help participants get software installed and to work through a self-guided tutorial that will help ensure that everyone has the skills and vocabulary to start programming and learning when we meet the following morning.<br />
<br />
=== Session 1: Introduction to Programming (January 18) ===<br />
<br />
Come to '''[http://uw.edu/maps/?sav Savery Hall (SAV) 260] by 9:45am'''.<br />
Plan to be on UW campus by 9:45am (location TBD). You will need time to get settled and setup. We will start lecturing promptly at 10am. There will be coffee!<br />
<br />
: '''Time:''' 9:45am-4pm<br />
: '''Location:''' [http://uw.edu/maps/?sav Savery Hall (SAV)]<br />
<br />
: '''Schedule'''<br />
:: '''Morning, 10am-12:20 (SAV 260)''': [[CDSW/Day_1_lecture|A 2.5 hour lecture-based introduction to the Python programming language]]<br />
:: '''Lunch, 12:20-1pm (Savery Hall)''': We'll provide lunch (pizza!)<br />
:: '''Afternoon, 1pm-3:30pm (SAV 138, 139, 155, 156):''' Python practice through short projects (see below) on a variety of fun and practical topics:<br />
::* [[Baby_Names | Baby Names]]<br />
::* [[Learning Python | Learning Python]]<br />
:: '''Wrap-up, 3:30pm-4pm (SAV 260):''' Wrap-up, next steps, and upcoming opportunities for learning and practicing Python<br />
<br />
: '''Objectives''': Programming is an essential tool for data science and is useful for solving many other problems. The goal of this session will be to introduce programming in the [http://www.python.org/ Python programming language]. Each participant will leave having solved a real problem and will have built their first real programming project.<br />
<br />
<!--<br />
=== Session 2: Importing Data from web APIs (April 23) ===<br />
Come to '''[http://uw.edu/maps/?sav Savery Hall (SAV) 260] by 9:45am'''. You will need time to get settled and setup. We will start lecturing promptly at 10am. There will be coffee!<br />
<br />
: '''Time''': 9:45am-4pm<br />
<br />
: '''Location''': [http://uw.edu/maps/?sav Savery Hall (SAV)] <br />
<br />
: '''Schedule''':<br />
:: '''Morning: 10am-12:20 (SAV 260)''': [[CDSW/Day_2_Lecture|A 2.5 hour lecture-based introduction to the web programming and APIs]]<br />
:: '''Lunch: 12:20-1pm (Savery Hall downstairs hallway)''': We'll provide lunch (vegetarian Indian!)<br />
:: '''Afternoon: 1pm-3:30pm (SAV 138, 139, 155, 156)''': Web API practice through short projects (see below) on a variety of fun and practical topics:<br />
::* [[Community_Data_Science_Workshops_(Spring_2016)/Day_2_Projects/Twitter|Twitter]]<br />
::* [[Wikipedia (CDSW)|Wikipedia]]<br />
::* [[Yelp (CDSW)|Yelp]]<br />
:: '''Wrap-up: 3:30pm-4pm (SAV 260)''': Wrap-up, next steps, and upcoming opportunities for learning and practicing Python<br />
<br />
: '''Objectives''': An important step in doing data science is collecting data. The goal of this session will be to teach participants how to get data from the [https://en.wikipedia.org/wiki/Application_programming_interface public application programming interfaces] ("APIs") common to many social media and online communities. Although we will use the APIs provided by Wikipedia, Twitter, and Socrata in the session, the principles and techniques are common to many other online communities.<br />
<br />
: An outline for the lecture can be found [[CDSW/Day_2_lecture|here]] and a list of potential projects for the afternoon session are listed below:<br />
<br />
'''Important Note:''' If you plan to attend the Twitter afternoon session, you need to complete the [[Twitter authentication setup]] ''before'' the afternoon setup on Saturday. If you plan to complete the Yelp session, you need to complete the [[Yelp authentication setup]] instructions. There's no promise that we will be running these sessions this weekend unless there is demand but you will need to have done these if you want to attend the session.<br />
<br />
=== Session 3: Data Analysis and Visualization (May 7) ===<br />
Come to '''[http://uw.edu/maps/?sav Savery Hall (SAV) 260] by 9:45am'''. You will need time to get settled and setup. We will start lecturing promptly at 10am. There will be coffee!<br />
<br />
: '''Time''': 9:45am-4pm<br />
<br />
: '''Location:''' [http://uw.edu/maps/?sav Savery Hall (SAV) 260]<br />
<br />
: '''Schedule''':<br />
<br />
:: '''Morning, 10am-12:20 (SAV 260):''' [[CDSW/Day_3_Lecture|2.5 hour interactive lecture]]<br />
:: '''Lunch, 12:20-1pm (TBD):''' We'll provide lunch (TBD)<br />
:: '''Afternoon, 1pm-3:30pm (TBD): '''Web API practice through independent projects<br />
::* [[Harry Potter on Wikipedia|Visualization and analysis using Spreadsheets]]<br />
::* [[Matplotlib|Visualization using Python and Matplotlib]]<br />
::* [[Community_Data_Science_Workshops_(Spring_2016)/Day_3_Projects/Twitter|Analyzing data from Twitter]]<br />
::* [[Community_Data_Science_Workshops_(Spring_2016)/Day_3_Projects|Visualization and analysis of civic data from data.seattle.gov]]<br />
::* Independent projects working on issues of ''your'' choosing!<br />
:: '''Wrap-up, 3:30-4pm (SAV 260)<br />
<br />
: '''Objectives''': The goal of data science is to use data to answer questions. In our final session, we will use the Python skills we learned in the first session and the datasets we've created in the second to ask and answer common questions about the activity and health of online communities. We will focus on learning how to generate visualizations, create summary statistics, and test hypotheses.<br />
<br />
== Venue and Logistics ==<br />
<br />
=== What to bring ===<br />
# a '''laptop'''<br />
#* for '''Session 0''' make sure that you have about 1GB of space free so you can install Python and all the necessary other software<br />
#* for '''Sessions 1-3''' bring your laptop with Python set up<br />
# a '''power cord'''<br />
# a '''sense of adventure!'''<br />
<br />
=== Location ===<br />
[[File:Ulink-to-savery-hall.png|250px|thumb|right|15 mins from the UW Station to Savery Hall|link=https://tinyurl.com/hr3efyg]]<br />
<br />
For the first Friday setup session, please come to the '''Communications building''' [https://www.openstreetmap.org/export#map=18/47.65669/-122.30538 map]. The direction from the UW Link station is [https://tinyurl.com/jyrskxu here].<br />
<br />
For all the Saturday sessions, please meet at '''Savery Hall 260''' ([http://www.openstreetmap.org/export#map=17/47.65715/-122.30750 map]) on the '''the three Saturday mornings at 9:45'''. Unfortunately, most of the doors to Savery Hall are locked on weekends. The door on the '''west side of the building''' (i.e., the one nearest Kane Hall) should be open. <br />
<br />
'''[http://www.soundtransit.org/Rider-Guide/University-of-Washington-Station The UW Station] on Link is now open''' and Savery Hall is an easy walk on campus from the station. UW is also well served by buses and easily accessible by bicycle with the [https://en.wikipedia.org/wiki/Burke_Gilman_Trail Burke Gilman Trail]. Parking at UW is available but is not free. There is [https://www.washington.edu/facilities/transportation/commuterservices/parking/selfserve self-serve parking] as well as gatehouses that are staffed from 7am on Saturday and can issue you parking passes and point you to an appropriate lot. More details are on the [https://www.washington.edu/facilities/transportation/commuterservices/parking/daily UW Commuter Services website for Visitors and Guests].<br />
<br />
--><br />
<br />
=== Food ===<br />
<br />
Thanks to generous sponsorship by the [http://escience.washington.edu/ eScience Institute at UW], we will provide catered lunches during the Saturday sessions. Although we haven't figured out the menu, the food will all be vegetarian and there will be vegan and gluten free options. If the food we have doesn't doesn't work for you, there is a food court open for lunch in [http://depts.washington.edu/thehub/ the HUB] (the UW student center) that is almost directly next door.<br />
<br />
=== Social Media ===<br />
<br />
* We use the hashtag [http://twitter.com/#!/search?q=%23cdsw #cdsw]<br />
<br />
<br />
=== Contact information ===<br />
<br />
If you have any questions about the events, you can contact [mailto:makohill@uw.edu makohill@uw.edu].<br />
<br />
== About the Organizers ==<br />
<br />
The workshops are being coordinated, organized by [http://mako.cc/academic/ Benjamin Mako Hill], [http://jtmorgan.net/ Jonathan Morgan],[http://dharmadailey.info/ Dharma Dailey], Mika Matsuzaki, [https://guyrt.github.io/ Tommy Guy], Ben Lewis, Emilia Gan, and a long list of other volunteer mentors. The workshops have been designed with lots of help and inspiration from Shauna Gordon-McKeon and Asheesh Laroia of OpenHatch and lots of inspiration from the [http://bostonpythonworkshop.com/ Boston Python Workshop].<br />
<br />
These workshops are an all-volunteer effort. Fundamentally, we're doing this because we're programmers and data scientists who work in online communities and we really believe that the skills you'll learn in these sessions are important and empowering tools.<br />
<br />
<!--<br />
The workshops are being supported by the [http://www.com.washington.edu/ UW Department of Communication] and the [http://escience.washington.edu/ eScience Institute].<br />
--><br />
<br />
If you have any questions or concerns, please contact Benjamin Mako Hill at makohill@uw.edu.<br />
<br />
[[File:Dept.Comm_UW_vertical_small_square.jpg|180px]]<br />
[[File:EScience Logo RGB.png|250px]]<br />
<br />
<br />
[[Category:Winter 2020 series]]</div>Ddaileyhttps://wiki.communitydata.science/index.php?title=Community_Data_Science_Workshops_(Winter_2020)&diff=185638Community Data Science Workshops (Winter 2020)2020-01-16T04:41:53Z<p>Ddailey: </p>
<hr />
<div><div style="float:right;"><br />
<div style="margin-left:20px; padding-left:1em; text-align: center;"><br />
{| class="infobox" style="width: 600px; background-color:#ADC2E4"<br />
| colspan="2" | '''<div class="plainlinks" style="font-weight:bold; font-size:1.5em; text-align: center;">Registration for Winter 2020 is now closed</div>''' <br />
<br />
<div class="plainlinks" style="margin-left:0em; text-align: center;"><br />
Unfortunately, registration closed on '''January 13'''.<br />
<br />
''Have experience to share? [https://docs.google.com/forms/d/1ycV3HsWV_zaMWzuSSxyI4-_ye1NltVFFUtTbX3O6q6M/viewform Sign up to be a mentor].'' ''If you would like to be notified of future workshops, subscribe to [https://communitydata.science/mailman3/postorius/lists/cdsw-announce.communitydata.science/ our announcement email list].''<br />
</div><br />
|}<br />
</div><br />
[[Image:Cdsw combo images-1.jpg|thumb|600px|[[Community Data Science Workshops/Photos|More photos from past workshops]].]]<br />
<div style="clear: both;"></div><br />
</div><br />
<br />
The '''Community Data Science Workshops in Winter 2020''' are a series of project-based workshops being held at the University of Washington for anyone interested in learning how to use programming and data science tools to ask and answer questions about online communities like [http://en.wikipedia.org/ Wikipedia], [http://twitter.com Twitter], [[:w:Free software|free and open source software, and]] civic media.<br />
<br />
The Winter 2020 workshop series will take place over three Saturdays (plus a short Friday night setup session):<br />
<br />
* Friday, January 17th (6-9pm)<br />
* Saturday, January 18th (9:45-4pm)<br />
* Saturday, February 1st (9:45-4pm)<br />
* Saturday, February 15th (9:45-4pm)<br />
<br />
'''These workshops are for people with absolutely no previous programming experience''' and they bring together researchers and academics with participants and leaders in online communities. The workshops are run entirely by volunteers and are entirely free of charge for participants, generously sponsored by the [http://www.com.washington.edu/ UW Department of Communication] and the [http://escience.washington.edu/ eScience Institute]. Participants from outside UW are encouraged to apply.<br />
<br />
Our goal is that, after the three workshops, participants will be able to use data to produce numbers, hypothesis tests, tables, and graphical visualizations to answer questions like:<br />
<br />
* Are new contributors in Wikipedia this year sticking around longer or contributing more than people who joined last year?<br />
* Who are the most active or influential users of a particular Twitter hashtag?<br />
* Are people who join through a Wikipedia outreach event staying involved? How do they compare to people who decide to join the project outside of the event?<br />
<br />
We've run these workshops five times in 2014, 2015, and 2016 and [[CDSW|the curriculum we used for previous sessions is all online]].<br />
<br />
== Registration ==<br />
<br />
'''''Participants!''''' Unfortunately, the registration period is over. Sorry about that! This is our sixth set of workshops and we do hope to run more of these again in the future. You can find out about future workshops by signing up for [https://communitydata.science/mailman3/postorius/lists/cdsw-announce.communitydata.science/ our announcement mailing list].<br />
<br />
'''''Interested in being a mentor?''''' If you already have experience with Python, please consider helping out at the sessions as a mentor. Being a mentor will involve working with participants and talking them through the challenges they encounter in programming. No special preparation is required. And we'll feed you! Because we want to keep a very high mentor-to-student ratio, recruiting more mentors means we can accept more participants. If you're interested you can [https://forms.gle/6ZxxH77z2m18mhgo6 fill out this form] or email makohill@uw.edu. Also, thank you, thank you, thank you!<br />
<br />
== Schedule ==<br />
<br />
There will be a mandatory evening setup session '''6:00-9:00pm on Friday January 17''' and three workshops held from '''9:45am-4pm on three Saturdays (January 18 and February 1 and 15)'''. Each Saturday session will involve a period for lecture and technical demonstrations in the morning. This will be followed by a lunch graciously provided by the [http://escience.washington.edu/ eScience Institute at UW]. The rest of the day will be followed by group work on programming and data science projects supported by more experienced mentors.<br />
<br />
'''All sessions are interactive and involve you programming on your own and on your own laptop. Everybody attending should bring a laptop and a power cord so that they don't run out of battery.'''<br />
<br />
=== Session 0: Setup and Programming Tutorial (Friday January 17 evening)===<br />
<br />
Come to the '''[http://www.washington.edu/maps/#!/cmu Communications Building (CMU) 104]''' between 6:00 and 9:00pm. It's OK if you come a little late but you'll want to have as much time as you can to finish the setup and self-directed assignments so come as close to 6:00pm as you can. Most people will finish early but some people will definitely need the full 3 hours. It's hard to know in advance where problems will crop up so please come on time even if you are confident.<br />
<br />
:'''Time''': 6-9pm<br />
:'''Location''': '''[http://www.washington.edu/maps/#!/cmu Communications Building (CMU) 104]'''<br />
: '''Objectives''': During this session, mentors will help you:<br />
<br />
:: set up your development environment<br />
:: learn how to write and execute Python code in a Jupyter Notebook<br />
:: learn about printing and using Python as a calculator<br />
<br />
:'''Material''': <font size="+1">[[CDSW/Day 0 setup and tutorial|Click here for the the setup and tutorial material.]]</font><br />
<br />
'''Note''': Because we expect to hit the ground running on our first full day, we will meet to help participants get software installed and to work through a self-guided tutorial that will help ensure that everyone has the skills and vocabulary to start programming and learning when we meet the following morning.<br />
<br />
=== Session 1: Introduction to Programming (January 18) ===<br />
<br />
Come to '''[http://uw.edu/maps/?sav Savery Hall (SAV) 260] by 9:45am'''.<br />
Plan to be on UW campus by 9:45am (location TBD). You will need time to get settled and setup. We will start lecturing promptly at 10am. There will be coffee!<br />
<br />
: '''Time:''' 9:45am-4pm<br />
: '''Location:''' [http://uw.edu/maps/?sav Savery Hall (SAV)]<br />
<br />
: '''Schedule'''<br />
:: '''Morning, 10am-12:20 (SAV 260)''': [[CDSW/Day_1_lecture|A 2.5 hour lecture-based introduction to the Python programming language]]<br />
:: '''Lunch, 12:20-1pm (Savery Hall)''': We'll provide lunch (pizza!)<br />
:: '''Afternoon, 1pm-3:30pm (SAV 138, 139, 155, 156):''' Python practice through short projects (see below) on a variety of fun and practical topics:<br />
::* [[Baby_Names | Baby Names]]<br />
::* [[Learning Python | Learning Python]]<br />
:: '''Wrap-up, 3:30pm-4pm (SAV 260):''' Wrap-up, next steps, and upcoming opportunities for learning and practicing Python<br />
<br />
: '''Objectives''': Programming is an essential tool for data science and is useful for solving many other problems. The goal of this session will be to introduce programming in the [http://www.python.org/ Python programming language]. Each participant will leave having solved a real problem and will have built their first real programming project.<br />
<br />
<!--<br />
=== Session 2: Importing Data from web APIs (April 23) ===<br />
Come to '''[http://uw.edu/maps/?sav Savery Hall (SAV) 260] by 9:45am'''. You will need time to get settled and setup. We will start lecturing promptly at 10am. There will be coffee!<br />
<br />
: '''Time''': 9:45am-4pm<br />
<br />
: '''Location''': [http://uw.edu/maps/?sav Savery Hall (SAV)] <br />
<br />
: '''Schedule''':<br />
:: '''Morning: 10am-12:20 (SAV 260)''': [[CDSW/Day_2_Lecture|A 2.5 hour lecture-based introduction to the web programming and APIs]]<br />
:: '''Lunch: 12:20-1pm (Savery Hall downstairs hallway)''': We'll provide lunch (vegetarian Indian!)<br />
:: '''Afternoon: 1pm-3:30pm (SAV 138, 139, 155, 156)''': Web API practice through short projects (see below) on a variety of fun and practical topics:<br />
::* [[Community_Data_Science_Workshops_(Spring_2016)/Day_2_Projects/Twitter|Twitter]]<br />
::* [[Wikipedia (CDSW)|Wikipedia]]<br />
::* [[Yelp (CDSW)|Yelp]]<br />
:: '''Wrap-up: 3:30pm-4pm (SAV 260)''': Wrap-up, next steps, and upcoming opportunities for learning and practicing Python<br />
<br />
: '''Objectives''': An important step in doing data science is collecting data. The goal of this session will be to teach participants how to get data from the [https://en.wikipedia.org/wiki/Application_programming_interface public application programming interfaces] ("APIs") common to many social media and online communities. Although we will use the APIs provided by Wikipedia, Twitter, and Socrata in the session, the principles and techniques are common to many other online communities.<br />
<br />
: An outline for the lecture can be found [[CDSW/Day_2_lecture|here]] and a list of potential projects for the afternoon session are listed below:<br />
<br />
'''Important Note:''' If you plan to attend the Twitter afternoon session, you need to complete the [[Twitter authentication setup]] ''before'' the afternoon setup on Saturday. If you plan to complete the Yelp session, you need to complete the [[Yelp authentication setup]] instructions. There's no promise that we will be running these sessions this weekend unless there is demand but you will need to have done these if you want to attend the session.<br />
<br />
=== Session 3: Data Analysis and Visualization (May 7) ===<br />
Come to '''[http://uw.edu/maps/?sav Savery Hall (SAV) 260] by 9:45am'''. You will need time to get settled and setup. We will start lecturing promptly at 10am. There will be coffee!<br />
<br />
: '''Time''': 9:45am-4pm<br />
<br />
: '''Location:''' [http://uw.edu/maps/?sav Savery Hall (SAV) 260]<br />
<br />
: '''Schedule''':<br />
<br />
:: '''Morning, 10am-12:20 (SAV 260):''' [[CDSW/Day_3_Lecture|2.5 hour interactive lecture]]<br />
:: '''Lunch, 12:20-1pm (TBD):''' We'll provide lunch (TBD)<br />
:: '''Afternoon, 1pm-3:30pm (TBD): '''Web API practice through independent projects<br />
::* [[Harry Potter on Wikipedia|Visualization and analysis using Spreadsheets]]<br />
::* [[Matplotlib|Visualization using Python and Matplotlib]]<br />
::* [[Community_Data_Science_Workshops_(Spring_2016)/Day_3_Projects/Twitter|Analyzing data from Twitter]]<br />
::* [[Community_Data_Science_Workshops_(Spring_2016)/Day_3_Projects|Visualization and analysis of civic data from data.seattle.gov]]<br />
::* Independent projects working on issues of ''your'' choosing!<br />
:: '''Wrap-up, 3:30-4pm (SAV 260)<br />
<br />
: '''Objectives''': The goal of data science is to use data to answer questions. In our final session, we will use the Python skills we learned in the first session and the datasets we've created in the second to ask and answer common questions about the activity and health of online communities. We will focus on learning how to generate visualizations, create summary statistics, and test hypotheses.<br />
<br />
== Venue and Logistics ==<br />
<br />
=== What to bring ===<br />
# a '''laptop'''<br />
#* for '''Session 0''' make sure that you have about 1GB of space free so you can install Python and all the necessary other software<br />
#* for '''Sessions 1-3''' bring your laptop with Python set up<br />
# a '''power cord'''<br />
# a '''sense of adventure!'''<br />
<br />
=== Location ===<br />
[[File:Ulink-to-savery-hall.png|250px|thumb|right|15 mins from the UW Station to Savery Hall|link=https://tinyurl.com/hr3efyg]]<br />
<br />
For the first Friday setup session, please come to the '''Communications building''' [https://www.openstreetmap.org/export#map=18/47.65669/-122.30538 map]. The direction from the UW Link station is [https://tinyurl.com/jyrskxu here].<br />
<br />
For all the Saturday sessions, please meet at '''Savery Hall 260''' ([http://www.openstreetmap.org/export#map=17/47.65715/-122.30750 map]) on the '''the three Saturday mornings at 9:45'''. Unfortunately, most of the doors to Savery Hall are locked on weekends. The door on the '''west side of the building''' (i.e., the one nearest Kane Hall) should be open. <br />
<br />
'''[http://www.soundtransit.org/Rider-Guide/University-of-Washington-Station The UW Station] on Link is now open''' and Savery Hall is an easy walk on campus from the station. UW is also well served by buses and easily accessible by bicycle with the [https://en.wikipedia.org/wiki/Burke_Gilman_Trail Burke Gilman Trail]. Parking at UW is available but is not free. There is [https://www.washington.edu/facilities/transportation/commuterservices/parking/selfserve self-serve parking] as well as gatehouses that are staffed from 7am on Saturday and can issue you parking passes and point you to an appropriate lot. More details are on the [https://www.washington.edu/facilities/transportation/commuterservices/parking/daily UW Commuter Services website for Visitors and Guests].<br />
<br />
--><br />
<br />
=== Food ===<br />
<br />
Thanks to generous sponsorship by the [http://escience.washington.edu/ eScience Institute at UW], we will provide catered lunches during the Saturday sessions. Although we haven't figured out the menu, the food will all be vegetarian and there will be vegan and gluten free options. If the food we have doesn't doesn't work for you, there is a food court open for lunch in [http://depts.washington.edu/thehub/ the HUB] (the UW student center) that is almost directly next door.<br />
<br />
=== Social Media ===<br />
<br />
* We use the hashtag [http://twitter.com/#!/search?q=%23cdsw #cdsw]<br />
<br />
<br />
=== Contact information ===<br />
<br />
If you have any questions about the events, you can contact [mailto:makohill@uw.edu makohill@uw.edu].<br />
<br />
== About the Organizers ==<br />
<br />
The workshops are being coordinated, organized by [http://mako.cc/academic/ Benjamin Mako Hill], [http://jtmorgan.net/ Jonathan Morgan], Dharma Dailey, Mika Matsuzaki, [https://guyrt.github.io/ Tommy Guy], Ben Lewis, Emilia Gan, and a long list of other volunteer mentors. The workshops have been designed with lots of help and inspiration from Shauna Gordon-McKeon and Asheesh Laroia of OpenHatch and lots of inspiration from the [http://bostonpythonworkshop.com/ Boston Python Workshop].<br />
<br />
These workshops are an all-volunteer effort. Fundamentally, we're doing this because we're programmers and data scientists who work in online communities and we really believe that the skills you'll learn in these sessions are important and empowering tools.<br />
<br />
<!--<br />
The workshops are being supported by the [http://www.com.washington.edu/ UW Department of Communication] and the [http://escience.washington.edu/ eScience Institute].<br />
--><br />
<br />
If you have any questions or concerns, please contact Benjamin Mako Hill at makohill@uw.edu.<br />
<br />
[[File:Dept.Comm_UW_vertical_small_square.jpg|180px]]<br />
[[File:EScience Logo RGB.png|250px]]<br />
<br />
<br />
[[Category:Winter 2020 series]]</div>Ddaileyhttps://wiki.communitydata.science/index.php?title=Community_Data_Science_Workshops_(Core)/Planning_Checklist&diff=86098Community Data Science Workshops (Core)/Planning Checklist2016-04-18T02:50:26Z<p>Ddailey: /* Session 0 & 1 Preparation */</p>
<hr />
<div>== Planning/Announcement ==<br />
=== Registration ===<br />
<br />
* '''(Done SP2016)''' Create new Google drive folder and invite people that work on it<br />
* '''(Done SP2016)''' Copy registration pages from both participants and mentors<br />
** Read through and tweak details and dates<br />
<br />
=== Wiki ===<br />
<br />
* '''(Done SP2016)''' Create a basic page like [[Community Data Science Workshops (Spring 2016)]] based on the pre-release version in the history from the most recent workshops linked from [[Community Data Science Workshops]].<br />
** '''(Done SP2016)''' Search/replace year and season<br />
** '''(Done SP2016)''' Search/replace the month and day<br />
** '''(Done SP2016)''' Update registration links to the new Google Forms<br />
* '''(Done SP2016)''' Add link to page to the new subpage from the [[Community Data Science Workshops]] page<br />
* '''(Done SP2016)''' Create redirect like [[CDSW Spring 2016]] to point to the new page<br />
* '''(Done SP2016)''' Update [[Template:Banner]] to a live version<br />
<br />
=== Announcements ===<br />
<br />
* '''(Done SP2016)''' Create/copy a new announcements document in the shared Google Drive folder<br />
* Send announcements<br />
* Write blog posts on CDSC blog<br />
* '''(Done SP2016)''' Tweet, send on social media, etc.<br />
<br />
=== Funding and Rooms ===<br />
<br />
* '''(Done SP2016)''' Contact someone at [http://escience.washington.edu/ eScience] to help cover funding for food<br />
** '''(Done SP2016)''' Mako has contacted Bill Howe in the past<br />
* '''(Done SP2016)''' Contact somebody at the Department of Communication to cover drinks<br />
** '''(Done SP2016)''' Mako has contacted David Domke in the Department of Communication<br />
* '''(Done SP2016)''' Decide on for morning lectures (e.g., the Ooedgard ALC or SAV)<br />
* '''(Done SP2016)''' Contact someone at Odegaard/UW libraries about the [https://www.lib.washington.edu/ougl/learning-spaces/active-learning-classrooms Active Learning Classrooms] (that link includes both a schedule online and a page to request the room). Our contacts in the libraries are Jennifer S. Muilenburg <jmuil@uw.edu> (data management librarian) and Susie Cummings <cummin2@uw.edu> (who helps manage the ALC)<br />
* '''(Done SP2016)''' Decide on and find rooms for afternoon sessions (e.g., UW Research Commons or the Communications (CMU) Building or something else<br />
** For registering things in CMU managed by the Department of Communication, use the [http://www.com.washington.edu/facultystaff/technology/rooms/ links on the right sidebar of this page]<br />
** For registering classrooms managed centrally, go through the [https://depts.washington.edu/registra/RATS/guidelines.php UW Classroom Assignment Office]<br />
** For registering the research commons, we should go through the Research Commons Librarian and/or through Jennifer (email above)<br />
<br />
== Food ==<br />
<br />
* Coffee at etc at HUB: place an order the day before if possible. Need a couple people to carry 3 coffee (2 blonde; 2 medium), 40 cups, 1 large cup of half and half, other misc stuff. Need napkins as it always gets messy.<br />
* Session 1: Pizza from Jet City Pizza (*PHONE NUMBER (206) 525-2225? verify with mako/jmo*) for X vegetarian pizza, Y vegan pizza, Z, gluten free pizza, A vegan/gluten free pizza. A little bit of salad. Always ask for plates and napkins (otherwise they may not bring them).<br />
* Session 2: Indian food from Jewel of India at (*PHONE NUMBER (206) 523-5275? verify with mako) for 4 vegetarian dishes, naan, and rice at $12/person for 67 people ($800). Ask for plates, utensils, napkins, utensils, and serving spoons!<br />
* Session 3: Greek food from (*NAME and PHONE NUMBER OF RESTAURANT*) for X, Y, Z.<br />
<br />
== Session 0 & 1 Preparation ==<br />
<br />
* '''(Done SP2016)''' [https://itconnect.uw.edu/connect/email/mailman/ Create new mailing lists] (requires UW ID) at UW like cdsw-sp2016-attendees@uw.edu and cdsw-sp2016-mentors@uw.edu<br />
* Add people who are accepted to the cdsw-sp2016-attendees@uw.edu mailing list<br />
* Add people who are accepted to the cdsw-sp2016-mentors@uw.edu mailing list<br />
* Email attendees ''individually'' to tell them they were accepted, and have them check the mailing list to make sure they are gettingupdates<br />
* Create new wikipages for the new data<br />
* Check the CodeAcademy lessons to make sure they are up<br />
* Check the documentation for installation to make sure things work<br />
* Try out Anaconda installation<br />
* Email all the mentors to see if there's anybody they would like to have brought in off the waitlist<br />
* Draft/update acceptance email<br />
* Draft/update waitlist email<br />
* Send accept email! :-)<br />
* Send waitlist email :-(<br />
<br />
[[Category:CDSW]]<br />
<br />
== Session 2 Preparation ==<br />
*Send attendee reminder announcement out with survey<br />
*Prepare feedback survey<br />
*Update the wiki - are tutorials up to snuff? <br />
*Check supporting resources are still working as expected (e.g. signing up for Twitter API; Tweepy; PlaceKitten;) <br />
*Verify workshop leaders and instigators for afternoon workshops</div>Ddaileyhttps://wiki.communitydata.science/index.php?title=Community_Data_Science_Workshops_(Spring_2016)&diff=82771Community Data Science Workshops (Spring 2016)2016-04-04T01:13:24Z<p>Ddailey: </p>
<hr />
<div><div style="float:right;"><br />
<div style="margin-left:20px; padding-left:1em; text-align:center;"><br />
{| class="infobox" style="width: 600px; background-color:#ADC2E4"<br />
| colspan="2" | '''<span class="plainlinks" style="font-weight:bold; font-size:2em; text-align:center;">[http://goo.gl/forms/7TZ9cM0XMi Register for the workshop]</span>''' <br />
<span class="plainlinks" style="margin-left:1em;">Registration closes on '''April 2.''' ''Have experience to share? [http://goo.gl/forms/6Ws3iIi6Y6 Sign up to be a mentor]</span>''<br />
|}<br />
</div><br />
[[Image:Cdsw combo images-1.jpg|thumb|600px|[[Community Data Science Workshops/Photos|More photos from past workshops]].]]<br />
<div style="clear: both;"></div><br />
</div><br />
<br />
The '''Community Data Science Workshops in Spring 2016''' are a series of project-based workshops being held at the University of Washington for anyone interested in learning how to use programming and data science tools to ask and answer questions about online communities like [http://en.wikipedia.org/ Wikipedia], [http://twitter.com Twitter], [[:w:Free software|free and open source software, and]] civic media.<br />
<br />
The Spring 2016 workshop series will take place over three Saturdays (plus a short Friday night setup session):<br />
<br />
* Friday, April 8th (6-9pm)<br />
* Saturday, April 9th (9:45-4pm)<br />
* Saturday, April 23th (9:45-4pm)<br />
* Saturday, May 7th (9:45-4pm)<br />
<br />
'''These workshops are for people with absolutely no previous programming experience''' and they bring together researchers and academics with participants and leaders in online communities. The workshops are run entirely by volunteers and are entirely free of charge for participants, generously sponsored by the [http://www.com.washington.edu/ UW Department of Communication] and the [http://escience.washington.edu/ eScience Institute]. Participants from outside UW are encouraged to apply.<br />
<br />
Our goal is that, after the three workshops, participants will be able to use data to produce numbers, hypothesis tests, tables, and graphical visualizations to answer questions like:<br />
<br />
* Are new contributors in Wikipedia this year sticking around longer or contributing more than people who joined last year?<br />
* Who are the most active or influential users of a particular Twitter hashtag?<br />
* Are people who join through a Wikipedia outreach event staying involved? How do they compare to people who decide to join the project outside of the event?<br />
<br />
We've run these workshops four times before in 2014 and 2015 and [[CDSW|the curriculum we used for previous sessions is all online]].<br />
<br />
== Registration ==<br />
<br />
'''''Participants!''''' If you are interested in learning data science, please fill out [http://goo.gl/forms/7TZ9cM0XMi our registration form here]. The deadline to register is Saturday April 2. We will let participants know if we have room for them by Monday April 4. Space is limited and will depend on how many mentors we can recruit for the sessions and the sizes of the rooms we can secure.<br />
<br />
'''''Interested in being a mentor?''''' If you already have experience with Python, please consider helping out at the sessions as a mentor. Being a mentor will involve working with participants and talking them through the challenges they encounter in programming. No special preparation is required. And we'll feed you! Because we want to keep a very high mentor-to-student ratio, recruiting more mentors means we can accept more participants. If you're interested you can [http://goo.gl/forms/6Ws3iIi6Y6 fill out this form] or email makohill@uw.edu. Also, thank you, thank you, thank you!<br />
<br />
<!-- Unfortunately, registration is over and we were oversubscribed and we have a large waitlist. Sorry about that! This is our third set of workshops and we do hope to run more of these again in the future. --><br />
<br />
== Schedule ==<br />
<br />
There will be a mandatory evening setup session '''6:00-9:00pm on Friday April 8''' and three workshops held from '''9:45am-4pm on three Saturdays (April 9 and 23 and May 7)'''. Each Saturday session will involve a period for lecture and technical demonstrations in the morning. This will be followed by a lunch graciously provided by the [http://escience.washington.edu/ eScience Institute at UW]. The rest of the day will be followed by group work on programming and data science projects supported by more experienced mentors.<br />
<br />
'''All sessions are interactive and involve you programming on your own and on your own laptop. Everybody attending should bring a laptop and a power cord so that they don't run out of battery.'''<br />
<br />
=== Session 0: Setup and Programming Tutorial (Friday April 8 evening)===<br />
:'''Time''': 6-9pm<br />
:'''Location''': Come to the Communications Building '''[http://www.washington.edu/maps/#!/cmu (CMU) 104]'''. <br />
:'''Material''': <font size="+1">[[CDSW/Day 0 setup and tutorial|Click here for the the setup and tutorial material.]]</font><br />
<br />
: '''Content''': During this session, mentors will help you:<br />
<br />
:: set up your development environment<br />
:: learn how to execute Python code from a file and interactively from a Python prompt<br />
:: learn about printing and using Python as a calculator<br />
<br />
'''Note''': Because we expect to hit the ground running on our first full day, we will meet to help participants get software installed and to work through a self-guided tutorial that will help ensure that everyone has the skills and vocabulary to start programming and learning when we meet the following morning.<br />
<!-- :'''Material''': <font size="+1">[[Community Data Science Workshops (Spring 2016)/Day 0 setup and tutorial|Click here for the the setup and tutorial material.]]</font>--><br />
<br />
<!--Come to '''[http://www.washington.edu/maps/#!/cmu Communications (CMU) 104] between 6:00 and 9:00pm.''' It's OK if you come a little late but you'll want to have as much time as you can to finish the setup and self-directed assignments so come as close to 6:30pm as you can. Most people will finish early but some people will definitely need the full 3 hours. It's hard to know in advance where problems will crop up so please come on time even if you are confident. --><br />
<br />
<br />
=== Session 1: Introduction to Programming (April 9) ===<br />
Come to '''[http://uw.edu/maps/?sav Savery Hall (SAV) 260] by 9:45am'''. You will need time to get settled and setup. We will start lecturing promptly at 10am. There will be coffee!<br />
<br />
: '''Time:''' 9:45am-4pm<br />
<br />
: '''Location:''' [http://uw.edu/maps/?sav Savery Hall (SAV)]<br />
<br />
: '''Schedule'''<br />
:: '''Morning, 10am-12:20 (SAV 260)''': [[CDSW/Day_1_lecture|A 2 hour lecture-based introduction to the Python programming language]]<br />
:: '''Lunch, 12:20-1pm (TBD)''': We'll provide lunch<br />
:: '''Afternoon, 1pm-3:30pm (TBD):''' Python practice through short projects on a variety of fun and practical topics<br />
:: '''Wrap-up, 3:30pm-4pm (SAV 260):''' Wrap-up, next steps, and upcoming opportunities for learning and practicing Python<br />
<br />
: '''Content''': Programming is an essential tool for data science and is useful for solving many other problems. The goal of this session will be to introduce programming in the [http://www.python.org/ Python programming language]. Each participant will leave having solved a real problem and will have built their first real programming project.<br />
<br />
: '''Projects'''<br />
:: [http://wiki.communitydata.cc/Baby_Names Baby Names]<br />
:: [http://wiki.communitydata.cc/Code_Academy Code Academy]<br />
<br />
=== Session 2: Importing Data from web APIs (April 23) ===<br />
You will need time to get settled and setup. We will start lecturing promptly at 10am. There will be coffee!<br />
<br />
: '''Time:''' 9:45am-4pm<br />
<br />
: '''Location:''' [http://uw.edu/maps/?sav Savery Hall (SAV)] <br />
<br />
: '''Schedule'''<br />
:: '''Morning: 10am-12:20 (SAV 260)''': [[CDSW/Day_2_lecture|A 2 hour lecture-based introduction to the web programming and APIs]]<br />
:: '''Lunch: 12:20-1pm (TBD)''': We'll provide lunch (TBD)<br />
:: '''Afternoon: 1pm-3:30pm (TBD)''': Web API practice through short projects on a variety of fun and practical topics<br />
:: '''Wrap-up: 3:30pm-4pm (SAV 260)''': Wrap-up, next steps, and upcoming opportunities for learning and practicing Python<br />
<br />
: '''Content''': An important step in doing data science is collecting data. The goal of this session will be to teach participants how to get data from the [https://en.wikipedia.org/wiki/Application_programming_interface public application programming interfaces] ("APIs") common to many social media and online communities. Although we will use the APIs provided by Wikipedia, Twitter, and Socrata in the session, the principles and techniques are common to many other online communities.<br />
<br />
: An outline for the lecture can be found [[CDSW/Day_2_lecture|here]] and a list of projects for the afternoon session are listed below.<br />
<br />
: '''Projects'''<br />
:: [[Community_Data_Science_Workshops_(Spring_2016)/Day_2_Projects/Twitter|Twitter]]<br />
:: [[Community_Data_Science_Workshops_(Spring_2016)/Day_2_Projects/Wikipedia|Wikipedia]]<br />
:: [[Community_Data_Science_Workshops_(Spring_2016)/Day_2_Projects/Socrata|Socrata (data.seattle.gov)]]<br />
<br />
'''Important Note:''' If you plan to attend the Twitter afternoon session, you need to complete the [[Twitter authentication setup]] ''before'' the afternoon setup on Saturday.<br />
<br />
=== Session 3: Data Analysis and Visualization (May 7) ===<br />
You will need time to get settled and setup. We will start lecturing promptly at 10am. There will be coffee!<br />
<br />
: '''Time:''' 9:45am-4pm<br />
<br />
: '''Location:''' [http://uw.edu/maps/?sav Savery Hall (SAV) 260]<br />
<br />
: '''Schedule'''<br />
<br />
:: '''Morning, 10am-12:20 (SAV 260):''' [[Community_Data_Science_Workshops_(Spring_2016)/Day_3_Lecture|2 hour interactive lecture]]<br />
:: '''Lunch, 12:20-1pm (TBD):''' We'll provide lunch (vegetarian Greek)<br />
:: '''Afternoon, 1pm-3:30pm (TBD):''' Web API practice through '''''[[Community_Data_Science_Workshops_(Spring_2016)/Day_3_Projects|independent projects]]'''''<br />
:: '''Wrap-up, 3:30-4pm (SAV 260)<br />
<br />
: '''Content''': The goal of data science is to use data to answer questions. In our final session, we will use the Python skills we learned in the first session and the datasets we've created in the second to ask and answer common questions about the activity and health of online communities. We will focus on learning how to generate visualizations, create summary statistics, and test hypotheses.<br />
<br />
== Resources ==<br />
<br />
The following materials are currently being updated by the mentors:<br />
<br />
* [[Community Data Science Workshops (Spring 2016)/Day 0 setup and tutorial|Friday April 8th setup and tutorial]]<br />
* [[Community Data Science Workshops (Spring 2016)/Day 1 lecture|Saturday April 9th lecture]]<br />
* [[Community Data Science Workshops (Spring 2016)/Day 1 projects|Saturday April 9th projects]]<br />
* [http://www.codecademy.com/courses/python-beginner-en-kSQwt Introduction to Python CodeAcademy exercises]<br />
* [[Twitter authentication setup]]<br />
* [[Community Data Science Workshops (Spring 2016)/Day 2 lecture|Saturday April 27th lecture]]<br />
* [[Community Data Science Workshops (Spring 2016)/Day 2 projects|Saturday April 27th projects]]<br />
* [http://www.codecademy.com/tracks/apis-python Introduction to APIs in Python CodeAcademy exercises] - Includes information on using APIs from [http://npr.org/ NPR], [http://bit.ly Bitly], [https://sunlightfoundation.com/ Sunlight Foundation], and [http://placekitten.com/ PlaceKitten]<br />
* [[Community Data Science Workshops (Spring 2016)/Day 3 lecture|Saturday May 7th lecture]]<br />
* [[Community Data Science Workshops (Spring 2016)/Day 3 projects|Saturday May 7th projects]]<br />
<br />
== Venue and Logistics ==<br />
<br />
=== What to bring ===<br />
# a '''laptop'''<br />
#* for '''Session 0''' make sure that you have about 1GB of space free so you can install Python and all the necessary other software<br />
#* for '''Sessions 1-3''' bring your laptop with Python set up<br />
# a '''power cord'''<br />
# a '''sense of adventure!'''<br />
<br />
=== Contact information ===<br />
<br />
If you have any questions about the events, you can contact [mailto:makohill@uw.edu makohill@uw.edu].<br />
<br />
=== Location ===<br />
<br />
<!-- The [http://www.com.washington.edu University of Washington Department of Communication] is hosting the event and all of our events '''except the Saturday morning lectures''' will be held in the '''Communications building (CMU)''' on the Seattle UW campus. This includes the Friday setup and the and all of the afternoon projects. You can find the building on [https://maps.google.com/maps?q=CMU+Building&hl=en&ll=47.655675,-122.306435&spn=0.018732,0.016394&sll=47.613028,-122.342064&sspn=0.599907,0.524597&hq=CMU+Building&t=m&z=16 this Google map] or on [http://www.washington.edu/maps/ this campus map from UW].<br />
<br />
Because we have grown so big, we have had to move the lectures into a larger lecture hall than the CMU building has available. Please meet at '''Savery Hall 260''' ([http://uw.edu/maps/?sav map]) on '''the three Saturday mornings at 9:45'''. It is about a five minute walk from the Communications building. Unfortunately, most of the doors to Savery Hall are locked on weekends. The door on the '''west side of the building''' (i.e., the one nearest Kane Hall) should be open.<br />
<br />
Parking at UW is available but is not free. There is [https://www.washington.edu/facilities/transportation/commuterservices/parking/selfserve self-serve parking] as well as gatehouses that are staffed from 7am on Saturday and can issue you parking passes and point you to an appropriate lot. More details are on the [https://www.washington.edu/facilities/transportation/commuterservices/parking/daily UW Commuter Services website for Visitors and Guests]. UW is also well served by public transportation and easily accessible by bicycle with the [https://en.wikipedia.org/wiki/Burke_Gilman_Trail Burke Giilman Trail].<br />
--><br />
<br />
=== Food ===<br />
<br />
Thanks to generous sponsorship by the [http://escience.washington.edu/ eScience Institute at UW], we will provide catered lunchs during the Saturday sessions. Although we haven't figured out the menu, the food will all be vegetarian and there will be vegan and gluten free options. If the food we have doesn't doesn't work for you, there is a food court open for lunch in [http://depts.washington.edu/thehub/ the HUB] (the UW student center) that is almost directly next door.<br />
<br />
=== Social Media ===<br />
<br />
* We use the hashtag [http://twitter.com/#!/search?q=%23cdsw #cdsw]<br />
<br />
== About the Organizers ==<br />
<br />
The workshops are being coordinated, organized by [http://mako.cc/academic/ Benjamin Mako Hill], [http://jtmorgan.net/ Jonathan Morgan], [https://guyrt.github.io/ Tommy Guy], Ben Lewis, Dharma Dailey, and a long list of other volunteer mentors. The workshops have been designed with lots of help and inspiration from Shauna Gordon-McKeon and Asheesh Laroia of OpenHatch and lots of inspiration from the [http://bostonpythonworkshop.com/ Boston Python Workshop].<br />
<br />
These workshops are an all-volunteer effort. Fundamentally, we're doing this because we're programmers and data scientists who work in online communities and we really believe that the skills you'll learn in these sessions are important and empowering tools.<br />
<br />
The workshops are being supported by the [http://www.com.washington.edu/ UW Department of Communication] and the [http://escience.washington.edu/ eScience Institute].<br />
<br />
If you have any questions or concerns, please contact Benjamin Mako Hill at makohill@uw.edu.<br />
<br />
[[File:Dept.Comm_UW_vertical_small_square.jpg|180px]]<br />
[[File:EScience Logo RGB.png|250px]]<br />
<br />
[[Category:Spring 2016 series]]</div>Ddaileyhttps://wiki.communitydata.science/index.php?title=Community_Data_Science_Workshops_(Spring_2016)&diff=82768Community Data Science Workshops (Spring 2016)2016-04-04T01:12:18Z<p>Ddailey: </p>
<hr />
<div><div style="float:right;"><br />
<div style="margin-left:20px; padding-left:1em; text-align:center;"><br />
{| class="infobox" style="width: 600px; background-color:#ADC2E4"<br />
| colspan="2" | '''<span class="plainlinks" style="font-weight:bold; font-size:2em; text-align:center;">[http://goo.gl/forms/7TZ9cM0XMi Register for the workshop]</span>''' <br />
<span class="plainlinks" style="margin-left:1em;">Registration closes on '''April 2.''' ''Have experience to share? [http://goo.gl/forms/6Ws3iIi6Y6 Sign up to be a mentor]</span>''<br />
|}<br />
</div><br />
[[Image:Cdsw combo images-1.jpg|thumb|600px|[[Community Data Science Workshops/Photos|More photos from past workshops]].]]<br />
<div style="clear: both;"></div><br />
</div><br />
<br />
The '''Community Data Science Workshops in Spring 2016''' are a series of project-based workshops being held at the University of Washington for anyone interested in learning how to use programming and data science tools to ask and answer questions about online communities like [http://en.wikipedia.org/ Wikipedia], [http://twitter.com Twitter], [[:w:Free software|free and open source software, and]] civic media.<br />
<br />
The Spring 2016 workshop series will take place over three Saturdays (plus a short Friday night setup session):<br />
<br />
* Friday, April 8th (6-9pm)<br />
* Saturday, April 9th (9:45-4pm)<br />
* Saturday, April 23th (9:45-4pm)<br />
* Saturday, May 7th (9:45-4pm)<br />
<br />
'''These workshops are for people with absolutely no previous programming experience''' and they bring together researchers and academics with participants and leaders in online communities. The workshops are run entirely by volunteers and are entirely free of charge for participants, generously sponsored by the [http://www.com.washington.edu/ UW Department of Communication] and the [http://escience.washington.edu/ eScience Institute]. Participants from outside UW are encouraged to apply.<br />
<br />
Our goal is that, after the three workshops, participants will be able to use data to produce numbers, hypothesis tests, tables, and graphical visualizations to answer questions like:<br />
<br />
* Are new contributors in Wikipedia this year sticking around longer or contributing more than people who joined last year?<br />
* Who are the most active or influential users of a particular Twitter hashtag?<br />
* Are people who join through a Wikipedia outreach event staying involved? How do they compare to people who decide to join the project outside of the event?<br />
<br />
We've run these workshops four times before in 2014 and 2015 and [[CDSW|the curriculum we used for previous sessions is all online]].<br />
<br />
== Registration ==<br />
<br />
'''''Participants!''''' If you are interested in learning data science, please fill out [http://goo.gl/forms/7TZ9cM0XMi our registration form here]. The deadline to register is Saturday April 2. We will let participants know if we have room for them by Monday April 4. Space is limited and will depend on how many mentors we can recruit for the sessions and the sizes of the rooms we can secure.<br />
<br />
'''''Interested in being a mentor?''''' If you already have experience with Python, please consider helping out at the sessions as a mentor. Being a mentor will involve working with participants and talking them through the challenges they encounter in programming. No special preparation is required. And we'll feed you! Because we want to keep a very high mentor-to-student ratio, recruiting more mentors means we can accept more participants. If you're interested you can [http://goo.gl/forms/6Ws3iIi6Y6 fill out this form] or email makohill@uw.edu. Also, thank you, thank you, thank you!<br />
<br />
<!-- Unfortunately, registration is over and we were oversubscribed and we have a large waitlist. Sorry about that! This is our third set of workshops and we do hope to run more of these again in the future. --><br />
<br />
== Schedule ==<br />
<br />
There will be a mandatory evening setup session '''6:00-9:00pm on Friday April 8''' and three workshops held from '''9:45am-4pm on three Saturdays (April 9 and 23 and May 7)'''. Each Saturday session will involve a period for lecture and technical demonstrations in the morning. This will be followed by a lunch graciously provided by the [http://escience.washington.edu/ eScience Institute at UW]. The rest of the day will be followed by group work on programming and data science projects supported by more experienced mentors.<br />
<br />
'''All sessions are interactive and involve you programming on your own and on your own laptop. Everybody attending should bring a laptop and a power cord so that they don't run out of battery.'''<br />
<br />
=== Session 0: Setup and Programming Tutorial (Friday April 8 evening)===<br />
:'''Time''': 6-9pm<br />
:'''Location''': Come to '''[http://www.washington.edu/maps/#!/cmu (CMU) 104]'''. <br />
:'''Material''': <font size="+1">[[CDSW/Day 0 setup and tutorial|Click here for the the setup and tutorial material.]]</font><br />
<br />
: '''Content''': During this session, mentors will help you:<br />
<br />
:: set up your development environment<br />
:: learn how to execute Python code from a file and interactively from a Python prompt<br />
:: learn about printing and using Python as a calculator<br />
<br />
'''Note''': Because we expect to hit the ground running on our first full day, we will meet to help participants get software installed and to work through a self-guided tutorial that will help ensure that everyone has the skills and vocabulary to start programming and learning when we meet the following morning.<br />
<!-- :'''Material''': <font size="+1">[[Community Data Science Workshops (Spring 2016)/Day 0 setup and tutorial|Click here for the the setup and tutorial material.]]</font>--><br />
<br />
<!--Come to '''[http://www.washington.edu/maps/#!/cmu Communications (CMU) 104] between 6:00 and 9:00pm.''' It's OK if you come a little late but you'll want to have as much time as you can to finish the setup and self-directed assignments so come as close to 6:30pm as you can. Most people will finish early but some people will definitely need the full 3 hours. It's hard to know in advance where problems will crop up so please come on time even if you are confident. --><br />
<br />
<br />
=== Session 1: Introduction to Programming (April 9) ===<br />
Come to '''[http://uw.edu/maps/?sav Savery Hall (SAV) 260] by 9:45am'''. You will need time to get settled and setup. We will start lecturing promptly at 10am. There will be coffee!<br />
<br />
: '''Time:''' 9:45am-4pm<br />
<br />
: '''Location:''' [http://uw.edu/maps/?sav Savery Hall (SAV)]<br />
<br />
: '''Schedule'''<br />
:: '''Morning, 10am-12:20 (SAV 260)''': [[CDSW/Day_1_lecture|A 2 hour lecture-based introduction to the Python programming language]]<br />
:: '''Lunch, 12:20-1pm (TBD)''': We'll provide lunch<br />
:: '''Afternoon, 1pm-3:30pm (TBD):''' Python practice through short projects on a variety of fun and practical topics<br />
:: '''Wrap-up, 3:30pm-4pm (SAV 260):''' Wrap-up, next steps, and upcoming opportunities for learning and practicing Python<br />
<br />
: '''Content''': Programming is an essential tool for data science and is useful for solving many other problems. The goal of this session will be to introduce programming in the [http://www.python.org/ Python programming language]. Each participant will leave having solved a real problem and will have built their first real programming project.<br />
<br />
: '''Projects'''<br />
:: [http://wiki.communitydata.cc/Baby_Names Baby Names]<br />
:: [http://wiki.communitydata.cc/Code_Academy Code Academy]<br />
<br />
=== Session 2: Importing Data from web APIs (April 23) ===<br />
You will need time to get settled and setup. We will start lecturing promptly at 10am. There will be coffee!<br />
<br />
: '''Time:''' 9:45am-4pm<br />
<br />
: '''Location:''' [http://uw.edu/maps/?sav Savery Hall (SAV)] <br />
<br />
: '''Schedule'''<br />
:: '''Morning: 10am-12:20 (SAV 260)''': [[CDSW/Day_2_lecture|A 2 hour lecture-based introduction to the web programming and APIs]]<br />
:: '''Lunch: 12:20-1pm (TBD)''': We'll provide lunch (TBD)<br />
:: '''Afternoon: 1pm-3:30pm (TBD)''': Web API practice through short projects on a variety of fun and practical topics<br />
:: '''Wrap-up: 3:30pm-4pm (SAV 260)''': Wrap-up, next steps, and upcoming opportunities for learning and practicing Python<br />
<br />
: '''Content''': An important step in doing data science is collecting data. The goal of this session will be to teach participants how to get data from the [https://en.wikipedia.org/wiki/Application_programming_interface public application programming interfaces] ("APIs") common to many social media and online communities. Although we will use the APIs provided by Wikipedia, Twitter, and Socrata in the session, the principles and techniques are common to many other online communities.<br />
<br />
: An outline for the lecture can be found [[Community_Data_Science_Workshops_(Spring_2016)/Day_2_Lecture|here]], and some info about the projects can be found [[Community_Data_Science_Workshops_(Spring_2016)/Day_2_Projects|here]].<br />
<br />
;Projects<br />
* [[Community_Data_Science_Workshops_(Spring_2016)/Day_2_Projects/Twitter|Twitter]]<br />
* [[Community_Data_Science_Workshops_(Spring_2016)/Day_2_Projects/Wikipedia|Wikipedia]]<br />
* [[Community_Data_Science_Workshops_(Spring_2016)/Day_2_Projects/Socrata|Socrata (data.seattle.gov)]]<br />
<br />
'''Important Note:''' If you plan to attend the Twitter afternoon session, you need to complete the [[Twitter authentication setup]] ''before'' the afternoon setup on Saturday.<br />
<br />
=== Session 3: Data Analysis and Visualization (May 7) ===<br />
You will need time to get settled and setup. We will start lecturing promptly at 10am. There will be coffee!<br />
<br />
: '''Time:''' 9:45am-4pm<br />
<br />
: '''Location:''' [http://uw.edu/maps/?sav Savery Hall (SAV) 260]<br />
<br />
: '''Schedule'''<br />
<br />
:: '''Morning, 10am-12:20 (SAV 260):''' [[Community_Data_Science_Workshops_(Spring_2016)/Day_3_Lecture|2 hour interactive lecture]]<br />
:: '''Lunch, 12:20-1pm (TBD):''' We'll provide lunch (vegetarian Greek)<br />
:: '''Afternoon, 1pm-3:30pm (TBD):''' Web API practice through '''''[[Community_Data_Science_Workshops_(Spring_2016)/Day_3_Projects|independent projects]]'''''<br />
:: '''Wrap-up, 3:30-4pm (SAV 260)<br />
<br />
: '''Content''': The goal of data science is to use data to answer questions. In our final session, we will use the Python skills we learned in the first session and the datasets we've created in the second to ask and answer common questions about the activity and health of online communities. We will focus on learning how to generate visualizations, create summary statistics, and test hypotheses.<br />
<br />
== Resources ==<br />
<br />
The following materials are currently being updated by the mentors:<br />
<br />
* [[Community Data Science Workshops (Spring 2016)/Day 0 setup and tutorial|Friday April 8th setup and tutorial]]<br />
* [[Community Data Science Workshops (Spring 2016)/Day 1 lecture|Saturday April 9th lecture]]<br />
* [[Community Data Science Workshops (Spring 2016)/Day 1 projects|Saturday April 9th projects]]<br />
* [http://www.codecademy.com/courses/python-beginner-en-kSQwt Introduction to Python CodeAcademy exercises]<br />
* [[Twitter authentication setup]]<br />
* [[Community Data Science Workshops (Spring 2016)/Day 2 lecture|Saturday April 27th lecture]]<br />
* [[Community Data Science Workshops (Spring 2016)/Day 2 projects|Saturday April 27th projects]]<br />
* [http://www.codecademy.com/tracks/apis-python Introduction to APIs in Python CodeAcademy exercises] - Includes information on using APIs from [http://npr.org/ NPR], [http://bit.ly Bitly], [https://sunlightfoundation.com/ Sunlight Foundation], and [http://placekitten.com/ PlaceKitten]<br />
* [[Community Data Science Workshops (Spring 2016)/Day 3 lecture|Saturday May 7th lecture]]<br />
* [[Community Data Science Workshops (Spring 2016)/Day 3 projects|Saturday May 7th projects]]<br />
<br />
== Venue and Logistics ==<br />
<br />
=== What to bring ===<br />
# a '''laptop'''<br />
#* for '''Session 0''' make sure that you have about 1GB of space free so you can install Python and all the necessary other software<br />
#* for '''Sessions 1-3''' bring your laptop with Python set up<br />
# a '''power cord'''<br />
# a '''sense of adventure!'''<br />
<br />
=== Contact information ===<br />
<br />
If you have any questions about the events, you can contact [mailto:makohill@uw.edu makohill@uw.edu].<br />
<br />
=== Location ===<br />
<br />
<!-- The [http://www.com.washington.edu University of Washington Department of Communication] is hosting the event and all of our events '''except the Saturday morning lectures''' will be held in the '''Communications building (CMU)''' on the Seattle UW campus. This includes the Friday setup and the and all of the afternoon projects. You can find the building on [https://maps.google.com/maps?q=CMU+Building&hl=en&ll=47.655675,-122.306435&spn=0.018732,0.016394&sll=47.613028,-122.342064&sspn=0.599907,0.524597&hq=CMU+Building&t=m&z=16 this Google map] or on [http://www.washington.edu/maps/ this campus map from UW].<br />
<br />
Because we have grown so big, we have had to move the lectures into a larger lecture hall than the CMU building has available. Please meet at '''Savery Hall 260''' ([http://uw.edu/maps/?sav map]) on '''the three Saturday mornings at 9:45'''. It is about a five minute walk from the Communications building. Unfortunately, most of the doors to Savery Hall are locked on weekends. The door on the '''west side of the building''' (i.e., the one nearest Kane Hall) should be open.<br />
<br />
Parking at UW is available but is not free. There is [https://www.washington.edu/facilities/transportation/commuterservices/parking/selfserve self-serve parking] as well as gatehouses that are staffed from 7am on Saturday and can issue you parking passes and point you to an appropriate lot. More details are on the [https://www.washington.edu/facilities/transportation/commuterservices/parking/daily UW Commuter Services website for Visitors and Guests]. UW is also well served by public transportation and easily accessible by bicycle with the [https://en.wikipedia.org/wiki/Burke_Gilman_Trail Burke Giilman Trail].<br />
--><br />
<br />
=== Food ===<br />
<br />
Thanks to generous sponsorship by the [http://escience.washington.edu/ eScience Institute at UW], we will provide catered lunchs during the Saturday sessions. Although we haven't figured out the menu, the food will all be vegetarian and there will be vegan and gluten free options. If the food we have doesn't doesn't work for you, there is a food court open for lunch in [http://depts.washington.edu/thehub/ the HUB] (the UW student center) that is almost directly next door.<br />
<br />
=== Social Media ===<br />
<br />
* We use the hashtag [http://twitter.com/#!/search?q=%23cdsw #cdsw]<br />
<br />
== About the Organizers ==<br />
<br />
The workshops are being coordinated, organized by [http://mako.cc/academic/ Benjamin Mako Hill], [http://jtmorgan.net/ Jonathan Morgan], [https://guyrt.github.io/ Tommy Guy], Ben Lewis, Dharma Dailey, and a long list of other volunteer mentors. The workshops have been designed with lots of help and inspiration from Shauna Gordon-McKeon and Asheesh Laroia of OpenHatch and lots of inspiration from the [http://bostonpythonworkshop.com/ Boston Python Workshop].<br />
<br />
These workshops are an all-volunteer effort. Fundamentally, we're doing this because we're programmers and data scientists who work in online communities and we really believe that the skills you'll learn in these sessions are important and empowering tools.<br />
<br />
The workshops are being supported by the [http://www.com.washington.edu/ UW Department of Communication] and the [http://escience.washington.edu/ eScience Institute].<br />
<br />
If you have any questions or concerns, please contact Benjamin Mako Hill at makohill@uw.edu.<br />
<br />
[[File:Dept.Comm_UW_vertical_small_square.jpg|180px]]<br />
[[File:EScience Logo RGB.png|250px]]<br />
<br />
[[Category:Spring 2016 series]]</div>Ddaileyhttps://wiki.communitydata.science/index.php?title=Community_Data_Science_Workshops_(Spring_2016)&diff=82764Community Data Science Workshops (Spring 2016)2016-04-04T01:11:01Z<p>Ddailey: </p>
<hr />
<div><div style="float:right;"><br />
<div style="margin-left:20px; padding-left:1em; text-align:center;"><br />
{| class="infobox" style="width: 600px; background-color:#ADC2E4"<br />
| colspan="2" | '''<span class="plainlinks" style="font-weight:bold; font-size:2em; text-align:center;">[http://goo.gl/forms/7TZ9cM0XMi Register for the workshop]</span>''' <br />
<span class="plainlinks" style="margin-left:1em;">Registration closes on '''April 2.''' ''Have experience to share? [http://goo.gl/forms/6Ws3iIi6Y6 Sign up to be a mentor]</span>''<br />
|}<br />
</div><br />
[[Image:Cdsw combo images-1.jpg|thumb|600px|[[Community Data Science Workshops/Photos|More photos from past workshops]].]]<br />
<div style="clear: both;"></div><br />
</div><br />
<br />
The '''Community Data Science Workshops in Spring 2016''' are a series of project-based workshops being held at the University of Washington for anyone interested in learning how to use programming and data science tools to ask and answer questions about online communities like [http://en.wikipedia.org/ Wikipedia], [http://twitter.com Twitter], [[:w:Free software|free and open source software, and]] civic media.<br />
<br />
The Spring 2016 workshop series will take place over three Saturdays (plus a short Friday night setup session):<br />
<br />
* Friday, April 8th (6-9pm)<br />
* Saturday, April 9th (9:45-4pm)<br />
* Saturday, April 23th (9:45-4pm)<br />
* Saturday, May 7th (9:45-4pm)<br />
<br />
'''These workshops are for people with absolutely no previous programming experience''' and they bring together researchers and academics with participants and leaders in online communities. The workshops are run entirely by volunteers and are entirely free of charge for participants, generously sponsored by the [http://www.com.washington.edu/ UW Department of Communication] and the [http://escience.washington.edu/ eScience Institute]. Participants from outside UW are encouraged to apply.<br />
<br />
Our goal is that, after the three workshops, participants will be able to use data to produce numbers, hypothesis tests, tables, and graphical visualizations to answer questions like:<br />
<br />
* Are new contributors in Wikipedia this year sticking around longer or contributing more than people who joined last year?<br />
* Who are the most active or influential users of a particular Twitter hashtag?<br />
* Are people who join through a Wikipedia outreach event staying involved? How do they compare to people who decide to join the project outside of the event?<br />
<br />
We've run these workshops four times before in 2014 and 2015 and [[CDSW|the curriculum we used for previous sessions is all online]].<br />
<br />
== Registration ==<br />
<br />
'''''Participants!''''' If you are interested in learning data science, please fill out [http://goo.gl/forms/7TZ9cM0XMi our registration form here]. The deadline to register is Saturday April 2. We will let participants know if we have room for them by Monday April 4. Space is limited and will depend on how many mentors we can recruit for the sessions and the sizes of the rooms we can secure.<br />
<br />
'''''Interested in being a mentor?''''' If you already have experience with Python, please consider helping out at the sessions as a mentor. Being a mentor will involve working with participants and talking them through the challenges they encounter in programming. No special preparation is required. And we'll feed you! Because we want to keep a very high mentor-to-student ratio, recruiting more mentors means we can accept more participants. If you're interested you can [http://goo.gl/forms/6Ws3iIi6Y6 fill out this form] or email makohill@uw.edu. Also, thank you, thank you, thank you!<br />
<br />
<!-- Unfortunately, registration is over and we were oversubscribed and we have a large waitlist. Sorry about that! This is our third set of workshops and we do hope to run more of these again in the future. --><br />
<br />
== Schedule ==<br />
<br />
There will be a mandatory evening setup session '''6:00-9:00pm on Friday April 8''' and three workshops held from '''9:45am-4pm on three Saturdays (April 9 and 23 and May 7)'''. Each Saturday session will involve a period for lecture and technical demonstrations in the morning. This will be followed by a lunch graciously provided by the [http://escience.washington.edu/ eScience Institute at UW]. The rest of the day will be followed by group work on programming and data science projects supported by more experienced mentors.<br />
<br />
'''All sessions are interactive and involve you programming on your own and on your own laptop. Everybody attending should bring a laptop and a power cord so that they don't run out of battery.'''<br />
<br />
=== Session 0: Setup and Programming Tutorial (Friday April 8 evening)===<br />
:'''Time''': 6-9pm<br />
:'''Location''': Come to '''[http://www.washington.edu/maps/#!/cmu (CMU) 104'''. <br />
:'''Material''': <font size="+1">[[CDSW/Day 0 setup and tutorial|Click here for the the setup and tutorial material.]]</font><br />
<br />
: '''Content''': During this session, mentors will help you:<br />
<br />
:: set up your development environment<br />
:: learn how to execute Python code from a file and interactively from a Python prompt<br />
:: learn about printing and using Python as a calculator<br />
<br />
'''Note''': Because we expect to hit the ground running on our first full day, we will meet to help participants get software installed and to work through a self-guided tutorial that will help ensure that everyone has the skills and vocabulary to start programming and learning when we meet the following morning.<br />
<!-- :'''Material''': <font size="+1">[[Community Data Science Workshops (Spring 2016)/Day 0 setup and tutorial|Click here for the the setup and tutorial material.]]</font>--><br />
<br />
<!--Come to '''[http://www.washington.edu/maps/#!/cmu Communications (CMU) 104] between 6:00 and 9:00pm.''' It's OK if you come a little late but you'll want to have as much time as you can to finish the setup and self-directed assignments so come as close to 6:30pm as you can. Most people will finish early but some people will definitely need the full 3 hours. It's hard to know in advance where problems will crop up so please come on time even if you are confident. --><br />
<br />
<br />
=== Session 1: Introduction to Programming (April 9) ===<br />
Come to '''[http://uw.edu/maps/?sav Savery Hall (SAV) 260] by 9:45am'''. You will need time to get settled and setup. We will start lecturing promptly at 10am. There will be coffee!<br />
<br />
: '''Time:''' 9:45am-4pm<br />
<br />
: '''Location:''' [http://uw.edu/maps/?sav Savery Hall (SAV)]<br />
<br />
: '''Schedule'''<br />
:: '''Morning, 10am-12:20 (SAV 260)''': [[CDSW/Day_1_lecture|A 2 hour lecture-based introduction to the Python programming language]]<br />
:: '''Lunch, 12:20-1pm (TBD)''': We'll provide lunch<br />
:: '''Afternoon, 1pm-3:30pm (TBD):''' Python practice through short projects on a variety of fun and practical topics<br />
:: '''Wrap-up, 3:30pm-4pm (SAV 260):''' Wrap-up, next steps, and upcoming opportunities for learning and practicing Python<br />
<br />
: '''Content''': Programming is an essential tool for data science and is useful for solving many other problems. The goal of this session will be to introduce programming in the [http://www.python.org/ Python programming language]. Each participant will leave having solved a real problem and will have built their first real programming project.<br />
<br />
: '''Projects'''<br />
:: [http://wiki.communitydata.cc/Baby_Names | Baby Names]<br />
:: [http://wiki.communitydata.cc/Code_Academy | Code Academy]<br />
<br />
=== Session 2: Importing Data from web APIs (April 23) ===<br />
You will need time to get settled and setup. We will start lecturing promptly at 10am. There will be coffee!<br />
<br />
: '''Time:''' 9:45am-4pm<br />
<br />
: '''Location:''' [http://uw.edu/maps/?sav Savery Hall (SAV)] <br />
<br />
: '''Schedule'''<br />
:: '''Morning: 10am-12:20 (SAV 260)''': [[CDSW/Day_2_lecture|A 2 hour lecture-based introduction to the web programming and APIs]]<br />
:: '''Lunch: 12:20-1pm (TBD)''': We'll provide lunch (TBD)<br />
:: '''Afternoon: 1pm-3:30pm (TBD)'''<br />
:: '''Wrap-up: 3:30pm-4pm (SAV 260)''': Wrap-up, next steps, and upcoming opportunities for learning and practicing Python<br />
<br />
: '''Content''': An important step in doing data science is collecting data. The goal of this session will be to teach participants how to get data from the [https://en.wikipedia.org/wiki/Application_programming_interface public application programming interfaces] ("APIs") common to many social media and online communities. Although we will use the APIs provided by Wikipedia, Twitter, and Socrata in the session, the principles and techniques are common to many other online communities.<br />
<br />
: An outline for the lecture can be found [[Community_Data_Science_Workshops_(Spring_2016)/Day_2_Lecture|here]], and some info about the projects can be found [[Community_Data_Science_Workshops_(Spring_2016)/Day_2_Projects|here]].<br />
<br />
;Projects<br />
* [[Community_Data_Science_Workshops_(Spring_2016)/Day_2_Projects/Twitter|Twitter]]<br />
* [[Community_Data_Science_Workshops_(Spring_2016)/Day_2_Projects/Wikipedia|Wikipedia]]<br />
* [[Community_Data_Science_Workshops_(Spring_2016)/Day_2_Projects/Socrata|Socrata (data.seattle.gov)]]<br />
<br />
'''Important Note:''' If you plan to attend the Twitter afternoon session, you need to complete the [[Twitter authentication setup]] ''before'' the afternoon setup on Saturday.<br />
<br />
=== Session 3: Data Analysis and Visualization (May 7) ===<br />
You will need time to get settled and setup. We will start lecturing promptly at 10am. There will be coffee!<br />
<br />
: '''Time:''' 9:45am-4pm<br />
<br />
: '''Location:''' [http://uw.edu/maps/?sav Savery Hall (SAV) 260]<br />
<br />
: '''Schedule'''<br />
<br />
:: '''Morning, 10am-12:20 (SAV 260):''' [[Community_Data_Science_Workshops_(Spring_2016)/Day_3_Lecture|2 hour interactive lecture]]<br />
:: '''Lunch, 12:20-1pm (TBD):''' We'll provide lunch (vegetarian Greek)<br />
:: '''Afternoon, 1pm-3:30pm (TBD):''' Web API practice through '''''[[Community_Data_Science_Workshops_(Spring_2016)/Day_3_Projects|independent projects]]'''''<br />
:: '''Wrap-up, 3:30-4pm (SAV 260)<br />
<br />
: '''Content''': The goal of data science is to use data to answer questions. In our final session, we will use the Python skills we learned in the first session and the datasets we've created in the second to ask and answer common questions about the activity and health of online communities. We will focus on learning how to generate visualizations, create summary statistics, and test hypotheses.<br />
<br />
== Resources ==<br />
<br />
The following materials are currently being updated by the mentors:<br />
<br />
* [[Community Data Science Workshops (Spring 2016)/Day 0 setup and tutorial|Friday April 8th setup and tutorial]]<br />
* [[Community Data Science Workshops (Spring 2016)/Day 1 lecture|Saturday April 9th lecture]]<br />
* [[Community Data Science Workshops (Spring 2016)/Day 1 projects|Saturday April 9th projects]]<br />
* [http://www.codecademy.com/courses/python-beginner-en-kSQwt Introduction to Python CodeAcademy exercises]<br />
* [[Twitter authentication setup]]<br />
* [[Community Data Science Workshops (Spring 2016)/Day 2 lecture|Saturday April 27th lecture]]<br />
* [[Community Data Science Workshops (Spring 2016)/Day 2 projects|Saturday April 27th projects]]<br />
* [http://www.codecademy.com/tracks/apis-python Introduction to APIs in Python CodeAcademy exercises] - Includes information on using APIs from [http://npr.org/ NPR], [http://bit.ly Bitly], [https://sunlightfoundation.com/ Sunlight Foundation], and [http://placekitten.com/ PlaceKitten]<br />
* [[Community Data Science Workshops (Spring 2016)/Day 3 lecture|Saturday May 7th lecture]]<br />
* [[Community Data Science Workshops (Spring 2016)/Day 3 projects|Saturday May 7th projects]]<br />
<br />
== Venue and Logistics ==<br />
<br />
=== What to bring ===<br />
# a '''laptop'''<br />
#* for '''Session 0''' make sure that you have about 1GB of space free so you can install Python and all the necessary other software<br />
#* for '''Sessions 1-3''' bring your laptop with Python set up<br />
# a '''power cord'''<br />
# a '''sense of adventure!'''<br />
<br />
=== Contact information ===<br />
<br />
If you have any questions about the events, you can contact [mailto:makohill@uw.edu makohill@uw.edu].<br />
<br />
=== Location ===<br />
<br />
<!-- The [http://www.com.washington.edu University of Washington Department of Communication] is hosting the event and all of our events '''except the Saturday morning lectures''' will be held in the '''Communications building (CMU)''' on the Seattle UW campus. This includes the Friday setup and the and all of the afternoon projects. You can find the building on [https://maps.google.com/maps?q=CMU+Building&hl=en&ll=47.655675,-122.306435&spn=0.018732,0.016394&sll=47.613028,-122.342064&sspn=0.599907,0.524597&hq=CMU+Building&t=m&z=16 this Google map] or on [http://www.washington.edu/maps/ this campus map from UW].<br />
<br />
Because we have grown so big, we have had to move the lectures into a larger lecture hall than the CMU building has available. Please meet at '''Savery Hall 260''' ([http://uw.edu/maps/?sav map]) on '''the three Saturday mornings at 9:45'''. It is about a five minute walk from the Communications building. Unfortunately, most of the doors to Savery Hall are locked on weekends. The door on the '''west side of the building''' (i.e., the one nearest Kane Hall) should be open.<br />
<br />
Parking at UW is available but is not free. There is [https://www.washington.edu/facilities/transportation/commuterservices/parking/selfserve self-serve parking] as well as gatehouses that are staffed from 7am on Saturday and can issue you parking passes and point you to an appropriate lot. More details are on the [https://www.washington.edu/facilities/transportation/commuterservices/parking/daily UW Commuter Services website for Visitors and Guests]. UW is also well served by public transportation and easily accessible by bicycle with the [https://en.wikipedia.org/wiki/Burke_Gilman_Trail Burke Giilman Trail].<br />
--><br />
<br />
=== Food ===<br />
<br />
Thanks to generous sponsorship by the [http://escience.washington.edu/ eScience Institute at UW], we will provide catered lunchs during the Saturday sessions. Although we haven't figured out the menu, the food will all be vegetarian and there will be vegan and gluten free options. If the food we have doesn't doesn't work for you, there is a food court open for lunch in [http://depts.washington.edu/thehub/ the HUB] (the UW student center) that is almost directly next door.<br />
<br />
=== Social Media ===<br />
<br />
* We use the hashtag [http://twitter.com/#!/search?q=%23cdsw #cdsw]<br />
<br />
== About the Organizers ==<br />
<br />
The workshops are being coordinated, organized by [http://mako.cc/academic/ Benjamin Mako Hill], [http://jtmorgan.net/ Jonathan Morgan], [https://guyrt.github.io/ Tommy Guy], Ben Lewis, Dharma Dailey, and a long list of other volunteer mentors. The workshops have been designed with lots of help and inspiration from Shauna Gordon-McKeon and Asheesh Laroia of OpenHatch and lots of inspiration from the [http://bostonpythonworkshop.com/ Boston Python Workshop].<br />
<br />
These workshops are an all-volunteer effort. Fundamentally, we're doing this because we're programmers and data scientists who work in online communities and we really believe that the skills you'll learn in these sessions are important and empowering tools.<br />
<br />
The workshops are being supported by the [http://www.com.washington.edu/ UW Department of Communication] and the [http://escience.washington.edu/ eScience Institute].<br />
<br />
If you have any questions or concerns, please contact Benjamin Mako Hill at makohill@uw.edu.<br />
<br />
[[File:Dept.Comm_UW_vertical_small_square.jpg|180px]]<br />
[[File:EScience Logo RGB.png|250px]]<br />
<br />
[[Category:Spring 2016 series]]</div>Ddaileyhttps://wiki.communitydata.science/index.php?title=Community_Data_Science_Workshops_(Spring_2016)&diff=82728Community Data Science Workshops (Spring 2016)2016-04-04T00:38:27Z<p>Ddailey: </p>
<hr />
<div><div style="float:right;"><br />
<div style="margin-left:20px; padding-left:1em; text-align:center;"><br />
{| class="infobox" style="width: 600px; background-color:#ADC2E4"<br />
| colspan="2" | '''<span class="plainlinks" style="font-weight:bold; font-size:2em; text-align:center;">[http://goo.gl/forms/7TZ9cM0XMi Register for the workshop]</span>''' <br />
<span class="plainlinks" style="margin-left:1em;">Registration closes on '''April 2.''' ''Have experience to share? [http://goo.gl/forms/6Ws3iIi6Y6 Sign up to be a mentor]</span>''<br />
|}<br />
</div><br />
[[Image:Cdsw combo images-1.jpg|thumb|600px|[[Community Data Science Workshops/Photos|More photos from past workshops]].]]<br />
<div style="clear: both;"></div><br />
</div><br />
<br />
The '''Community Data Science Workshops in Spring 2016''' are a series of project-based workshops being held at the University of Washington for anyone interested in learning how to use programming and data science tools to ask and answer questions about online communities like [http://en.wikipedia.org/ Wikipedia], [http://twitter.com Twitter], [[:w:Free software|free and open source software, and]] civic media.<br />
<br />
The Spring 2016 workshop series will take place over three Saturdays (plus a short Friday night setup session):<br />
<br />
* Friday, April 8th (6-9pm)<br />
* Saturday, April 9th (9:45-4pm)<br />
* Saturday, April 23th (9:45-4pm)<br />
* Saturday, May 7th (9:45-4pm)<br />
<br />
'''These workshops are for people with absolutely no previous programming experience''' and they bring together researchers and academics with participants and leaders in online communities. The workshops are run entirely by volunteers and are entirely free of charge for participants, generously sponsored by the [http://www.com.washington.edu/ UW Department of Communication] and the [http://escience.washington.edu/ eScience Institute]. Participants from outside UW are encouraged to apply.<br />
<br />
Our goal is that, after the three workshops, participants will be able to use data to produce numbers, hypothesis tests, tables, and graphical visualizations to answer questions like:<br />
<br />
* Are new contributors in Wikipedia this year sticking around longer or contributing more than people who joined last year?<br />
* Who are the most active or influential users of a particular Twitter hashtag?<br />
* Are people who join through a Wikipedia outreach event staying involved? How do they compare to people who decide to join the project outside of the event?<br />
<br />
We've run these workshops four times before in 2014 and 2015 and [[CDSW|the curriculum we used for previous sessions is all online]].<br />
<br />
== Registration ==<br />
<br />
'''''Participants!''''' If you are interested in learning data science, please fill out [http://goo.gl/forms/7TZ9cM0XMi our registration form here]. The deadline to register is Saturday April 2. We will let participants know if we have room for them by Monday April 4. Space is limited and will depend on how many mentors we can recruit for the sessions and the sizes of the rooms we can secure.<br />
<br />
'''''Interested in being a mentor?''''' If you already have experience with Python, please consider helping out at the sessions as a mentor. Being a mentor will involve working with participants and talking them through the challenges they encounter in programming. No special preparation is required. And we'll feed you! Because we want to keep a very high mentor-to-student ratio, recruiting more mentors means we can accept more participants. If you're interested you can [http://goo.gl/forms/6Ws3iIi6Y6 fill out this form] or email makohill@uw.edu. Also, thank you, thank you, thank you!<br />
<br />
<!-- Unfortunately, registration is over and we were oversubscribed and we have a large waitlist. Sorry about that! This is our third set of workshops and we do hope to run more of these again in the future. --><br />
<br />
== Schedule ==<br />
<br />
There will be a mandatory evening setup session '''6:00-9:00pm on Friday April 8''' and three workshops held from '''9:45am-4pm on three Saturdays (April 9 and 23 and May 7)'''. Each Saturday session will involve a period for lecture and technical demonstrations in the morning. This will be followed by a lunch graciously provided by the [http://escience.washington.edu/ eScience Institute at UW]. The rest of the day will be followed by group work on programming and data science projects supported by more experienced mentors.<br />
<br />
'''All sessions are interactive and involve you programming on your own and on your own laptop. Everybody attending should bring a laptop and a power cord so that they don't run out of battery.'''<br />
<br />
=== Session 0: Setup and Programming Tutorial (Friday April 8 evening)===<br />
:'''Time''': 6-9pm<br />
:'''Location''': TBD<br />
:'''Material''': <font size="+1">[[CDSW/Day 0 setup and tutorial|Click here for the the setup and tutorial material.]]</font><br />
<br />
:'''Note:''' Because we expect to hit the ground running on our first full day, we will meet to help participants get software installed and to work through a self-guided tutorial that will help ensure that everyone has the skills and vocabulary to start programming and learning when we meet the following morning.<br />
<!-- :'''Material''': <font size="+1">[[Community Data Science Workshops (Spring 2016)/Day 0 setup and tutorial|Click here for the the setup and tutorial material.]]</font>--><br />
<br />
<!--Come to '''[http://www.washington.edu/maps/#!/cmu Communications (CMU) 104] between 6:00 and 9:00pm.''' It's OK if you come a little late but you'll want to have as much time as you can to finish the setup and self-directed assignments so come as close to 6:30pm as you can. Most people will finish early but some people will definitely need the full 3 hours. It's hard to know in advance where problems will crop up so please come on time even if you are confident. --><br />
<br />
During this session, mentors will help you:<br />
<br />
* set up your development environment<br />
* learn how to execute Python code from a file and interactively from a Python prompt<br />
* learn about printing and using Python as a calculator<br />
<br />
=== Session 1: Introduction to Programming (April 9) ===<br />
:'''Time:''' 9:45am-4pm<br />
:'''Location:''' TBD<!-- Morning in [http://uw.edu/maps/?sav Savery Hall (SAV) 260]; Afternoon in [http://www.washington.edu/maps/#!/cmu Communications (CMU)] 104, 126 and 242<br />
<br />
Come to '''[http://uw.edu/maps/?sav Savery Hall (SAV) 260] by 9:45am''' (Note: it's ''not'' in the communication building). You will need time to get settled and setup. We will start lecturing promptly at 10am. There will be coffee!<br />
<br />
* '''Morning, 10am-12:20:''' [[Community Data Science Workshops (Spring 2016)/Day 1 lecture|A 2 hour lecture-based introduction to the Python programming language]]<br />
* '''Lunch, 12:20-1pm''': We'll provide lunch<br />
* '''Afternoon, 1pm-3:30pm (Room 104, 126, 242):''' [[Community Data Science Workshops (Spring 2016)/Day 1 projects|Python practice through short projects on a variety of fun and practical topics]]<br />
* '''Wrap-up, 3:30pm-4pm:''' Wrap-up, next steps, and upcoming opportunities for learning and practicing Python<br />
--><br />
<br />
Programming is an essential tool for data science and is useful for solving many other problems. The goal of this session will be to introduce programming in the [http://www.python.org/ Python programming language]. Each participant will leave having solved a real problem and will have built their first real programming project.<br />
<br />
=== Session 2: Importing Data from web APIs (April 23) ===<br />
You will need time to get settled and setup. We will start lecturing promptly at 10am. There will be coffee!<br />
<br />
'''Time:''' 9:45am-4pm<br />
<br />
'''Location:''' [http://uw.edu/maps/?sav Savery Hall (SAV)] <br />
<br />
'''Schedule'''<br />
: '''Morning: 10am-12:20 (SAV 260):''' [[Community Data Science Workshops (Sprint 2016)/Day 2 lection|A 2 hour lecture-based introduction to the web programming and APIs]]<br />
: '''Lunch: 12:20-1pm (TBD):''' We'll provide lunch (TBD)<br />
: '''Afternoon: 1pm-3:30pm (TBD):''' Web API practice through [[Community_Data_Science_Workshops_(Spring_2016)/Day_2_Projects|short projects on a variety of fun and practical topics]]<br />
: '''Wrap-up: 3:30pm-4pm (SAV 260):''' Wrap-up, next steps, and upcoming opportunities for learning and practicing Python<br />
<br />
'''Content'''<br />
<br />
An important step in doing data science is collecting data. The goal of this session will be to teach participants how to get data from the [https://en.wikipedia.org/wiki/Application_programming_interface public application programming interfaces] ("APIs") common to many social media and online communities. Although we will use the APIs provided by Wikipedia, Twitter, and Socrata in the session, the principles and techniques are common to many other online communities.<br />
<br />
An outline for the lecture can be found [[Community_Data_Science_Workshops_(Spring_2016)/Day_2_Lecture|here]], and some info about the projects can be found [[Community_Data_Science_Workshops_(Spring_2016)/Day_2_Projects|here]].<br />
<br />
;Projects<br />
* [[Community_Data_Science_Workshops_(Spring_2016)/Day_2_Projects/Twitter|Twitter]]<br />
* [[Community_Data_Science_Workshops_(Spring_2016)/Day_2_Projects/Wikipedia|Wikipedia]]<br />
* [[Community_Data_Science_Workshops_(Spring_2016)/Day_2_Projects/Socrata|Socrata (data.seattle.gov)]]<br />
<br />
'''Important Note:''' If you plan to attend the Twitter afternoon session, you need to complete the [[Twitter authentication setup]] ''before'' the afternoon setup on Saturday.<br />
<br />
=== Session 3: Data Analysis and Visualization (May 7) ===<br />
<br />
:'''Time:''' 9:45am-4pm<br />
:'''Location:''' TBD <!-- Morning in [http://uw.edu/maps/?sav Savery Hall (SAV) 260]; Afternoon in [http://www.washington.edu/maps/#!/cmu Communications (CMU)] 104, 126 and 242<br />
<br />
Come to '''[http://uw.edu/maps/?sav Savery Hall (SAV) 260] by 9:45am''' (Note: it's ''not'' in the communication building). You will need time to get settled and setup. We will start lecturing promptly at 10am. There will be coffee!--><br />
<br />
The goal of data science is to use data to answer questions. In our final session, we will use the Python skills we learned in the first session and the datasets we've created in the second to ask and answer common questions about the activity and health of online communities. We will focus on learning how to generate visualizations, create summary statistics, and test hypotheses.<br />
<!--<br />
* '''Morning, 10am-12:20 (SAV 260):''' [[Community_Data_Science_Workshops_(Spring_2016)/Day_3_Lecture|2 hour interactive lecture]]<br />
* '''Lunch, 12:20-1pm (CMU 126):''' We'll provide lunch (vegetarian Greek)<br />
* '''Afternoon, 1pm-3:30pm (CMU 104, 126, 242):''' Web API practice through '''''[[Community_Data_Science_Workshops_(Spring_2016)/Day_3_Projects|independent projects]]'''''<br />
--><br />
<!--<br />
== Resources ==<br />
<br />
The following materials are currently being updated by the mentors:<br />
<br />
* [[Community Data Science Workshops (Spring 2016)/Day 0 setup and tutorial|Friday April 10th setup and tutorial]]<br />
* [[Community Data Science Workshops (Spring 2016)/Day 1 lecture|Saturday April 11th lecture]]<br />
* [[Community Data Science Workshops (Spring 2016)/Day 1 projects|Saturday April 11th projects]]<br />
* [http://www.codecademy.com/courses/python-beginner-en-kSQwt Introduction to Python CodeAcademy exercises]<br />
* [[Twitter authentication setup]]<br />
* [[Community Data Science Workshops (Spring 2016)/Day 2 lecture|Saturday April 25th lecture]]<br />
* [[Community Data Science Workshops (Spring 2016)/Day 2 projects|Saturday April 25th projects]]<br />
* [http://www.codecademy.com/tracks/apis-python Introduction to APIs in Python CodeAcademy exercises] - Includes information on using APIs from [http://npr.org/ NPR], [http://bit.ly Bitly], [https://sunlightfoundation.com/ Sunlight Foundation], and [http://placekitten.com/ PlaceKitten]<br />
* [[Community Data Science Workshops (Spring 2016)/Day 3 lecture|Saturday May 9th lecture]]<br />
* [[Community Data Science Workshops (Spring 2016)/Day 3 projects|Saturday May 9th projects]]<br />
<br />
== Venue and Logistics ==<br />
<br />
=== Contact information ===<br />
<br />
If you have any questions about the events, you can contact [mailto:makohill@uw.edu makohill@uw.edu].<br />
<br />
=== Location ===<br />
<br />
The [http://www.com.washington.edu University of Washington Department of Communication] is hosting the event and all of our events '''except the Saturday morning lectures''' will be held in the '''Communications building (CMU)''' on the Seattle UW campus. This includes the Friday setup and the and all of the afternoon projects. You can find the building on [https://maps.google.com/maps?q=CMU+Building&hl=en&ll=47.655675,-122.306435&spn=0.018732,0.016394&sll=47.613028,-122.342064&sspn=0.599907,0.524597&hq=CMU+Building&t=m&z=16 this Google map] or on [http://www.washington.edu/maps/ this campus map from UW].<br />
<br />
Because we have grown so big, we have had to move the lectures into a larger lecture hall than the CMU building has available. Please meet at '''Savery Hall 260''' ([http://uw.edu/maps/?sav map]) on '''the three Saturday mornings at 9:45'''. It is about a five minute walk from the Communications building. Unfortunately, most of the doors to Savery Hall are locked on weekends. The door on the '''west side of the building''' (i.e., the one nearest Kane Hall) should be open.<br />
<br />
Parking at UW is available but is not free. There is [https://www.washington.edu/facilities/transportation/commuterservices/parking/selfserve self-serve parking] as well as gatehouses that are staffed from 7am on Saturday and can issue you parking passes and point you to an appropriate lot. More details are on the [https://www.washington.edu/facilities/transportation/commuterservices/parking/daily UW Commuter Services website for Visitors and Guests]. UW is also well served by public transportation and easily accessible by bicycle with the [https://en.wikipedia.org/wiki/Burke_Gilman_Trail Burke Giilman Trail].<br />
<br />
=== What to bring ===<br />
# a '''laptop'''<br />
#* for '''Session 0''' make sure that you have about 1GB of space free so you can install Python and all the necessary other software<br />
#* for '''Sessions 1-3''' bring your laptop with Python set up<br />
# a '''power cord'''<br />
# a '''sense of adventure!'''<br />
--><br />
<br />
=== Food ===<br />
<br />
Thanks to generous sponsorship by the [http://escience.washington.edu/ eScience Institute at UW], we will provide catered lunchs during the Saturday sessions. Although we haven't figured out the menu, the food will all be vegetarian and there will be vegan and gluten free options. If the food we have doesn't doesn't work for you, there is a food court open for lunch in [http://depts.washington.edu/thehub/ the HUB] (the UW student center) that is almost directly next door.<br />
<br />
=== Social Media ===<br />
<br />
* We use the hashtag [http://twitter.com/#!/search?q=%23cdsw #cdsw]<br />
<br />
== About the Organizers ==<br />
<br />
The workshops are being coordinated, organized by [http://mako.cc/academic/ Benjamin Mako Hill], [http://jtmorgan.net/ Jonathan Morgan], [https://guyrt.github.io/ Tommy Guy], Ben Lewis, Dharma Dailey, and a long list of other volunteer mentors. The workshops have been designed with lots of help and inspiration from Shauna Gordon-McKeon and Asheesh Laroia of OpenHatch and lots of inspiration from the [http://bostonpythonworkshop.com/ Boston Python Workshop].<br />
<br />
These workshops are an all-volunteer effort. Fundamentally, we're doing this because we're programmers and data scientists who work in online communities and we really believe that the skills you'll learn in these sessions are important and empowering tools.<br />
<br />
The workshops are being supported by the [http://www.com.washington.edu/ UW Department of Communication] and the [http://escience.washington.edu/ eScience Institute].<br />
<br />
If you have any questions or concerns, please contact Benjamin Mako Hill at makohill@uw.edu.<br />
<br />
[[File:Dept.Comm_UW_vertical_small_square.jpg|180px]]<br />
[[File:EScience Logo RGB.png|250px]]<br />
<br />
[[Category:Fall 2016 series]]</div>Ddaileyhttps://wiki.communitydata.science/index.php?title=Twitter_analysis_(CDSW)&diff=31229Twitter analysis (CDSW)2015-11-07T18:41:55Z<p>Ddailey: /* Details */</p>
<hr />
<div>__NOTOC__<br />
== Getting Started ==<br />
<br />
Download zipped file with a 10% sample of tweets from [https://s3-us-west-2.amazonaws.com/cc.communitydata.tweetstream/twitter_wk3_withdata.zip here].<br />
<br />
Extract the zipped file to your desktop and cd into it.<br />
<br />
== Analyzing Tweet Data with Python ==<br />
<br />
Last week, the [[Community_Data_Science_Workshops_%28Fall_2015%29/Day_2_projects/Twitter|Twitter API Session]] covered accessing data from the Twitter API, including accessing streaming data. After the session, we set up a streaming collection from the code you modified in the workshop to track all earthquake-related tweets. That stream captured 3.5GB of tweets (!). We've given you a sample of those tweets in the zipped file above.<br />
<br />
Our goal in this workshop is to use those tweets to answer questions. As always, we've suggested questions below, but the real goal is for you to find something that you find interesting from the data.<br />
<br />
Your data consists of 1 Tweet per line encoded in JSON exactly as Twitter returns it.<br />
<br />
Looking at the Twitter API documentation will help you make sense of that funny looking JSON data: [https://dev.twitter.com/overview/api]<br />
<br />
== Goals ==<br />
<br />
Starting with the sample program, try to answer the following questions. The first one is done for you!<br />
<br />
* Build a histogram of tweets per day. Use it to identify potential events. We'll use python to make a CSV file that we can import to a spreadsheet.<br />
* Change your program to plot the number of users that are tweeting.<br />
* Pick an interesting time period from the data. Can you figure out where an event took place based on the locale of the user? What about geographic information? <br />
* Who gets retweeted the most in the data set?<br />
* Modify your histogram to look at tweets per hour rather than per day.<br />
* Use your imagination! What else can you find?<br />
<br />
== Hints and New Material ==<br />
<br />
This section lists a few new topics.<br />
<br />
'''CSV Files'''<br />
<br />
Comma-Separated Values (CSV) is a common way to store structured data in a text file. An example CSV file would be:<br />
<br />
Day,NumUsers<br />
2015-11-03,345<br />
2015-11-04,451<br />
...<br />
<br />
The nice thing about CSV files is that spreadsheet programs like Microsoft Excel can import them, so it's easy to plot columns. <br />
<br />
'''Dates and times'''<br />
<br />
Python provides a rich datetime functionality available via <code>import datetime</code>. We encourage you to look at the documentation at [https://github.com/offbyone/tweetstream]. In our examples, the only function we'll use is the ability to create strings from datetimes. Everything we need is in this example.<br />
<br />
<br />
<syntaxhighlight lang="python"><br />
import datetime<br />
for line in tweets:<br />
tweet_as_dictionary = json.loads(line)<br />
tweet_daytime = datetime.datetime.fromtimestamp(int(tweet_as_dictionary['timestamp_ms']) / 1000)<br />
tweet_day = tweet_daytime.strftime('%Y-%m-%d')<br />
</syntaxhighlight><br />
<br />
The line <code>int(tweet_as_dictionary['timestamp_ms']) / 1000</code> does a few things:<br />
* extract the timestamp_ms field from the tweet. This is the tweet time measured in number of milliseconds since Jan 1, 1970. See [https://en.wikipedia.org/wiki/Unix_time] for more details.<br />
* divide the timestamp in milliseconds by 1000 to get the number of seconds since Jan 1, 1970.<br />
* convert it to a datetime in python.<br />
<br />
The other line that matters is <code>tweet_day = tweet_daytime.strftime('%Y-%m-%d')</code>, which takes the datetime and converts it to a string. The characters <code>%Y-%m-%d</code> describe the string format. The codes can be found in the documentation [https://docs.python.org/2/library/datetime.html#strftime-strptime-behavior]. For our purposes, here are the codes and the portion of the date they represent for the date "2015-11-06 14:52:12":<br />
<br />
* %Y - 2015<br />
* %m - 11<br />
* %d - 06<br />
* %H - 14 (note 24 hour time)<br />
* %M - 52<br />
* %S - 12<br />
<br />
== Details == <br />
<br />
'''Sampling'''<br />
<br />
Since the raw data is too large for everyone to download locally, we had to down sample to a reasonable sub-set. Down sampling usually involves choosing a random subset of the raw data, but it's important to think about how that sample is constructed. For instance, consider two sampling criteria for a 1% sample: by tweet and by user. Sampling by tweet means that every single tweet has a 1 in 100 chance of being in the sample. However, what if I want to count the number of tweets per user? Since I don't have all the tweets for any particular user, my estimate is going to be wrong. Sampling by user lets me capture all of the tweets by an account or none of them. This way I can still estimate the number of tweets in a time period and I can also make valid measurements of per-user metrics.<br />
<br />
'''Full source code'''<br />
<br />
The full source code of this exercise is available on github at [https://github.com/offbyone/tweetstream]. The examples are in the section <code>students</code></div>Ddaileyhttps://wiki.communitydata.science/index.php?title=Twitter_analysis_(CDSW)&diff=31228Twitter analysis (CDSW)2015-11-07T18:20:52Z<p>Ddailey: /* Analyzing Tweet Data with Python */</p>
<hr />
<div>__NOTOC__<br />
== Getting Started ==<br />
<br />
Download zipped file with a 10% sample of tweets from [https://s3-us-west-2.amazonaws.com/cc.communitydata.tweetstream/twitter_wk3_withdata.zip here].<br />
<br />
Extract the zipped file to your desktop and cd into it.<br />
<br />
== Analyzing Tweet Data with Python ==<br />
<br />
Last week, the [[Community_Data_Science_Workshops_%28Fall_2015%29/Day_2_projects/Twitter|Twitter API Session]] covered accessing data from the Twitter API, including accessing streaming data. After the session, we set up a streaming collection from the code you modified in the workshop to track all earthquake-related tweets. That stream captured 3.5GB of tweets (!). We've given you a sample of those tweets in the zipped file above.<br />
<br />
Our goal in this workshop is to use those tweets to answer questions. As always, we've suggested questions below, but the real goal is for you to find something that you find interesting from the data.<br />
<br />
Your data consists of 1 Tweet per line encoded in JSON exactly as Twitter returns it.<br />
<br />
Looking at the Twitter API documentation will help you make sense of that funny looking JSON data: [https://dev.twitter.com/overview/api]<br />
<br />
== Goals ==<br />
<br />
Starting with the sample program, try to answer the following questions. The first one is done for you!<br />
<br />
* Build a histogram of tweets per day. Use it to identify potential events. We'll use python to make a CSV file that we can import to a spreadsheet.<br />
* Change your program to plot the number of users that are tweeting.<br />
* Pick an interesting time period from the data. Can you figure out where an event took place based on the locale of the user? What about geographic information? <br />
* Who gets retweeted the most in the data set?<br />
* Modify your histogram to look at tweets per hour rather than per day.<br />
* Use your imagination! What else can you find?<br />
<br />
== Hints and New Material ==<br />
<br />
This section lists a few new topics.<br />
<br />
'''CSV Files'''<br />
<br />
Comma-Separated Values (CSV) is a common way to store structured data in a text file. An example CSV file would be:<br />
<br />
Day,NumUsers<br />
2015-11-03,345<br />
2015-11-04,451<br />
...<br />
<br />
The nice thing about CSV files is that spreadsheet programs like Microsoft Excel can import them, so it's easy to plot columns. <br />
<br />
'''Dates and times'''<br />
<br />
Python provides a rich datetime functionality available via <code>import datetime</code>. We encourage you to look at the documentation at [https://github.com/offbyone/tweetstream]. In our examples, the only function we'll use is the ability to create strings from datetimes. Everything we need is in this example.<br />
<br />
<br />
<syntaxhighlight lang="python"><br />
import datetime<br />
for line in tweets:<br />
tweet_as_dictionary = json.loads(line)<br />
tweet_daytime = datetime.datetime.fromtimestamp(int(tweet_as_dictionary['timestamp_ms']) / 1000)<br />
tweet_day = tweet_daytime.strftime('%Y-%m-%d')<br />
</syntaxhighlight><br />
<br />
The line <code>int(tweet_as_dictionary['timestamp_ms']) / 1000</code> does a few things:<br />
* extract the timestamp_ms field from the tweet. This is the tweet time measured in number of milliseconds since Jan 1, 1970. See [https://en.wikipedia.org/wiki/Unix_time] for more details.<br />
* divide the timestamp in milliseconds by 1000 to get the number of seconds since Jan 1, 1970.<br />
* convert it to a datetime in python.<br />
<br />
The other line that matters is <code>tweet_day = tweet_daytime.strftime('%Y-%m-%d')</code>, which takes the datetime and converts it to a string. The characters <code>%Y-%m-%d</code> describe the string format. The codes can be found in the documentation [https://docs.python.org/2/library/datetime.html#strftime-strptime-behavior]. For our purposes, here are the codes and the portion of the date they represent for the date "2015-11-06 14:52:12":<br />
<br />
* %Y - 2015<br />
* %m - 11<br />
* %d - 06<br />
* %H - 14 (note 24 hour time)<br />
* %M - 52<br />
* %S - 12<br />
<br />
== Details == <br />
<br />
'''Sampling'''<br />
<br />
Since the raw data is too large for everyone to download locally, we had to down sample to a reasonable sub-set. Down sampling usually involves choosing a random subset of the raw data, but it's important to think about how that sample is constructed. For instance, consider two sampling criteria for a 1% sample: by tweet and by user. Sampling by tweet means that every single tweet has a 1 in 100 chance of being in the sample. However, what if I want to count the number of tweets per user? Since I don't have all the tweets for any particular user, my estimate is going to be wrong. Sampling by user lets me capture all of the tweets by an account or none of them. This way I can still estimate the number of tweets in a time period and I can also make valid measurements of per-user metrics.<br />
<br />
'''Full source code'''<br />
<br />
The full source code of this exercise is available on github at [https://github.com/offbyone/tweetstream]. The examples are in the section <code>students</code><br />
<br />
Looking through Twitter's API documentation will help you make sense of the data we've collected: https://dev.twitter.com/overview/api</div>Ddaileyhttps://wiki.communitydata.science/index.php?title=Twitter_analysis_(CDSW)&diff=31227Twitter analysis (CDSW)2015-11-07T18:19:04Z<p>Ddailey: </p>
<hr />
<div>__NOTOC__<br />
== Getting Started ==<br />
<br />
Download zipped file with a 10% sample of tweets from [https://s3-us-west-2.amazonaws.com/cc.communitydata.tweetstream/twitter_wk3_withdata.zip here].<br />
<br />
Extract the zipped file to your desktop and cd into it.<br />
<br />
== Analyzing Tweet Data with Python ==<br />
<br />
Last week, the [[Community_Data_Science_Workshops_%28Fall_2015%29/Day_2_projects/Twitter|Twitter API Session]] covered accessing data from the Twitter API, including accessing streaming data. After the session, we set up a streaming collection from the code you modified in the workshop to track all earthquake-related tweets. That stream captured 3.5GB of tweets (!). We've given you a sample of those tweets in the zipped file above.<br />
<br />
Our goal in this workshop is to use those tweets to answer questions. As always, we've suggested questions below, but the real goal is for you to find something that you find interesting from the data.<br />
<br />
Your data consists of 1 Tweet per line encoded in JSON exactly as Twitter returns it.<br />
<br />
== Goals ==<br />
<br />
Starting with the sample program, try to answer the following questions. The first one is done for you!<br />
<br />
* Build a histogram of tweets per day. Use it to identify potential events. We'll use python to make a CSV file that we can import to a spreadsheet.<br />
* Change your program to plot the number of users that are tweeting.<br />
* Pick an interesting time period from the data. Can you figure out where an event took place based on the locale of the user? What about geographic information? <br />
* Who gets retweeted the most in the data set?<br />
* Modify your histogram to look at tweets per hour rather than per day.<br />
* Use your imagination! What else can you find?<br />
<br />
== Hints and New Material ==<br />
<br />
This section lists a few new topics.<br />
<br />
'''CSV Files'''<br />
<br />
Comma-Separated Values (CSV) is a common way to store structured data in a text file. An example CSV file would be:<br />
<br />
Day,NumUsers<br />
2015-11-03,345<br />
2015-11-04,451<br />
...<br />
<br />
The nice thing about CSV files is that spreadsheet programs like Microsoft Excel can import them, so it's easy to plot columns. <br />
<br />
'''Dates and times'''<br />
<br />
Python provides a rich datetime functionality available via <code>import datetime</code>. We encourage you to look at the documentation at [https://github.com/offbyone/tweetstream]. In our examples, the only function we'll use is the ability to create strings from datetimes. Everything we need is in this example.<br />
<br />
<br />
<syntaxhighlight lang="python"><br />
import datetime<br />
for line in tweets:<br />
tweet_as_dictionary = json.loads(line)<br />
tweet_daytime = datetime.datetime.fromtimestamp(int(tweet_as_dictionary['timestamp_ms']) / 1000)<br />
tweet_day = tweet_daytime.strftime('%Y-%m-%d')<br />
</syntaxhighlight><br />
<br />
The line <code>int(tweet_as_dictionary['timestamp_ms']) / 1000</code> does a few things:<br />
* extract the timestamp_ms field from the tweet. This is the tweet time measured in number of milliseconds since Jan 1, 1970. See [https://en.wikipedia.org/wiki/Unix_time] for more details.<br />
* divide the timestamp in milliseconds by 1000 to get the number of seconds since Jan 1, 1970.<br />
* convert it to a datetime in python.<br />
<br />
The other line that matters is <code>tweet_day = tweet_daytime.strftime('%Y-%m-%d')</code>, which takes the datetime and converts it to a string. The characters <code>%Y-%m-%d</code> describe the string format. The codes can be found in the documentation [https://docs.python.org/2/library/datetime.html#strftime-strptime-behavior]. For our purposes, here are the codes and the portion of the date they represent for the date "2015-11-06 14:52:12":<br />
<br />
* %Y - 2015<br />
* %m - 11<br />
* %d - 06<br />
* %H - 14 (note 24 hour time)<br />
* %M - 52<br />
* %S - 12<br />
<br />
== Details == <br />
<br />
'''Sampling'''<br />
<br />
Since the raw data is too large for everyone to download locally, we had to down sample to a reasonable sub-set. Down sampling usually involves choosing a random subset of the raw data, but it's important to think about how that sample is constructed. For instance, consider two sampling criteria for a 1% sample: by tweet and by user. Sampling by tweet means that every single tweet has a 1 in 100 chance of being in the sample. However, what if I want to count the number of tweets per user? Since I don't have all the tweets for any particular user, my estimate is going to be wrong. Sampling by user lets me capture all of the tweets by an account or none of them. This way I can still estimate the number of tweets in a time period and I can also make valid measurements of per-user metrics.<br />
<br />
'''Full source code'''<br />
<br />
The full source code of this exercise is available on github at [https://github.com/offbyone/tweetstream]. The examples are in the section <code>students</code><br />
<br />
Looking through Twitter's API documentation will help you make sense of the data we've collected: https://dev.twitter.com/overview/api</div>Ddaileyhttps://wiki.communitydata.science/index.php?title=Twitter_analysis_(CDSW)&diff=31225Twitter analysis (CDSW)2015-11-07T17:58:54Z<p>Ddailey: /* Goals */</p>
<hr />
<div>__NOTOC__<br />
== Getting Started ==<br />
<br />
Download zipped file with a 10% sample of tweets from [https://s3-us-west-2.amazonaws.com/cc.communitydata.tweetstream/twitter_wk3_withdata.zip here].<br />
<br />
Extract the zipped file to your desktop and cd into it.<br />
<br />
== Analyzing Tweet Data with Python ==<br />
<br />
Last week, the [[Community_Data_Science_Workshops_%28Fall_2015%29/Day_2_projects/Twitter|Twitter API Session]] covered accessing data from the Twitter API, including accessing streaming data. After the session, we set up a streaming collection from the code you modified in the workshop to track all earthquake-related tweets. That stream captured 3.5GB of tweets (!). We've given you a sample of those tweets in the zipped file above.<br />
<br />
Our goal in this workshop is to use those tweets to answer questions. As always, we've suggested questions below, but the real goal is for you to find something that you find interesting from the data.<br />
<br />
Your data consists of 1 Tweet per line encoded in JSON exactly as Twitter returns it.<br />
<br />
== Goals ==<br />
<br />
Starting with the sample program, try to answer the following questions. The first one is done for you!<br />
<br />
* Build a histogram of tweets per day. Use it to identify potential events. We'll use python to make a CSV file that we can import to a spreadsheet.<br />
* Change your program to plot the number of users that are tweeting.<br />
* Pick an interesting time period from the data. Can you figure out where an event took place based on the locale of the user? What about geographic information? <br />
* Who gets retweeted the most in the data set?<br />
* Modify your histogram to look at tweets per hour rather than per day.<br />
* Use your imagination! What else can you find?<br />
<br />
== Hints and New Material ==<br />
<br />
This section lists a few new topics.<br />
<br />
'''CSV Files'''<br />
<br />
Comma-Separated Values (CSV) is a common way to store structured data in a text file. An example CSV file would be:<br />
<br />
Day,NumUsers<br />
2015-11-03,345<br />
2015-11-04,451<br />
...<br />
<br />
The nice thing about CSV files is that spreadsheet programs like Microsoft Excel can import them, so it's easy to plot columns. <br />
<br />
'''Dates and times'''<br />
<br />
Python provides a rich datetime functionality available via <code>import datetime</code>. We encourage you to look at the documentation at [https://github.com/offbyone/tweetstream]. In our examples, the only function we'll use is the ability to create strings from datetimes. Everything we need is in this example.<br />
<br />
<br />
<syntaxhighlight lang="python"><br />
import datetime<br />
for line in tweets:<br />
tweet_as_dictionary = json.loads(line)<br />
tweet_daytime = datetime.datetime.fromtimestamp(int(tweet_as_dictionary['timestamp_ms']) / 1000)<br />
tweet_day = tweet_daytime.strftime('%Y-%m-%d')<br />
</syntaxhighlight><br />
<br />
The line <code>int(tweet_as_dictionary['timestamp_ms']) / 1000</code> does a few things:<br />
* extract the timestamp_ms field from the tweet. This is the tweet time measured in number of milliseconds since Jan 1, 1970. See [https://en.wikipedia.org/wiki/Unix_time] for more details.<br />
* divide the timestamp in milliseconds by 1000 to get the number of seconds since Jan 1, 1970.<br />
* convert it to a datetime in python.<br />
<br />
The other line that matters is <code>tweet_day = tweet_daytime.strftime('%Y-%m-%d')</code>, which takes the datetime and converts it to a string. The characters <code>%Y-%m-%d</code> describe the string format. The codes can be found in the documentation [https://docs.python.org/2/library/datetime.html#strftime-strptime-behavior]. For our purposes, here are the codes and the portion of the date they represent for the date "2015-11-06 14:52:12":<br />
<br />
* %Y - 2015<br />
* %m - 11<br />
* %d - 06<br />
* %H - 14 (note 24 hour time)<br />
* %M - 52<br />
* %S - 12<br />
<br />
== Details == <br />
<br />
'''Sampling'''<br />
<br />
Since the raw data is too large for everyone to download locally, we had to down sample to a reasonable sub-set. Down sampling usually involves choosing a random subset of the raw data, but it's important to think about how that sample is constructed. For instance, consider two sampling criteria for a 1% sample: by tweet and by user. Sampling by tweet means that every single tweet has a 1 in 100 chance of being in the sample. However, what if I want to count the number of tweets per user? Since I don't have all the tweets for any particular user, my estimate is going to be wrong. Sampling by user lets me capture all of the tweets by an account or none of them. This way I can still estimate the number of tweets in a time period and I can also make valid measurements of per-user metrics.<br />
<br />
'''Full source code'''<br />
<br />
The full source code of this exercise is available on github at [https://github.com/offbyone/tweetstream]. The examples are in the section <code>students</code></div>Ddaileyhttps://wiki.communitydata.science/index.php?title=Twitter_analysis_(CDSW)&diff=31223Twitter analysis (CDSW)2015-11-07T17:54:31Z<p>Ddailey: /* Analyzing Tweet Data with Python */</p>
<hr />
<div>__NOTOC__<br />
== Getting Started ==<br />
<br />
Download zipped file with a 10% sample of tweets from [https://s3-us-west-2.amazonaws.com/cc.communitydata.tweetstream/twitter_wk3_withdata.zip here].<br />
<br />
Extract the zipped file to your desktop and cd into it.<br />
<br />
== Analyzing Tweet Data with Python ==<br />
<br />
Last week, the [[Community_Data_Science_Workshops_%28Fall_2015%29/Day_2_projects/Twitter|Twitter API Session]] covered accessing data from the Twitter API, including accessing streaming data. After the session, we set up a streaming collection from the code you modified in the workshop to track all earthquake-related tweets. That stream captured 3.5GB of tweets (!). We've given you a sample of those tweets in the zipped file above.<br />
<br />
Our goal in this workshop is to use those tweets to answer questions. As always, we've suggested questions below, but the real goal is for you to find something that you find interesting from the data.<br />
<br />
Your data consists of 1 Tweet per line encoded in JSON exactly as Twitter returns it.<br />
<br />
== Goals ==<br />
<br />
Starting with the sample program, try to answer the following questions. The first one is done for you!<br />
<br />
* Build a histogram of tweets per day. Use it to identify potential events. We'll use python to make a CSV file that we can import to a spreadsheet.<br />
* Change your program to plot the number of users that are tweeting.<br />
* Pick an interesting time period from the data. Can you figure out where the even took place based on the locale of the user? What about geographic information? <br />
* Who gets retweeted the most in the data set?<br />
* Modify your histogram to look at tweets per hour rather than per day.<br />
* Use your imagination! What else can you find?<br />
<br />
== Hints and New Material ==<br />
<br />
This section lists a few new topics.<br />
<br />
'''CSV Files'''<br />
<br />
Comma-Separated Values (CSV) is a common way to store structured data in a text file. An example CSV file would be:<br />
<br />
Day,NumUsers<br />
2015-11-03,345<br />
2015-11-04,451<br />
...<br />
<br />
The nice thing about CSV files is that spreadsheet programs like Microsoft Excel can import them, so it's easy to plot columns. <br />
<br />
'''Dates and times'''<br />
<br />
Python provides a rich datetime functionality available via <code>import datetime</code>. We encourage you to look at the documentation at [https://github.com/offbyone/tweetstream]. In our examples, the only function we'll use is the ability to create strings from datetimes. Everything we need is in this example.<br />
<br />
<br />
<syntaxhighlight lang="python"><br />
import datetime<br />
for line in tweets:<br />
tweet_as_dictionary = json.loads(line)<br />
tweet_daytime = datetime.datetime.fromtimestamp(int(tweet_as_dictionary['timestamp_ms']) / 1000)<br />
tweet_day = tweet_daytime.strftime('%Y-%m-%d')<br />
</syntaxhighlight><br />
<br />
The line <code>int(tweet_as_dictionary['timestamp_ms']) / 1000</code> does a few things:<br />
* extract the timestamp_ms field from the tweet. This is the tweet time measured in number of milliseconds since Jan 1, 1970. See [https://en.wikipedia.org/wiki/Unix_time] for more details.<br />
* divide the timestamp in milliseconds by 1000 to get the number of seconds since Jan 1, 1970.<br />
* convert it to a datetime in python.<br />
<br />
The other line that matters is <code>tweet_day = tweet_daytime.strftime('%Y-%m-%d')</code>, which takes the datetime and converts it to a string. The characters <code>%Y-%m-%d</code> describe the string format. The codes can be found in the documentation [https://docs.python.org/2/library/datetime.html#strftime-strptime-behavior]. For our purposes, here are the codes and the portion of the date they represent for the date "2015-11-06 14:52:12":<br />
<br />
* %Y - 2015<br />
* %m - 11<br />
* %d - 06<br />
* %H - 14 (note 24 hour time)<br />
* %M - 52<br />
* %S - 12<br />
<br />
== Details == <br />
<br />
'''Sampling'''<br />
<br />
Since the raw data is too large for everyone to download locally, we had to down sample to a reasonable sub-set. Down sampling usually involves choosing a random subset of the raw data, but it's important to think about how that sample is constructed. For instance, consider two sampling criteria for a 1% sample: by tweet and by user. Sampling by tweet means that every single tweet has a 1 in 100 chance of being in the sample. However, what if I want to count the number of tweets per user? Since I don't have all the tweets for any particular user, my estimate is going to be wrong. Sampling by user lets me capture all of the tweets by an account or none of them. This way I can still estimate the number of tweets in a time period and I can also make valid measurements of per-user metrics.<br />
<br />
'''Full source code'''<br />
<br />
The full source code of this exercise is available on github at [https://github.com/offbyone/tweetstream]. The examples are in the section <code>students</code></div>Ddaileyhttps://wiki.communitydata.science/index.php?title=Community_Data_Science_Workshops_(Fall_2015)/Day_2_projects/Twitter&diff=16410Community Data Science Workshops (Fall 2015)/Day 2 projects/Twitter2015-10-23T22:05:09Z<p>Ddailey: /* Potential exercises */</p>
<hr />
<div>[[File:Twitter.png|right|260px]]<br />
<br />
__NOTOC__<br />
<br />
In this project, we will explore a few ways to gather data using the Twitter API. Once we've done that, we will extend the example code to create our own dataset of tweets. In the final workshop (Nov. 5), we will ask and answer questions with the data we've collected.<br />
<br />
== Goals ==<br />
<br />
* Get set up to build datasets with the Twitter API<br />
* Have fun collecting different types of tweets using a variety of ways to search<br />
* Practice reading and extending other people's code<br />
* Create a few collections of Tweets to use in your projects<br />
<br />
== Prerequisite ==<br />
<br />
To participate in the Twitter afternoon session, you ''must'' have registered with Twitter as a developer before the session by following the [[Twitter authentication setup|Twitter authentication setup instructions]]. If you did not do this, or if you tried but did not succeed, please attend one of the other two sessions instead.<br />
<br />
== Download and test the Twitter project ==<br />
<br />
If you are confused by these steps, go back and refresh your memory with the [[Community_Data_Science_Workshops_(Fall_2015)/Day_0_setup_and_tutorial|Day 0 setup instructions]]<br />
<br />
(Estimated time: 10 minutes)<br />
<br />
===Download the Twitter API project===<br />
<br />
* Right click the following file, click "Save Target as..." or "Save link as...", and save it to your Desktop directory: http://mako.cc/teaching/2015/cdsw-autumn/twitter-api-cdsw.zip<br />
* The ".zip" extension on the above file indicates that it is a compressed Zip archive. We need to "extract" its contents. To do this on Windows, click on "Start", then "Computer". If you are a Mac, open Finder and navigate to your Desktop directory. Find <code>twitter-api-cdsw.zip</code> on your Desktop and double-click on it to "unzip" it. That will create a folder called <code>twitter-api-cdsw</code> containing several files.<br />
<br />
===Enter your API information===<br />
<br />
<div style="background-color:#CEE7DA; width:80%; padding:1.2em;"><br />
'''On Windows'''<br />
<br />
* Start your text editor (probably Notepad++ if you [[Windows text editor|installed it following our instructions last time]]). Navigate to the directory that contains Twitter API (probably something of the form <code>C:\Users\'''YOURUSERNAME'''\Desktop\twitter-api-cdsw</code>).<br />
<br />
</div><br />
<br />
<div style="background-color:#D8E8FF; width:80%; padding:1.2em;"><br />
'''On Mac'''<br />
<br />
* Start your text editor (probably TextWrangler if you installed it following [[OSX text editor|our instructions]]). Navigate to the directory that contains the Twitter API project (probably something of the form <code>~/Desktop/twitter-api-cdsw</code>).<br />
<br />
</div><br />
<br />
* Open up the file <code>twitter_authentication.py</code> in your text editor.<br />
* You will see four lines that include four variables in ALL CAPITALS that are being assigned, in the normal ways we learned about last session, to strings. At the moment, all of the strings say CHANGE_ME.<br />
* Go find the four keys, tokens, and secrets you created and wrote-down when you followed the [[Community Data Science Workshops/Twitter authentication setup|Twitter authentication setup]]. Change every string that says CHANGE_ME into a string that includes the key, token, or secret you downloaded. Remember that since these are strings, we need to include quotations marks around them. Also make sure that you match up the right keys and tokens with the right variables.<br />
<br />
Once you have done this, your example programs are set up to use the Twitter API!<br />
<br />
===Test the Twitter API code===<br />
<br />
<div style="background-color:#CEE7DA; width:80%; padding:1.2em;"><br />
'''On Windows'''<br />
<br />
Start up PowerShell and navigate to the Desktop\twitter-api-cdsw directory where the Twitter API code lives. For example, if the Twitter API project is at <code>C:\Users\'''YOURUSERNAME'''\Desktop\twitter-api-cdsw</code>,<br />
<br />
cd C:\Users\'''YOURUSERNAME'''\Desktop\twitter-api-cdsw<br />
<br />
</div><br />
<div style="background-color:#D8E8FF; width:80%; padding:1.2em;"><br />
'''On Mac'''<br />
<br />
Start a command prompt and navigate to the Desktop/twitter-api-cdsw directory where the Twitter API code lives. For example, if the Twitter API project is at ~/Desktop/twitter-api-cdsw,<br />
<br />
cd ~/Desktop/twitter-api-cdsw<br />
<br />
</div><br />
<br />
This will change you into the right directory. <code>ls</code><br />
<br />
will show you the source code files in that directory. One of the files is "<code>twitter1.py</code>", which has a "<code>.py</code>" extension indicating that it is a Python script. Type:<br />
<br />
python twitter1.py<br />
<br />
at the command prompt to execute the <code>twitter1.py</code> Python script. Wait a little while while your computer connects to Twitter. You should see a series of tweets run by your screen. If you don't, let a mentor know.<br />
<br />
== Potential exercises ==<br />
<br />
'''Who are my followers?'''<br />
<br />
# Alter code example 2 (twitter2.py) to get your followers.<br />
# For each of your followers, get *their* followers (investigate time.sleep to throttle your computation)<br />
# Identify the follower you have that also follows the most of your followers.<br />
# How many handles follow you but none of your followers?<br />
# Repeat this for people you follow, rather than that follow you.<br />
<br />
'''Topics and Trends'''<br />
<br />
# Alter code example 3 (twitter3.py) to produce a list of 1000 tweets about a topic.<br />
# Look at those tweets. How does twitter interpret a two word query like "data science"<br />
# Eliminate retweets [hint: look at the tweet object! https://dev.twitter.com/overview/api/tweets]<br />
# For each tweet original tweet, list the number of times you see it retweeted.<br />
# Get a list of the URLs that are associated with your topic.<br />
<br />
'''Geolocation'''<br />
<br />
# Alter the streaming algorithm to include a "locations" filter. You need to use the order sw_lng, sw_lat, ne_lng, ne_lat for the four coordinates. (Recall Control C will stop an active process like the stream.)<br />
# What are people tweeting about in Times Square today? (Bonus points: set up a bounding box around TS and around NYC as a whole.)<br />
# Can you find words that are more likely to appear in TS?<br />
# UW is playing Arizona in football today. Set up a bounding box around the Arizona stadium and around UW. Can you identify tweets about football? Who tweets more about the game? (you can use <code>d = api.search(geocode='37.781157,-122.398720,1mi')</code> to do a static geo search.)<br />
<br />
== Congratulations!!!!==<br />
<br />
You now know how to capture data from Twitter that you can use in your research!!! Next workshop we'll play with some fun analytical tools. In the meantime, here are [[Twitter words of warning|a few words of caution about using Twitter data for science]].<br />
<br />
[[Category:Fall_2015_series]]</div>Ddaileyhttps://wiki.communitydata.science/index.php?title=Community_Data_Science_Workshops_(Fall_2015)/Day_2_projects/Twitter&diff=16409Community Data Science Workshops (Fall 2015)/Day 2 projects/Twitter2015-10-23T21:44:44Z<p>Ddailey: /* Potential exercises */</p>
<hr />
<div>[[File:Twitter.png|right|260px]]<br />
<br />
__NOTOC__<br />
<br />
In this project, we will explore a few ways to gather data using the Twitter API. Once we've done that, we will extend the example code to create our own dataset of tweets. In the final workshop (Nov. 5), we will ask and answer questions with the data we've collected.<br />
<br />
== Goals ==<br />
<br />
* Get set up to build datasets with the Twitter API<br />
* Have fun collecting different types of tweets using a variety of ways to search<br />
* Practice reading and extending other people's code<br />
* Create a few collections of Tweets to use in your projects<br />
<br />
== Prerequisite ==<br />
<br />
To participate in the Twitter afternoon session, you ''must'' have registered with Twitter as a developer before the session by following the [[Twitter authentication setup|Twitter authentication setup instructions]]. If you did not do this, or if you tried but did not succeed, please attend one of the other two sessions instead.<br />
<br />
== Download and test the Twitter project ==<br />
<br />
If you are confused by these steps, go back and refresh your memory with the [[Community_Data_Science_Workshops_(Fall_2015)/Day_0_setup_and_tutorial|Day 0 setup instructions]]<br />
<br />
(Estimated time: 10 minutes)<br />
<br />
===Download the Twitter API project===<br />
<br />
* Right click the following file, click "Save Target as..." or "Save link as...", and save it to your Desktop directory: http://mako.cc/teaching/2015/cdsw-autumn/twitter-api-cdsw.zip<br />
* The ".zip" extension on the above file indicates that it is a compressed Zip archive. We need to "extract" its contents. To do this on Windows, click on "Start", then "Computer". If you are a Mac, open Finder and navigate to your Desktop directory. Find <code>twitter-api-cdsw.zip</code> on your Desktop and double-click on it to "unzip" it. That will create a folder called <code>twitter-api-cdsw</code> containing several files.<br />
<br />
===Enter your API information===<br />
<br />
<div style="background-color:#CEE7DA; width:80%; padding:1.2em;"><br />
'''On Windows'''<br />
<br />
* Start your text editor (probably Notepad++ if you [[Windows text editor|installed it following our instructions last time]]). Navigate to the directory that contains Twitter API (probably something of the form <code>C:\Users\'''YOURUSERNAME'''\Desktop\twitter-api-cdsw</code>).<br />
<br />
</div><br />
<br />
<div style="background-color:#D8E8FF; width:80%; padding:1.2em;"><br />
'''On Mac'''<br />
<br />
* Start your text editor (probably TextWrangler if you installed it following [[OSX text editor|our instructions]]). Navigate to the directory that contains the Twitter API project (probably something of the form <code>~/Desktop/twitter-api-cdsw</code>).<br />
<br />
</div><br />
<br />
* Open up the file <code>twitter_authentication.py</code> in your text editor.<br />
* You will see four lines that include four variables in ALL CAPITALS that are being assigned, in the normal ways we learned about last session, to strings. At the moment, all of the strings say CHANGE_ME.<br />
* Go find the four keys, tokens, and secrets you created and wrote-down when you followed the [[Community Data Science Workshops/Twitter authentication setup|Twitter authentication setup]]. Change every string that says CHANGE_ME into a string that includes the key, token, or secret you downloaded. Remember that since these are strings, we need to include quotations marks around them. Also make sure that you match up the right keys and tokens with the right variables.<br />
<br />
Once you have done this, your example programs are set up to use the Twitter API!<br />
<br />
===Test the Twitter API code===<br />
<br />
<div style="background-color:#CEE7DA; width:80%; padding:1.2em;"><br />
'''On Windows'''<br />
<br />
Start up PowerShell and navigate to the Desktop\twitter-api-cdsw directory where the Twitter API code lives. For example, if the Twitter API project is at <code>C:\Users\'''YOURUSERNAME'''\Desktop\twitter-api-cdsw</code>,<br />
<br />
cd C:\Users\'''YOURUSERNAME'''\Desktop\twitter-api-cdsw<br />
<br />
</div><br />
<div style="background-color:#D8E8FF; width:80%; padding:1.2em;"><br />
'''On Mac'''<br />
<br />
Start a command prompt and navigate to the Desktop/twitter-api-cdsw directory where the Twitter API code lives. For example, if the Twitter API project is at ~/Desktop/twitter-api-cdsw,<br />
<br />
cd ~/Desktop/twitter-api-cdsw<br />
<br />
</div><br />
<br />
This will change you into the right directory. <code>ls</code><br />
<br />
will show you the source code files in that directory. One of the files is "<code>twitter1.py</code>", which has a "<code>.py</code>" extension indicating that it is a Python script. Type:<br />
<br />
python twitter1.py<br />
<br />
at the command prompt to execute the <code>twitter1.py</code> Python script. Wait a little while while your computer connects to Twitter. You should see a series of tweets run by your screen. If you don't, let a mentor know.<br />
<br />
== Potential exercises ==<br />
<br />
'''Who are my followers?'''<br />
<br />
# Alter code example 2 (twitter2.py) to get your followers.<br />
# For each of your followers, get *their* followers (investigate time.sleep to throttle your computation)<br />
# Identify the follower you have that also follows the most of your followers.<br />
# How many handles follow you but none of your followers?<br />
# Repeat this for people you follow, rather than that follow you.<br />
<br />
'''Topics and Trends'''<br />
<br />
# Alter code example 3 (twitter3.py) to produce a list of 1000 tweets about a topic.<br />
# Look at those tweets. How does twitter interpret a two word query like "data science"<br />
# Eliminate retweets [hint: look at the tweet object! https://dev.twitter.com/overview/api/tweets]<br />
# For each tweet original tweet, list the number of times you see it retweeted.<br />
# Get a list of the URLs that are associated with your topic.<br />
<br />
'''Geolocation'''<br />
<br />
# Alter the streaming algorithm to include a "locations" filter. You need to use the order sw_lng, sw_lat, ne_lng, ne_lat for the four coordinates.<br />
# What are people tweeting about in Times Square today? (Bonus points: set up a bounding box around TS and around NYC as a whole.)<br />
# Can you find words that are more likely to appear in TS?<br />
# UW is playing Arizona in football today. Set up a bounding box around the Arizona stadium and around UW. Can you identify tweets about football? Who tweets more about the game? (you can use <code>d = api.search(geocode='37.781157,-122.398720,1mi')</code> to do a static geo search.)<br />
<br />
== Congratulations!!!!==<br />
<br />
You now know how to capture data from Twitter that you can use in your research!!! Next workshop we'll play with some fun analytical tools. In the meantime, here are [[Twitter words of warning|a few words of caution about using Twitter data for science]].<br />
<br />
[[Category:Fall_2015_series]]</div>Ddaileyhttps://wiki.communitydata.science/index.php?title=Community_Data_Science_Workshops_(Fall_2015)/Day_2_projects/Twitter&diff=16408Community Data Science Workshops (Fall 2015)/Day 2 projects/Twitter2015-10-23T21:43:55Z<p>Ddailey: /* Potential exercises */</p>
<hr />
<div>[[File:Twitter.png|right|260px]]<br />
<br />
__NOTOC__<br />
<br />
In this project, we will explore a few ways to gather data using the Twitter API. Once we've done that, we will extend the example code to create our own dataset of tweets. In the final workshop (Nov. 5), we will ask and answer questions with the data we've collected.<br />
<br />
== Goals ==<br />
<br />
* Get set up to build datasets with the Twitter API<br />
* Have fun collecting different types of tweets using a variety of ways to search<br />
* Practice reading and extending other people's code<br />
* Create a few collections of Tweets to use in your projects<br />
<br />
== Prerequisite ==<br />
<br />
To participate in the Twitter afternoon session, you ''must'' have registered with Twitter as a developer before the session by following the [[Twitter authentication setup|Twitter authentication setup instructions]]. If you did not do this, or if you tried but did not succeed, please attend one of the other two sessions instead.<br />
<br />
== Download and test the Twitter project ==<br />
<br />
If you are confused by these steps, go back and refresh your memory with the [[Community_Data_Science_Workshops_(Fall_2015)/Day_0_setup_and_tutorial|Day 0 setup instructions]]<br />
<br />
(Estimated time: 10 minutes)<br />
<br />
===Download the Twitter API project===<br />
<br />
* Right click the following file, click "Save Target as..." or "Save link as...", and save it to your Desktop directory: http://mako.cc/teaching/2015/cdsw-autumn/twitter-api-cdsw.zip<br />
* The ".zip" extension on the above file indicates that it is a compressed Zip archive. We need to "extract" its contents. To do this on Windows, click on "Start", then "Computer". If you are a Mac, open Finder and navigate to your Desktop directory. Find <code>twitter-api-cdsw.zip</code> on your Desktop and double-click on it to "unzip" it. That will create a folder called <code>twitter-api-cdsw</code> containing several files.<br />
<br />
===Enter your API information===<br />
<br />
<div style="background-color:#CEE7DA; width:80%; padding:1.2em;"><br />
'''On Windows'''<br />
<br />
* Start your text editor (probably Notepad++ if you [[Windows text editor|installed it following our instructions last time]]). Navigate to the directory that contains Twitter API (probably something of the form <code>C:\Users\'''YOURUSERNAME'''\Desktop\twitter-api-cdsw</code>).<br />
<br />
</div><br />
<br />
<div style="background-color:#D8E8FF; width:80%; padding:1.2em;"><br />
'''On Mac'''<br />
<br />
* Start your text editor (probably TextWrangler if you installed it following [[OSX text editor|our instructions]]). Navigate to the directory that contains the Twitter API project (probably something of the form <code>~/Desktop/twitter-api-cdsw</code>).<br />
<br />
</div><br />
<br />
* Open up the file <code>twitter_authentication.py</code> in your text editor.<br />
* You will see four lines that include four variables in ALL CAPITALS that are being assigned, in the normal ways we learned about last session, to strings. At the moment, all of the strings say CHANGE_ME.<br />
* Go find the four keys, tokens, and secrets you created and wrote-down when you followed the [[Community Data Science Workshops/Twitter authentication setup|Twitter authentication setup]]. Change every string that says CHANGE_ME into a string that includes the key, token, or secret you downloaded. Remember that since these are strings, we need to include quotations marks around them. Also make sure that you match up the right keys and tokens with the right variables.<br />
<br />
Once you have done this, your example programs are set up to use the Twitter API!<br />
<br />
===Test the Twitter API code===<br />
<br />
<div style="background-color:#CEE7DA; width:80%; padding:1.2em;"><br />
'''On Windows'''<br />
<br />
Start up PowerShell and navigate to the Desktop\twitter-api-cdsw directory where the Twitter API code lives. For example, if the Twitter API project is at <code>C:\Users\'''YOURUSERNAME'''\Desktop\twitter-api-cdsw</code>,<br />
<br />
cd C:\Users\'''YOURUSERNAME'''\Desktop\twitter-api-cdsw<br />
<br />
</div><br />
<div style="background-color:#D8E8FF; width:80%; padding:1.2em;"><br />
'''On Mac'''<br />
<br />
Start a command prompt and navigate to the Desktop/twitter-api-cdsw directory where the Twitter API code lives. For example, if the Twitter API project is at ~/Desktop/twitter-api-cdsw,<br />
<br />
cd ~/Desktop/twitter-api-cdsw<br />
<br />
</div><br />
<br />
This will change you into the right directory. <code>ls</code><br />
<br />
will show you the source code files in that directory. One of the files is "<code>twitter1.py</code>", which has a "<code>.py</code>" extension indicating that it is a Python script. Type:<br />
<br />
python twitter1.py<br />
<br />
at the command prompt to execute the <code>twitter1.py</code> Python script. Wait a little while while your computer connects to Twitter. You should see a series of tweets run by your screen. If you don't, let a mentor know.<br />
<br />
== Potential exercises ==<br />
<br />
'''Who are my followers?'''<br />
<br />
# Alter code example 2 (twitter2.py) to get your followers.<br />
# For each of your followers, get *their* followers (investigate time.sleep to throttle your computation)<br />
# Identify the follower you have that also follows the most of your followers.<br />
# How many handles follow you but none of your followers?<br />
# Repeat this for people you follow, rather than that follow you.<br />
<br />
'''Topics and Trends'''<br />
<br />
# Alter code example 3 (twitter3.py) to produce a list of 1000 tweets about a topic.<br />
# Look at those tweets. How does twitter interpret a two word query like "data science"<br />
# Eliminate retweets [hint: [look at the tweet object! https://dev.twitter.com/overview/api/tweets]<br />
# For each tweet original tweet, list the number of times you see it retweeted.<br />
# Get a list of the URLs that are associated with your topic.<br />
<br />
'''Geolocation'''<br />
<br />
# Alter the streaming algorithm to include a "locations" filter. You need to use the order sw_lng, sw_lat, ne_lng, ne_lat for the four coordinates.<br />
# What are people tweeting about in Times Square today? (Bonus points: set up a bounding box around TS and around NYC as a whole.)<br />
# Can you find words that are more likely to appear in TS?<br />
# UW is playing Arizona in football today. Set up a bounding box around the Arizona stadium and around UW. Can you identify tweets about football? Who tweets more about the game? (you can use <code>d = api.search(geocode='37.781157,-122.398720,1mi')</code> to do a static geo search.)<br />
<br />
== Congratulations!!!!==<br />
<br />
You now know how to capture data from Twitter that you can use in your research!!! Next workshop we'll play with some fun analytical tools. In the meantime, here are [[Twitter words of warning|a few words of caution about using Twitter data for science]].<br />
<br />
[[Category:Fall_2015_series]]</div>Ddaileyhttps://wiki.communitydata.science/index.php?title=Community_Data_Science_Workshops_(Fall_2015)/Day_2_projects/Twitter&diff=16407Community Data Science Workshops (Fall 2015)/Day 2 projects/Twitter2015-10-23T21:30:02Z<p>Ddailey: /* Potential exercises */</p>
<hr />
<div>[[File:Twitter.png|right|260px]]<br />
<br />
__NOTOC__<br />
<br />
In this project, we will explore a few ways to gather data using the Twitter API. Once we've done that, we will extend the example code to create our own dataset of tweets. In the final workshop (Nov. 5), we will ask and answer questions with the data we've collected.<br />
<br />
== Goals ==<br />
<br />
* Get set up to build datasets with the Twitter API<br />
* Have fun collecting different types of tweets using a variety of ways to search<br />
* Practice reading and extending other people's code<br />
* Create a few collections of Tweets to use in your projects<br />
<br />
== Prerequisite ==<br />
<br />
To participate in the Twitter afternoon session, you ''must'' have registered with Twitter as a developer before the session by following the [[Twitter authentication setup|Twitter authentication setup instructions]]. If you did not do this, or if you tried but did not succeed, please attend one of the other two sessions instead.<br />
<br />
== Download and test the Twitter project ==<br />
<br />
If you are confused by these steps, go back and refresh your memory with the [[Community_Data_Science_Workshops_(Fall_2015)/Day_0_setup_and_tutorial|Day 0 setup instructions]]<br />
<br />
(Estimated time: 10 minutes)<br />
<br />
===Download the Twitter API project===<br />
<br />
* Right click the following file, click "Save Target as..." or "Save link as...", and save it to your Desktop directory: http://mako.cc/teaching/2015/cdsw-autumn/twitter-api-cdsw.zip<br />
* The ".zip" extension on the above file indicates that it is a compressed Zip archive. We need to "extract" its contents. To do this on Windows, click on "Start", then "Computer". If you are a Mac, open Finder and navigate to your Desktop directory. Find <code>twitter-api-cdsw.zip</code> on your Desktop and double-click on it to "unzip" it. That will create a folder called <code>twitter-api-cdsw</code> containing several files.<br />
<br />
===Enter your API information===<br />
<br />
<div style="background-color:#CEE7DA; width:80%; padding:1.2em;"><br />
'''On Windows'''<br />
<br />
* Start your text editor (probably Notepad++ if you [[Windows text editor|installed it following our instructions last time]]). Navigate to the directory that contains Twitter API (probably something of the form <code>C:\Users\'''YOURUSERNAME'''\Desktop\twitter-api-cdsw</code>).<br />
<br />
</div><br />
<br />
<div style="background-color:#D8E8FF; width:80%; padding:1.2em;"><br />
'''On Mac'''<br />
<br />
* Start your text editor (probably TextWrangler if you installed it following [[OSX text editor|our instructions]]). Navigate to the directory that contains the Twitter API project (probably something of the form <code>~/Desktop/twitter-api-cdsw</code>).<br />
<br />
</div><br />
<br />
* Open up the file <code>twitter_authentication.py</code> in your text editor.<br />
* You will see four lines that include four variables in ALL CAPITALS that are being assigned, in the normal ways we learned about last session, to strings. At the moment, all of the strings say CHANGE_ME.<br />
* Go find the four keys, tokens, and secrets you created and wrote-down when you followed the [[Community Data Science Workshops/Twitter authentication setup|Twitter authentication setup]]. Change every string that says CHANGE_ME into a string that includes the key, token, or secret you downloaded. Remember that since these are strings, we need to include quotations marks around them. Also make sure that you match up the right keys and tokens with the right variables.<br />
<br />
Once you have done this, your example programs are set up to use the Twitter API!<br />
<br />
===Test the Twitter API code===<br />
<br />
<div style="background-color:#CEE7DA; width:80%; padding:1.2em;"><br />
'''On Windows'''<br />
<br />
Start up PowerShell and navigate to the Desktop\twitter-api-cdsw directory where the Twitter API code lives. For example, if the Twitter API project is at <code>C:\Users\'''YOURUSERNAME'''\Desktop\twitter-api-cdsw</code>,<br />
<br />
cd C:\Users\'''YOURUSERNAME'''\Desktop\twitter-api-cdsw<br />
<br />
</div><br />
<div style="background-color:#D8E8FF; width:80%; padding:1.2em;"><br />
'''On Mac'''<br />
<br />
Start a command prompt and navigate to the Desktop/twitter-api-cdsw directory where the Twitter API code lives. For example, if the Twitter API project is at ~/Desktop/twitter-api-cdsw,<br />
<br />
cd ~/Desktop/twitter-api-cdsw<br />
<br />
</div><br />
<br />
This will change you into the right directory. <code>ls</code><br />
<br />
will show you the source code files in that directory. One of the files is "<code>twitter1.py</code>", which has a "<code>.py</code>" extension indicating that it is a Python script. Type:<br />
<br />
python twitter1.py<br />
<br />
at the command prompt to execute the <code>twitter1.py</code> Python script. Wait a little while while your computer connects to Twitter. You should see a series of tweets run by your screen. If you don't, let a mentor know.<br />
<br />
== Potential exercises ==<br />
<br />
'''Who are my followers?'''<br />
<br />
# Alter code example 2 (twitter2.py) to get your followers.<br />
# For each of your followers, get *their* followers (investigate time.sleep to throttle your computation)<br />
# Identify the follower you have that also follows the most of your followers.<br />
# How many handles follow you but none of your followers?<br />
# Repeat this for people you follow, rather than that follow you.<br />
<br />
'''Topics and Trends'''<br />
<br />
# Alter code example 3 (twitter3.py) to produce a list of 1000 tweets about a topic.<br />
# Look at those tweets. How does twitter interpret a two word query like "data science"<br />
# Eliminate retweets [hint: look at the tweet object!]<br />
# For each tweet original tweet, list the number of times you see it retweeted.<br />
# Get a list of the URLs that are associated with your topic.<br />
<br />
'''Geolocation'''<br />
<br />
# Alter the streaming algorithm to include a "locations" filter. You need to use the order sw_lng, sw_lat, ne_lng, ne_lat for the four coordinates.<br />
# What are people tweeting about in Times Square today? (Bonus points: set up a bounding box around TS and around NYC as a whole.)<br />
# Can you find words that are more likely to appear in TS?<br />
# UW is playing Arizona in football today. Set up a bounding box around the Arizona stadium and around UW. Can you identify tweets about football? Who tweets more about the game? (you can use <code>d = api.search(geocode='37.781157,-122.398720,1mi')</code> to do a static geo search.)<br />
<br />
== Congratulations!!!!==<br />
<br />
You now know how to capture data from Twitter that you can use in your research!!! Next workshop we'll play with some fun analytical tools. In the meantime, here are [[Twitter words of warning|a few words of caution about using Twitter data for science]].<br />
<br />
[[Category:Fall_2015_series]]</div>Ddaileyhttps://wiki.communitydata.science/index.php?title=Community_Data_Science_Workshops_(Fall_2015)/Day_2_projects/Twitter&diff=16406Community Data Science Workshops (Fall 2015)/Day 2 projects/Twitter2015-10-23T21:23:05Z<p>Ddailey: /* Test the Twitter API code */</p>
<hr />
<div>[[File:Twitter.png|right|260px]]<br />
<br />
__NOTOC__<br />
<br />
In this project, we will explore a few ways to gather data using the Twitter API. Once we've done that, we will extend the example code to create our own dataset of tweets. In the final workshop (Nov. 5), we will ask and answer questions with the data we've collected.<br />
<br />
== Goals ==<br />
<br />
* Get set up to build datasets with the Twitter API<br />
* Have fun collecting different types of tweets using a variety of ways to search<br />
* Practice reading and extending other people's code<br />
* Create a few collections of Tweets to use in your projects<br />
<br />
== Prerequisite ==<br />
<br />
To participate in the Twitter afternoon session, you ''must'' have registered with Twitter as a developer before the session by following the [[Twitter authentication setup|Twitter authentication setup instructions]]. If you did not do this, or if you tried but did not succeed, please attend one of the other two sessions instead.<br />
<br />
== Download and test the Twitter project ==<br />
<br />
If you are confused by these steps, go back and refresh your memory with the [[Community_Data_Science_Workshops_(Fall_2015)/Day_0_setup_and_tutorial|Day 0 setup instructions]]<br />
<br />
(Estimated time: 10 minutes)<br />
<br />
===Download the Twitter API project===<br />
<br />
* Right click the following file, click "Save Target as..." or "Save link as...", and save it to your Desktop directory: http://mako.cc/teaching/2015/cdsw-autumn/twitter-api-cdsw.zip<br />
* The ".zip" extension on the above file indicates that it is a compressed Zip archive. We need to "extract" its contents. To do this on Windows, click on "Start", then "Computer". If you are a Mac, open Finder and navigate to your Desktop directory. Find <code>twitter-api-cdsw.zip</code> on your Desktop and double-click on it to "unzip" it. That will create a folder called <code>twitter-api-cdsw</code> containing several files.<br />
<br />
===Enter your API information===<br />
<br />
<div style="background-color:#CEE7DA; width:80%; padding:1.2em;"><br />
'''On Windows'''<br />
<br />
* Start your text editor (probably Notepad++ if you [[Windows text editor|installed it following our instructions last time]]). Navigate to the directory that contains Twitter API (probably something of the form <code>C:\Users\'''YOURUSERNAME'''\Desktop\twitter-api-cdsw</code>).<br />
<br />
</div><br />
<br />
<div style="background-color:#D8E8FF; width:80%; padding:1.2em;"><br />
'''On Mac'''<br />
<br />
* Start your text editor (probably TextWrangler if you installed it following [[OSX text editor|our instructions]]). Navigate to the directory that contains the Twitter API project (probably something of the form <code>~/Desktop/twitter-api-cdsw</code>).<br />
<br />
</div><br />
<br />
* Open up the file <code>twitter_authentication.py</code> in your text editor.<br />
* You will see four lines that include four variables in ALL CAPITALS that are being assigned, in the normal ways we learned about last session, to strings. At the moment, all of the strings say CHANGE_ME.<br />
* Go find the four keys, tokens, and secrets you created and wrote-down when you followed the [[Community Data Science Workshops/Twitter authentication setup|Twitter authentication setup]]. Change every string that says CHANGE_ME into a string that includes the key, token, or secret you downloaded. Remember that since these are strings, we need to include quotations marks around them. Also make sure that you match up the right keys and tokens with the right variables.<br />
<br />
Once you have done this, your example programs are set up to use the Twitter API!<br />
<br />
===Test the Twitter API code===<br />
<br />
<div style="background-color:#CEE7DA; width:80%; padding:1.2em;"><br />
'''On Windows'''<br />
<br />
Start up PowerShell and navigate to the Desktop\twitter-api-cdsw directory where the Twitter API code lives. For example, if the Twitter API project is at <code>C:\Users\'''YOURUSERNAME'''\Desktop\twitter-api-cdsw</code>,<br />
<br />
cd C:\Users\'''YOURUSERNAME'''\Desktop\twitter-api-cdsw<br />
<br />
</div><br />
<div style="background-color:#D8E8FF; width:80%; padding:1.2em;"><br />
'''On Mac'''<br />
<br />
Start a command prompt and navigate to the Desktop/twitter-api-cdsw directory where the Twitter API code lives. For example, if the Twitter API project is at ~/Desktop/twitter-api-cdsw,<br />
<br />
cd ~/Desktop/twitter-api-cdsw<br />
<br />
</div><br />
<br />
This will change you into the right directory. <code>ls</code><br />
<br />
will show you the source code files in that directory. One of the files is "<code>twitter1.py</code>", which has a "<code>.py</code>" extension indicating that it is a Python script. Type:<br />
<br />
python twitter1.py<br />
<br />
at the command prompt to execute the <code>twitter1.py</code> Python script. Wait a little while while your computer connects to Twitter. You should see a series of tweets run by your screen. If you don't, let a mentor know.<br />
<br />
== Potential exercises ==<br />
<br />
'''Who are my followers?'''<br />
<br />
# Use sample 2 to get your followers.<br />
# For each of your followers, get *their* followers (investigate time.sleep to throttle your computation)<br />
# Identify the follower you have that also follows the most of your followers.<br />
# How many handles follow you but none of your followers?<br />
# Repeat this for people you follow, rather than that follow you.<br />
<br />
'''Topics and Trends'''<br />
<br />
# Use sample 3 to produce a list of 1000 tweets about a topic.<br />
# Look at those tweets. How does twitter interpret a two word query like "data science"<br />
# Eliminate retweets [hint: look at the tweet object!]<br />
# For each tweet original tweet, list the number of times you see it retweeted.<br />
# Get a list of the URLs that are associated with your topic.<br />
<br />
'''Geolocation'''<br />
<br />
# Alter the streaming algorithm to include a "locations" filter. You need to use the order sw_lng, sw_lat, ne_lng, ne_lat for the four coordinates.<br />
# What are people tweeting about in Times Square today? (Bonus points: set up a bounding box around TS and around NYC as a whole.)<br />
# Can you find words that are more likely to appear in TS?<br />
# UW is playing Arizona in football today. Set up a bounding box around the Arizona stadium and around UW. Can you identify tweets about football? Who tweets more about the game? (you can use <code>d = api.search(geocode='37.781157,-122.398720,1mi')</code> to do a static geo search.)<br />
<br />
== Congratulations!!!!==<br />
<br />
You now know how to capture data from Twitter that you can use in your research!!! Next workshop we'll play with some fun analytical tools. In the meantime, here are [[Twitter words of warning|a few words of caution about using Twitter data for science]].<br />
<br />
[[Category:Fall_2015_series]]</div>Ddailey