Bentley University, Spring 2019 CS 230
计算机Python代做 A hashtag is any word in a Tweet that begins with a # symbol, a mention is any word in a Tweet that begins with an @ symbol.
Introduction to Programming with Python
Homework 6 – Twitter Analytics
A hashtag is any word in a Tweet that begins with a # symbol, a mention is any word in a Tweet that begins with an @ symbol. In this assignment, you will use the pandas, numpy, and matplotlib modules to analyze hashtags or mentions on Twitter.
Export Your Tweets 计算机Python代做
You can use the sample Twitter data file supplied containing Tweets from the cisSandbox account or export your own Tweets to analyze. Follow these steps to export your own Tweets:
Sign in to your Twitter account.
- Click your profile icon at the top right corner of the page.
- Click Analytics from the dropdown menu below your profile icon.
- On the Analytics page, click Tweets at the top of the page
- Select a date range of activity (choose a large enough daterange so you have Tweets containing several hashtags or mentions),
5.Click the Export Data button to export your Twitter Python5代写
6.Save the file as tweets.csv in the folder with the python program you are about to
Analyze Your Tweets
- Follow the example given in class to load Twitter data from the tweets.csv file into apandas DataFrame, removing irrelevant
- Allow the user to specify whether to analyze hashtags or mentions by typing h or
- Analyze the Tweet text column of the data frame to create a dictionary of hashtags/mentions and corresponding frequencies (number of times each appears). For simplicity, the DataFrame will have two columns: Hashtag and Frequency, regardlessof whether you are analyzing hashtags or mentions. As you process the data, convert all words to lower case (so that #BENTLEY and #bentley will be considered the same word.计算机Python代做
- Create a pandas DataFrame containing each hashtag and its corresponding
- Print the
- Sort the DataFrame alphabetically by hashtag. Print the sorted
- Sort the DataFrame in decreasing order by frequency. Print the sorted
- Create a horizontal bar chart that plots each hashtag and its frequency. Be sure to set x and y labels for the axes, ticks for values and hashtags, and a title for your
See https://matplotlib.org/gallery/lines_bars_and_markers/barh.html or https://medium.com/python-pandemonium/data-visualization-in-python-bar-graph-in- matplotlib-f1738602e9c4 for examples of how to create a horizontal bar chart.
Sample Output 计算机Python代做
Hashtag Analysis
Analyze [H]ashtags or [M]entions?h Hashtag Frequency
- #bentley2022 6
- #ohbot 1
- #teslatuesday 1 计算机Python代做
- #tiltbrush 3
Sorted Alphabetically
Hashtag Frequency
- #bentley2022 6
- #ohbot 1
- #teslatuesday 1
- #tiltbrush 3
Sorted Descending by Frequency Hashtag FrequencyPython5代写
0 | #bentley2022 | 6 |
3 | #tiltbrush | 3 |
1 | #ohbot | 1 |
2 | #teslatuesday | 1 |
Mention Analysis
Analyze [H]ashtags or [M]entions?计算机Python代做
Hashtag Frequency
- @cissandbox 14
- @glarsbentleyu 2
- @bentleyu 11
- @cissandbox). 1
- @_connerc 1
- @mendix 7
- @bentleyalumni 1
- @amazonrobotics 1
- @poly 3
- @bentleyfalcons 1
Sorted Alphabetically
Hashtag | Frequency | |
4 | @_connerc | 1 |
7 | @amazonrobotics | 1 |
6 | @bentleyalumni | 1 |
9 | @bentleyfalcons | 1 |
2 | @bentleyu | 11 |
0 | @cissandbox | 14 |
3 | @cissandbox).计算机Python代做 | 1 |
1 | @glarsbentleyu | 2 |
5 | @mendix | 7 |
8 | @poly | 3 |
Sorted Descending by Frequency 计算机Python代做
0 |
Hashtag
@cissandbox |
Frequency
14 |
2 | @bentleyu | 11 |
5 | @mendix 计算机Python代做 | 7 |
8 | @poly | 3 |
1 | @glarsbentleyu | 2 |
4 | @_connerc | 1 |
7 | @amazonrobotics | 1 |
6 | @bentleyalumni | 1 |
9 | @bentleyfalcons计算机Python代做 | 1 |
3 | @cissandbox). | 1 |
Grading: 计算机Python代做
- This assignment will be worth 8 percent of your final
- The input and output of your program need to appear in exactly the order that is shownin the sample interaction
- Your program should compile without syntax errors to receive any credit. If a part of your program is working, you will receive partial credit, but only if the program compiles without syntax errors. As you program, I highly recommend that you save intermediate versions of the .py file each time you get a piece of the program running. This way youcan always have something to submit that works on at least some of the
Points:
This problem has several tasks. Complete as many as you can, or all of them for full credit.
Task Points 计算机Python代做 | |
Loading the .csv file | 3 |
Creation of a dictionary of hashtags | 7 |
Converting words to lower case | 2 |
Creation of a pandas DataFrame | 3 |
Printing the DataFrame 计算机Python代做 | 2 |
Sorting and printing the sorted DataFrame | 8 |
Creating the bar chart | 10 |
Code style, readability, comments, approach | 5 |
Total | 40 |
Submission:
- Name your script as py and upload it onto the Blackboard by thedeadline.
其他代写:algorithm代写 analysis代写 app代写 assembly代写 assignment代写 C++代写 C/C++代写 code代写 course代写 dataset代写 finance代写 java代写 source code代写 java代写 web代写 北美作业代写 数据分析代写 编程代写 考试助攻