Was Captain Marvel Bad? A Sentiment Analysis of Twitter Data

Ken Jee · Beginner ·📰 AI News & Updates ·7y ago

Key Takeaways

The video demonstrates a sentiment analysis of Twitter data using Python, Twitter Scraper, and Vader Sentiment tool to determine the general feeling about the movie Captain Marvel, comparing it to Avengers: Infinity War.

Full Transcript

hello everyone can hear back with a new data science video today I wanted to do something special I saw that there was a lot of really negative reviews of Captain Marvel on YouTube and some other resources and I wanted to see what the crowd thought what the Twitterverse thought so I am doing a sentiment analysis on Captain Marvel I'm also comparing it to Avengers infinity war horse in context if this interests you if you liked the video please hit that like button and if you'd like to see more like it please subscribe I do this analysis in Python and a couple of the modules are very helpful and actually getting this doc so the first module that I'd like to give a shout out to is Twitter scraper so it's more simple than Twitter trust API you don't need any login or credentials or anything like that and it also gets through some of the limitations of that API where you can go back in time as far as you want which is really cool I also use the Bader sentiment tool which it takes a lexicon approach to sentiment analysis so it has a big dictionary of words and it attaches sentiments to each one of those and also based on the context that the word is used it gives it a sentiment score there are a couple different levels of score so they mark how many negative features used how many neutral features you use and how many positive features you use and that's all combined into one composite score bitter is one of the best practices in the industry it's not perfect some things do slip through the cracks but at a large scale it works very well and I'm excited to actually build this into my analysis I haven't had a ton of exposure to sentiment that's why one of the reasons why I'm actually doing this because it lets me fool around with some new tools and to explore a very interesting topic you can find three interesting links in the description below the first is a medium article that highlights well that was actually the inspiration for this video that talks about using sentiment analysis to analyze the anthem game lock the second is another medium article about the details of how they that works and the last is a link to my github where you can find the entire code base for this analysis so let's just jump into how I set up this analysis I'm not gonna go through all of the code but again if you want to see that that is in my personal github the first thing we do is import all of the relevant modules pandas were going to be using because we're converting a lot of this into a data frame to analyze it date time we're gonna be using to filter by the specific time of day and I talked about Twitter scraper and Vader sentiment analysis we're also using lang detects because we only want to evaluate english-language tweets Vader does not work as well in other languages from my experience and so that is something that we really need to do to get the most useful analysis possible we're also including some visualization tools mouth portlet and Seabourn to make it look pretty I created this detector function because for the language detection we need to make sure that it is a texturing that it's this big fit in if you feed in a number or something that is non text you will get an exception thrown so this is just saying that if there is an exception we put none in instead then we build this analyzer object and create some of the parameters for us to query the tweets I'm looking at you know three or four days before the premiere and until now basically after the premiere so we will right here actually end up queering the tweets this takes 10 or so minutes it takes a while we then put them into dictionaries so that we can put them into a data frame finally down here is where we actually sort for the English language now I would recommend saving these to CSV files your data frames now because it'll save you some rework in the future if you you know mess up Python crashes you will have that saved so you don't have to run the Twitter query again which is fairly time-consuming now let's jump into the actual sentiment analysis so right here this is pretty much all we have to do we apply our analyzer clarity scores to each of the text segments in the tweet and we get those four features that I've mentioned before the amount of negativity the amount of neutral nests the amount of positivity and the composite of those things which is your actual sentiment score we then append that to our data source and I looked at a lot of these tweets and it looks like there were a ton of duplicates so those were advertisements or things along those lines and I wanted to get rid of those so we get a true or feeling of what the people really thought so I dropped the duplicates here finally I was having some trouble filtering by date time so I switched our timestamp into day time and made sure we were only getting after premiere tweets that were actually after the premiere of midnight the day after the movie came out after looking at a histogram I saw the majority of the tweets had a sentiment score of zero which means that they weren't necessarily negative or positive for our analysis sake I removed all of those tweets because I wanted to understand the actual parity between before the movie and after the premiere had launched needless to say I was pretty surprised by the results the even before leading up to the movie it had a fairly positive sentiment score of 0.3 for and after the movie premiere the sentiment score actually went up to 0.42 that's almost a 20 percent increase which is fairly impressive it suggests to me that a lot of the Twitter community at least enjoyed the movie even in spite of what has been said on YouTube and some other mediums are in this same analysis on Avengers infinity war from last summer and I also got very interesting results Avengers before the premiere had a sentiment that was positive but lower than Captain Marvel of right around point one for after the movie had premiered the sentiment dropped to point one that doesn't surprise me a ton because of how controversial the ending of that movie was but it still surprises me that in general all of the sentiment was lower now I'm not qualified to make any claims about the quality of Captain Marvel but this analysis suggests to me that the general Twitter community didn't feel too badly about it that it was fairly well received in spite of what a lot of people were saying about it and the ratings that it got thank you so much for watching and please let me know what you thought of the movie in the comment section below if you have any questions about my analysis please leave them there as well until next time

Original Description

I have seen many mixed reviews about Captain Marvel. I wanted to determine what the general feeling about the movie was on twitter. Here I use sentiment analysis to determine what people thought of the movie leading up to it and after the premier. I also compare the sentiment of Captain Marvel to Avengers: Infinity war, the previous summer's blockbuster. I get some very interesting results! #DataScience #DataScienceProject #CaptainMarvel #SentimmentAnalysis More from Ken Jee: https://twitter.com/KenJee_DS https://www.linkedin.com/in/kenjee/ https://medium.com/@kenneth.b.jee https://kennethjee.com/ https://github.com/PlayingNumbers https://kennethjee.com/ Resources: - My Github (https://github.com/PlayingNumbers/Captain_Marvel_Sentiment) - Inspiration for this video (https://towardsdatascience.com/sentiment-analysis-of-anthem-game-launch-in-python-16be9e5083d2) - twitterscraper module (https://github.com/taspinar/twitterscraper) - Vader Sentiment Analysis (https://github.com/cjhutto/vaderSentiment) - Vader How to (https://medium.com/analytics-vidhya/simplifying-social-media-sentiment-analysis-using-vader-in-python-f9e6ec6fc52f) #KenJee ⭕ Subscribe: https://www.youtube.com/c/kenjee1?sub_confirmation=1 🎙 Listen to My Podcast: https://www.youtube.com/c/KensNearestNeighborsPodcast 🕸 Check out My Website - https://kennethjee.com/ ✍️Sign up for My Newsletter - https://www.kennethjee.com/newsletter 📚 Books and Products I use - https://www.amazon.com/shop/kenjee (affiliate link) Partners & Affiliates 🌟 365 Data Science - Courses ( 57% Annual Discount): https://365datascience.pxf.io/P0jbBY 🌟 Interview Query - https://www.interviewquery.com/?ref=kenjee MORE DATA SCIENCE CONTENT HERE: 🐤My Twitter - https://twitter.com/KenJee_DS 👔 LinkedIn - https://www.linkedin.com/in/kenjee/ 📈 Kaggle - https://www.kaggle.com/kenjee 📑 Medium Articles - https://medium.com/@kenneth.b.jee 💻 Github - https://github.com/PlayingNumbers 🏀 My Sports Blog -https://www.playin
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from Ken Jee · Ken Jee · 14 of 60

1 Predicting Crypto-Currency Price Using RNN lSTM & GRU
Predicting Crypto-Currency Price Using RNN lSTM & GRU
Ken Jee
2 Predicting Season Long NBA Wins Using Multiple Linear Regression
Predicting Season Long NBA Wins Using Multiple Linear Regression
Ken Jee
3 How I Became A Data Scientist From a Business Background
How I Became A Data Scientist From a Business Background
Ken Jee
4 Should You Get A Masters in Data Science?
Should You Get A Masters in Data Science?
Ken Jee
5 How to Simulate NBA Games in Python
How to Simulate NBA Games in Python
Ken Jee
6 Demystifying Data Science Roles
Demystifying Data Science Roles
Ken Jee
7 The Best Way to Predict NBA Minutes Played
The Best Way to Predict NBA Minutes Played
Ken Jee
8 IT'S NOT TOO LATE TO LEARN CODE!
IT'S NOT TOO LATE TO LEARN CODE!
Ken Jee
9 My Top 5 Data Science Resources for 2019
My Top 5 Data Science Resources for 2019
Ken Jee
10 Watch This Before Applying to Data Science Jobs
Watch This Before Applying to Data Science Jobs
Ken Jee
11 Where YOU Should Start With Data Science Projects
Where YOU Should Start With Data Science Projects
Ken Jee
12 Welcome To My Channel | Ken Jee | Data Science
Welcome To My Channel | Ken Jee | Data Science
Ken Jee
13 Why You DON'T Want to be a WFH Data Scientist
Why You DON'T Want to be a WFH Data Scientist
Ken Jee
Was Captain Marvel Bad? A Sentiment Analysis of Twitter Data
Was Captain Marvel Bad? A Sentiment Analysis of Twitter Data
Ken Jee
15 Data Science, Machine Learning, and AI: What's the Difference?
Data Science, Machine Learning, and AI: What's the Difference?
Ken Jee
16 Data Science: Startup vs. Large Corporation
Data Science: Startup vs. Large Corporation
Ken Jee
17 Where to Look for Data Science Jobs
Where to Look for Data Science Jobs
Ken Jee
18 Work From Home Data Scientist: Day in the Life
Work From Home Data Scientist: Day in the Life
Ken Jee
19 Scrape Twitter Data in Python with Twitterscraper Module
Scrape Twitter Data in Python with Twitterscraper Module
Ken Jee
20 Should You Learn R for Data Science?
Should You Learn R for Data Science?
Ken Jee
21 NASA Physicist Turned Data Scientist (Tim Bowling) - KNN EP. 02
NASA Physicist Turned Data Scientist (Tim Bowling) - KNN EP. 02
Ken Jee
22 I Wish I Had Known THIS Before Starting in Data Science
I Wish I Had Known THIS Before Starting in Data Science
Ken Jee
23 What I Learned From My Three Degrees
What I Learned From My Three Degrees
Ken Jee
24 Most Data Science Hopefuls Overlook This Important Skill
Most Data Science Hopefuls Overlook This Important Skill
Ken Jee
25 Golf STATS: Strokes Gained Explained
Golf STATS: Strokes Gained Explained
Ken Jee
26 My Top 5 Data Science Internship Tips
My Top 5 Data Science Internship Tips
Ken Jee
27 How I Got My First Data Science Internship (And How You Can Land One)
How I Got My First Data Science Internship (And How You Can Land One)
Ken Jee
28 Data Science: Pros and Cons
Data Science: Pros and Cons
Ken Jee
29 Data Science Fundamentals: Data Exploration in Python (Pandas)
Data Science Fundamentals: Data Exploration in Python (Pandas)
Ken Jee
30 Data Science Fundamentals: Data Manipulation in Python (Pandas)
Data Science Fundamentals: Data Manipulation in Python (Pandas)
Ken Jee
31 What Does a Data Scientist Actually Do?
What Does a Data Scientist Actually Do?
Ken Jee
32 The Projects You Should Do To Get A Data Science Job
The Projects You Should Do To Get A Data Science Job
Ken Jee
33 Take Your Data Science Projects From Good to Great
Take Your Data Science Projects From Good to Great
Ken Jee
34 How To Get Data Science Experience (Without a Job)
How To Get Data Science Experience (Without a Job)
Ken Jee
35 Data Science Fundamentals: Data Cleaning in Python
Data Science Fundamentals: Data Cleaning in Python
Ken Jee
36 Is Data Science Right For You?
Is Data Science Right For You?
Ken Jee
37 Thank You For The Support | What's Next | Ken Jee | Data Science
Thank You For The Support | What's Next | Ken Jee | Data Science
Ken Jee
38 How To Build A Word Cloud From Scraped Data (Python)
How To Build A Word Cloud From Scraped Data (Python)
Ken Jee
39 6 Habits of Successful Data Scientists
6 Habits of Successful Data Scientists
Ken Jee
40 How Far Should the NBA 3-Point Line Actually Be?
How Far Should the NBA 3-Point Line Actually Be?
Ken Jee
41 How to Stay Productive & Motivated When Learning Data Science
How to Stay Productive & Motivated When Learning Data Science
Ken Jee
42 Why is Balance Important in Data Science?
Why is Balance Important in Data Science?
Ken Jee
43 By The Numbers: Where Should The NBA Put a 4 Point Line?
By The Numbers: Where Should The NBA Put a 4 Point Line?
Ken Jee
44 Why Selling Is An Important Data Science Skill
Why Selling Is An Important Data Science Skill
Ken Jee
45 Applying Data Science To My YouTube Data: My Surprising Findings
Applying Data Science To My YouTube Data: My Surprising Findings
Ken Jee
46 9 Ways You Can Make Extra Income as a Data Scientist
9 Ways You Can Make Extra Income as a Data Scientist
Ken Jee
47 Sports Analytics 101: The Pythagorean Theorem of Sports
Sports Analytics 101: The Pythagorean Theorem of Sports
Ken Jee
48 Golf: Would You Rather Be the LONGEST or STRAIGHTEST Driver on the PGA Tour?
Golf: Would You Rather Be the LONGEST or STRAIGHTEST Driver on the PGA Tour?
Ken Jee
49 Data Science Fundamentals: Linear Regression
Data Science Fundamentals: Linear Regression
Ken Jee
50 How YOU Can Land a Sports Analytics Job
How YOU Can Land a Sports Analytics Job
Ken Jee
51 The 5 Stages of Data Science Adoption
The 5 Stages of Data Science Adoption
Ken Jee
52 Math Needed for Mastering Data Science
Math Needed for Mastering Data Science
Ken Jee
53 5 Sports Analytics Books to Get You Started
5 Sports Analytics Books to Get You Started
Ken Jee
54 3 Reasons You Should NOT Become a Data Scientist
3 Reasons You Should NOT Become a Data Scientist
Ken Jee
55 Collision Course: Sports Betting + Data Science
Collision Course: Sports Betting + Data Science
Ken Jee
56 How to Scrape NBA Data Using the nba_api Python Module
How to Scrape NBA Data Using the nba_api Python Module
Ken Jee
57 5 Data Science Resolutions for 2020
5 Data Science Resolutions for 2020
Ken Jee
58 The Data Science Interview: What to Expect
The Data Science Interview: What to Expect
Ken Jee
59 The 9 Books That Changed My Perspective in 2019
The 9 Books That Changed My Perspective in 2019
Ken Jee
60 Questions You Should Ask Your Data Science Interviewers
Questions You Should Ask Your Data Science Interviewers
Ken Jee

The video teaches how to perform sentiment analysis on Twitter data using Python and Vader Sentiment tool, and how to apply it to a real-world problem like analyzing the sentiment of a movie. The analysis reveals interesting insights into the general feeling about Captain Marvel and Avengers: Infinity War.

Key Takeaways
  1. Import relevant Python modules
  2. Use Twitter Scraper to collect Twitter data
  3. Apply Vader Sentiment tool to analyze sentiment
  4. Visualize data using matplotlib and seaborn
  5. Filter data by language and date
  6. Remove duplicates and neutral tweets
💡 The sentiment analysis reveals that the general Twitter community had a fairly positive sentiment towards Captain Marvel, with a sentiment score increasing by almost 20% after the movie's premiere.

Related AI Lessons

Up next
News At 10
Channels Television
Watch →