Andrew Jones
Andrew Jones

Reputation: 39

Streaming twitter data and saving to csv in Python

I’m trying to follow this tutorial on streaming tweets from twitter into a database, before then converting the database to a CSV file. I can implement the streaming API feature to capture data fine, however when trying to save the data in a csv file I am having problems.

At first I encountered a similar problem to this question where I receive the following error.

    AttributeError: module 'dataset' has no attribute 'freeze'

The solution removes the error when running the script but I am left with no CSV file and empty DB file instead.

I have looked over all the documentation but I'm really unsure on what I am doing wrong and how I can proceed.

My GitHub with all source code can be found here

Upvotes: 1

Views: 1128

Answers (1)

rudolfe
rudolfe

Reputation: 96

first of all I think that storing your tweets from stream in CSV file is a bad idea, and use MongoDB or another database where you will store your data.

Good example how you can organize streaming and storing tweets in database you can find on this github repository

Before inserting tweet to database, it's better to calculate sentiment score for tweet in advance. Sentiment analysis can be done by using VADER sentiment analysis tool.

Good luck)

Upvotes: 1

Related Questions