Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

tweepy to dataframe

import os
import tweepy
import pandas as pd

# use os.environ.get to obtain other environment variables
# from ~/.bashrc or ~/.zshrc etc., so they aren't in your code
consumer_key = os.environ.get('c_key')
consumer_secret = # os...
access_token = # os...
access_token_secret = # os...
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth)

results = api.search(q='cheese', count=100)

json_data = [r._json for r in results]

df = pd.json_normalize(json_data)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #tweepy #dataframe
ADD COMMENT
Topic
Name
8+8 =