Community Data Science Course (Spring 2015)/Day 6 Coding Challenges: Difference between revisions
From CommunityData
(Created page with "=== Potential exercises === '''Who are my followers?''' 1) Use sample 2 to get your followers. 2) For each of your followers, get *their* followers (investigate time.sleep...") |
No edit summary |
||
Line 1: | Line 1: | ||
== | == Who are my followers? == | ||
''' | # For each of your followers, get ''their'' followers. (Try using <code>time.sleep()</code> to slow down your data collection.) | ||
# Identify the follower you have that also follows the most of your followers. | |||
# How many users follow you but none of your followers? | |||
# Repeat these analyses for people you follow, rather than that follow you. | |||
== Topics and Trends == | |||
# Modify <code>twitter3.py</code> to produce a list of 1000 tweets about a topic of your choice. | |||
# Look at those tweets. How does twitter interpret a two word query like "data science" | |||
# Do the previous step but eliminate retweets [hint: look at the tweet object!] | |||
# For each tweet original tweet, list the number of times you see it retweeted. | |||
# Get a list of the URLs that are associated with your topic using Twitter. | |||
== Geolocation == | |||
# Alter the streaming code to include a "locations" filter. You need to use the order sw_lng, sw_lat, ne_lng, ne_lat for the four coordinates. | |||
# What are people tweeting about in Times Square today? | |||
# Set up a bounding box around TS and around NYC as a whole. | |||
# Do "static" (i.e., not using the streaming API) geolocation search using code: | |||
d = api.search(geocode='37.781157,-122.398720,1mi') | |||
Revision as of 02:35, 5 May 2015
Who are my followers?
- For each of your followers, get their followers. (Try using
time.sleep()
to slow down your data collection.) - Identify the follower you have that also follows the most of your followers.
- How many users follow you but none of your followers?
- Repeat these analyses for people you follow, rather than that follow you.
Topics and Trends
- Modify
twitter3.py
to produce a list of 1000 tweets about a topic of your choice. - Look at those tweets. How does twitter interpret a two word query like "data science"
- Do the previous step but eliminate retweets [hint: look at the tweet object!]
- For each tweet original tweet, list the number of times you see it retweeted.
- Get a list of the URLs that are associated with your topic using Twitter.
Geolocation
- Alter the streaming code to include a "locations" filter. You need to use the order sw_lng, sw_lat, ne_lng, ne_lat for the four coordinates.
- What are people tweeting about in Times Square today?
- Set up a bounding box around TS and around NYC as a whole.
- Do "static" (i.e., not using the streaming API) geolocation search using code:
d = api.search(geocode='37.781157,-122.398720,1mi')