Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The CSV file was too big, but I just want to know the codes for retreiving all tweets and figuring out the percentage. Here is

The CSV file was too big, but I just want to know the codes for retreiving all tweets and figuring out the percentage.

Here is what your program should do:

Load Twitter data from a CSV file into Python.

Ask the user for a keyword of his/her choice.

Display the number of tweets in which the keyword appears.

Display the percentage of tweets containing the keyword.

Give the user the option of displaying all tweets containing the keyword.

Add comments to three different lines of code explaining what each line does. Each comment should describe a distinct step of your script.

Your program should be case-insensitive, meaning that it should match all instances of the keyword among the tweets regardless of the letter case used.

At the top of your program, add a comment (single-line or multi-line) containing the following information:

Your name

The course number

The date you finished the assignment

A brief (two sentences max) description of what the program does.

Here is what your output should look like:

This program displays summary information about the Twitter dataset movie_data_fixed.csv.

Please enter the name of your data file: #enter data filename here

Enter a keyword: #enter keyword here

The keyword "keyword" is present in x of y tweets.

Which is z% of all tweets. #x, y, and z should all be actual numbers

Show all keyword tweets? (y/n): #enter y or n here

If the user enters y above (without quotes), your program should display all tweets containing the given keyword. Otherwise, the program should end.

To test your program, use the same Twitter data file weve been using in class (heres the link again in case you need it: http://dfreelon.org/python_intro/movie_data_fixed.csv). If you use the word reboot as a keyword with this data, your program output should look like this:

This program displays summary information about the Twitter dataset movie_data_fixed.csv.

Enter a keyword: reboot

The keyword "reboot" is present in 6 of 15492 tweets.

Which is 0.03872716710772607% of all tweets.

Show all keyword tweets? (y/n): y

RT @RebootSocial: #PaulWalker, #VinDiesel & #DwayneJohnson star in 'Furious 7.' The 7th film in the 'Physics is for Losers'... http://t.co/

Video: rebootentertainment: 'Furious 7' Official Super Bowl Spot (2015) Paul Walker, Vin Diesel Release:... http://t.co/rD9pLE48jv

@vonkamrath @philthatremains well, we got Chappie coming out. Unofficial reboot.

Just finished #Divergent movie. Loved it. Saw trailer for #Insurgent and was like 'She is the one? Is this a #Matrix reboot?' #curious

Just saw preview for #chappie - isn't this just a crazy reboot of short circuit? #number5alive

gritty reboot of Fast & Furious 7

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Big Data With Hadoop MapReduce A Classroom Approach

Authors: Rathinaraja Jeyaraj ,Ganeshkumar Pugalendhi ,Anand Paul

1st Edition

1774634848, 978-1774634844

More Books

Students also viewed these Databases questions