Finding Who and Where from Twitter Hashtag Conversation

Pankaj Kumar
10 min readSep 18, 2021
Photo by Jan Baborák on Unsplash

In this post, I am going to collect tweets on a Hashtag and create a graph of tweets and users who tweeted and retweeted these tweets from different locations. The graph will be created in the neo4j database. After creating this graph you‘ll be able to answer few basic questions :

  • Which tweets were retweeted the maximum number of times
  • where users with the most tweets are located
  • Who is mentioned the most number of times in a tweet
  • Who has retweeted the most number of tweets
  • who has tweeted the most number of tweets?

There are two major steps involved in graph creation. First is the collection of tweets and the second using different attributes of these tweets to construct the graph. We can use Cypher query language for querying our graph database like we use SQL for querying our relational databases.

Step 1

Use Twitter API to get recent tweets

I have created this class TweetCollector to collect the tweets based on a query. The basic functions are the same as the ones I used in another post

https://pankaj-tiwari2.medium.com/python-nltk-and-textblob-for-analyzing-sentiment-from-recent-tweets-colle

--

--

Pankaj Kumar

MS Data Science SMU TX. Pursuing MSc Financial Engg. At WQU.Interest in Algos, Discovering Trends fm data. Methodical, conven/non-conven. Investigation of data.