How to Use the Tweepy Python Package | by Dina Bavli | Feb, 2022

Retrieve all you might want from a tweet using the tweepy python package and formatting it into a pandas data frame.

First thing first- make sure you have a Twitter account.

Screenshot from Twitter
Screenshot snippet from Twitter
Screenshot from Twitter
Screenshot from the code attached
Screenshot from the code attached
Screenshot from the code attached
  • Queries — the terms you are searching for?
  • Filters — what you don’t want to retrieve
  • Tweet_mode — 140 or 280 characters?
  • Include_rts — do you want retweets as well?
  • Lang Items — what language do you search for?

A closer look at an extended tweet

Here is an example tweet taken from my thread:

Screenshot from personal Twitter
  • Text
  • emojis
  • Dates
  • Retweet
  • Mentions
  • users
  • Hashtags
  • Reply to
  • Likes
  • URLs
  • Images
Screenshot from personal Twitter
  • Name
  • Screen name
  • Followers
  • Following
  • Joined at
  • Likes
  • Tweets
Screenshot of the dictionary code of fields from a tweet object that creates the data frame.
Image by intographics from Pixabay
Screenshot of one retrieved tweet metadata

Encoding may create garbage

Screenshot from StackOverflow

Leave a Comment