Twitter read and analysis
    # Import tweepy to work with the twitter API
    import tweepy as tw
    
    # Import numpy and pandas to work with dataframes
    import numpy as np
    import pandas as pd
    
    from matplotlib import pyplot as plt
    
    consumer_key ='mycode'
    consumer_secret = 'mycode'
    
    access_token ='mycode'
    access_token_secret = 'mycode'
    
    # Authenticate
    auth = tw.OAuthHandler(consumer_key, consumer_secret)
    # Set Tokens
    auth.set_access_token(access_token, access_token_secret)
    # Instantiate API
    api = tw.API(auth, wait_on_rate_limit=True)
    
    hashtag = "#slap"
    query = tw.Cursor(api.search_tweets, q=hashtag).items(1000)
    tweets = [{'Tweet':tweet.text, 'Timestamp':tweet.created_at} for tweet in query]
    print(tweets)
    
    df = pd.DataFrame.from_dict(tweets)
    df.head()
    
    willsmith_handle = ['willsmith', 'will smith', 'will', 'smith', 'slap\'s']
    
    def identify_subject(tweet, refs):
        flag = 0
     for ref in refs:
     if tweet.find(ref) != -1:
                flag = 1
     return flag
    
    df['will smith'] = df['Tweet'].apply(lambda x: identify_subject(x, willsmith_handle))
    df.head(10)
    
    df.to_csv('Twitter_feed.csv', encoding='utf-8')

 

A working process based on an online tutorial. The code takes in twitter tweets and exports them to csv file.

I'm going to try and expand to read the sentiment and feedback of different tweets.