We are going to be using lambda functions and string comparisons to find the retweets. apply method to apply a function to the values in each cell of a column. We will be doing this with the pandas series. In the line below we will find how many of the of the tweets start with ‘RT’ and hence how many of them are retweets. ![]() You may have seen when looking at the dataframe that there were tweets that started with the letters ‘RT’. You can do this using the df.tweet.unique().shape. One thing we should think about is how many of our tweets are actually unique because people retweet each other and so there could be multiple copies of the same tweet. You can use df.shape where df is your dataframe. EDA - Time to start exploring our datasetįind out the shape of your dataset to find out how many tweets we have. This doesn’t matter for this tutorial, but it always good to question what has been done to your dataset before you start working with it. This was in the dataset when we downloaded it initially and it will be in yours. ![]() Note that some of the web links have been replaced by, but some have not. URUGUAY: Tools Needed for Those Most Vulnerable to Climate Change įighting poverty and global warming in Africa Ĭarbon offsets: How a Vatican forest failed to reduce global warming Global warming report urges governments to act|BRUSSELS, Belgium (AP) - The world faces increased hunger and. Have a quick look at your dataframe, it should look like this: The first thing we will do is to get you set up with the data.ĭf = pd. This can be as basic as looking for keywords and phrases like ‘marmite is bad’ or ‘marmite is good’ or can be more advanced, aiming to discover general topics (not just marmite related ones) contained in a dataset. The tweets that millions of users send can be downloaded and analysed to try and investigate mass opinion on particular issues. ![]() Twitter is a fantastic source of data for a social scientist, with over 8,000 tweets sent per second. You will need to have the following packages installed : numpy, pandas, seaborn, matplotlib, sklearn, nltk.In order to do this tutorial, you should be comfortable with basic Python, the pandas and numpy packages and should be comfortable with making and interpreting plots.From a sample dataset we will clean the text data and explore what popular hashtags are being used, who is being tweeted at and retweeted, and finally we will use two unsupervised machine learning algorithms, specifically latent dirichlet allocation (LDA) and non-negative matrix factorisation (NMF), to explore the topics of the tweets in full. In this tutorial we are going to be performing topic modelling on twitter data to find what people are tweeting about in relation to climate change. Finding keyword correlations in text data.Extracting substrings with regular expressions.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |