Data Wrangling(Gathering)

This phase of the project containts the following tasks which need to be done programmatically.

In [1]:
#Importing basic packages needed to get Data 
import pandas as pd
import requests
import os
import tweepy
import json

1. Download Data Manually and Read in to check

In [2]:
archive = pd.read_csv('data/twitter-archive-enhanced.csv')
archive.head()
Out[2]:
tweet_id in_reply_to_status_id in_reply_to_user_id timestamp source text retweeted_status_id retweeted_status_user_id retweeted_status_timestamp expanded_urls rating_numerator rating_denominator name doggo floofer pupper puppo
0 892420643555336193 NaN NaN 2017-08-01 16:23:56 +0000 <a href="http://twitter.com/download/iphone" r... This is Phineas. He's a mystical boy. Only eve... NaN NaN NaN https://twitter.com/dog_rates/status/892420643... 13 10 Phineas None None None None
1 892177421306343426 NaN NaN 2017-08-01 00:17:27 +0000 <a href="http://twitter.com/download/iphone" r... This is Tilly. She's just checking pup on you.... NaN NaN NaN https://twitter.com/dog_rates/status/892177421... 13 10 Tilly None None None None
2 891815181378084864 NaN NaN 2017-07-31 00:18:03 +0000 <a href="http://twitter.com/download/iphone" r... This is Archie. He is a rare Norwegian Pouncin... NaN NaN NaN https://twitter.com/dog_rates/status/891815181... 12 10 Archie None None None None
3 891689557279858688 NaN NaN 2017-07-30 15:58:51 +0000 <a href="http://twitter.com/download/iphone" r... This is Darla. She commenced a snooze mid meal... NaN NaN NaN https://twitter.com/dog_rates/status/891689557... 13 10 Darla None None None None
4 891327558926688256 NaN NaN 2017-07-29 16:00:24 +0000 <a href="http://twitter.com/download/iphone" r... This is Franklin. He would like you to stop ca... NaN NaN NaN https://twitter.com/dog_rates/status/891327558... 12 10 Franklin None None None None

2. Programmatically download data from a URL

In [3]:
folderName = 'data'
fName = url.split('/')[-1]
#Creating Folder Named Data 
if not os.path.exists(folderName):
    os.makedirs(folderName)
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-3-2cc14c2c6086> in <module>()
      1 folderName = 'data'
----> 2 fName = url.split('/')[-1]
      3 #Creating Folder Named Data
      4 if not os.path.exists(folderName):
      5     os.makedirs(folderName)

NameError: name 'url' is not defined
In [ ]:
# Here we have the URL provided by UDACITY
url = "https://d17h27t6h515a5.cloudfront.net/topher/2017/August/599fd2ad_image-predictions/image-predictions.tsv"
#fetching Data and saving to disk.
r = requests.get(url)
In [ ]:
#Writing Data to file 
with open(os.path.join(folderName,fName),mode = 'wb') as file:
    file.write(r.content)
In [ ]:
#Reading in Downloaded Data to check if working.
img = pd.read_csv('data/image-predictions.tsv', sep='\t')
img.head()

3. Downloading Twitter API Data For the Required Values

In [4]:
#Extracting Twitter Id's from the Archive DataFrame.
tweet_id = archive['tweet_id']
In [5]:
#Twiter Auth Data (Remove before sumbission)

consumer_key = 'VjFpwyCsbShxMv2ECEDWu71Uo'
consumer_secret = 'tLKupsqpJlJbGAE595oLptb4zVgyTVe5cGRaRQHOfnDt06w29e'
access_token = '2981974992-nCKD9ib35SsdrNN0HuMHKUNqpBCPvzWYZYtd0PR'
access_token_secret = 'msZMlp6w3mAjAxmiiqhIwgwntJPlyXMHHgX2wc5xgKMOg'

# consumer_key = ''
# consumer_secret = ''
# access_token = ''
# access_token_secret = ''
In [7]:
#Tweety Auth

auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)

api = tweepy.API(auth,wait_on_rate_limit=True, wait_on_rate_limit_notify=True)
In [8]:
#Variable Array created to capure Index ID's of Errors using the Twitter API
api_error = []

Writing a loop to download additional data from the twitter api and save them as their respective text files to be used in the futher steps.

Folder Name Being saved to : tweets/

File name: tweet_[ID OF TWEET].txt

In [6]:
#Using a Try Except Block here to access the twitter API, the Error's are logged in the api_error varuiable if needed later.
counter = 0;
for t in tweet_id:
    try:
        counter = counter+1
        fileName = 'data/tweet_json.txt'
        tweet = api.get_status(id=t, tweet_mode='extended')
        with open(fileName, 'a') as outfile:  
            json.dump(tweet._json,outfile)
            outfile.write(','+'\n')
            print(counter)
    except Exception:
        print(str(counter)+" ERROR ERROR ERROR")
        api_error.append(counter)
        pass
1 ERROR ERROR ERROR
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-6-5740241f87e1> in <module>()
      5         fileName = 'data/tweet_json.txt'
----> 6         tweet = api.get_status(id=t, tweet_mode='extended')
      7         with open(fileName, 'a') as outfile:

NameError: name 'api' is not defined

During handling of the above exception, another exception occurred:

NameError                                 Traceback (most recent call last)
<ipython-input-6-5740241f87e1> in <module>()
     11     except Exception:
     12         print(str(counter)+" ERROR ERROR ERROR")
---> 13         api_error.append(counter)
     14         pass

NameError: name 'api_error' is not defined
In [ ]:
#Errors for ID's, They have been not added to the DataFrame.
errors = [2056,1993,1945,1865,1836,1616,1310]
api_error
In [9]:
#Loading in JSON File 
with open('data/tweet_json.txt') as f:
    data = json.loads(f.read())
In [29]:
data[0]
#Using this Dumped Data (first Instance Only) to parse the JSON using the following tool : http://json.parser.online.fr/ \
#and understand the structure of the JSON. 
Out[29]:
{'contributors': None,
 'coordinates': None,
 'created_at': 'Tue Aug 01 16:23:56 +0000 2017',
 'display_text_range': [0, 85],
 'entities': {'hashtags': [],
  'media': [{'display_url': 'pic.twitter.com/MgUWQ76dJU',
    'expanded_url': 'https://twitter.com/dog_rates/status/892420643555336193/photo/1',
    'id': 892420639486877696,
    'id_str': '892420639486877696',
    'indices': [86, 109],
    'media_url': 'http://pbs.twimg.com/media/DGKD1-bXoAAIAUK.jpg',
    'media_url_https': 'https://pbs.twimg.com/media/DGKD1-bXoAAIAUK.jpg',
    'sizes': {'large': {'h': 528, 'resize': 'fit', 'w': 540},
     'medium': {'h': 528, 'resize': 'fit', 'w': 540},
     'small': {'h': 528, 'resize': 'fit', 'w': 540},
     'thumb': {'h': 150, 'resize': 'crop', 'w': 150}},
    'type': 'photo',
    'url': 'https://t.co/MgUWQ76dJU'}],
  'symbols': [],
  'urls': [],
  'user_mentions': []},
 'extended_entities': {'media': [{'display_url': 'pic.twitter.com/MgUWQ76dJU',
    'expanded_url': 'https://twitter.com/dog_rates/status/892420643555336193/photo/1',
    'id': 892420639486877696,
    'id_str': '892420639486877696',
    'indices': [86, 109],
    'media_url': 'http://pbs.twimg.com/media/DGKD1-bXoAAIAUK.jpg',
    'media_url_https': 'https://pbs.twimg.com/media/DGKD1-bXoAAIAUK.jpg',
    'sizes': {'large': {'h': 528, 'resize': 'fit', 'w': 540},
     'medium': {'h': 528, 'resize': 'fit', 'w': 540},
     'small': {'h': 528, 'resize': 'fit', 'w': 540},
     'thumb': {'h': 150, 'resize': 'crop', 'w': 150}},
    'type': 'photo',
    'url': 'https://t.co/MgUWQ76dJU'}]},
 'favorite_count': 38625,
 'favorited': False,
 'full_text': "This is Phineas. He's a mystical boy. Only ever appears in the hole of a donut. 13/10 https://t.co/MgUWQ76dJU",
 'geo': None,
 'id': 892420643555336193,
 'id_str': '892420643555336193',
 'in_reply_to_screen_name': None,
 'in_reply_to_status_id': None,
 'in_reply_to_status_id_str': None,
 'in_reply_to_user_id': None,
 'in_reply_to_user_id_str': None,
 'is_quote_status': False,
 'lang': 'en',
 'place': None,
 'possibly_sensitive': False,
 'possibly_sensitive_appealable': False,
 'retweet_count': 8541,
 'retweeted': False,
 'source': '<a href="http://twitter.com/download/iphone" rel="nofollow">Twitter for iPhone</a>',
 'truncated': False,
 'user': {'contributors_enabled': False,
  'created_at': 'Sun Nov 15 21:41:29 +0000 2015',
  'default_profile': False,
  'default_profile_image': False,
  'description': 'Your Only Source for Pawfessional Dog Ratings STORE: @ShopWeRateDogs | IG, FB & SC: WeRateDogs | MOBILE APP: @GoodDogsGame Business: dogratingtwitter@gmail.com',
  'entities': {'description': {'urls': []},
   'url': {'urls': [{'display_url': 'weratedogs.com',
      'expanded_url': 'http://weratedogs.com',
      'indices': [0, 23],
      'url': 'https://t.co/N7sNNHSfPq'}]}},
  'favourites_count': 135413,
  'follow_request_sent': False,
  'followers_count': 7087411,
  'following': False,
  'friends_count': 9,
  'geo_enabled': True,
  'has_extended_profile': True,
  'id': 4196983835,
  'id_str': '4196983835',
  'is_translation_enabled': False,
  'is_translator': False,
  'lang': 'en',
  'listed_count': 4667,
  'location': 'š¯“¶š¯“®š¯“»š¯“¬š¯“± ā†´      DM YOUR DOGS',
  'name': 'WeRateDogsā„¢',
  'notifications': False,
  'profile_background_color': '000000',
  'profile_background_image_url': 'http://abs.twimg.com/images/themes/theme1/bg.png',
  'profile_background_image_url_https': 'https://abs.twimg.com/images/themes/theme1/bg.png',
  'profile_background_tile': False,
  'profile_banner_url': 'https://pbs.twimg.com/profile_banners/4196983835/1525830435',
  'profile_image_url': 'http://pbs.twimg.com/profile_images/948761950363664385/Fpr2Oz35_normal.jpg',
  'profile_image_url_https': 'https://pbs.twimg.com/profile_images/948761950363664385/Fpr2Oz35_normal.jpg',
  'profile_link_color': 'F5ABB5',
  'profile_sidebar_border_color': '000000',
  'profile_sidebar_fill_color': '000000',
  'profile_text_color': '000000',
  'profile_use_background_image': False,
  'protected': False,
  'screen_name': 'dog_rates',
  'statuses_count': 7341,
  'time_zone': None,
  'translator_type': 'none',
  'url': 'https://t.co/N7sNNHSfPq',
  'utc_offset': None,
  'verified': True}}
In [65]:
#TEST CODE - Used to only check first Data

#Checking Queries on first Data Value printing them to the console.
Tid = data[0]['id_str']
full_text = data[0]['full_text']
retweet_count = data[0]['retweet_count']
fav_count = data[0]['favorite_count']
url = data[0]["extended_entities"]["media"][0]["url"]
index = data[0]['full_text'].index('/')
numerator = int(data[0]['full_text'][index-2:index])
denominator = int(data[0]['full_text'][index+1:index+3])
name = (data[0]['full_text'].split('.')[0].split(" ")[-1])
if 'doggo' in val:
    dog = 'doggo'
elif 'pupper' in val:
    dog = 'pupper'
elif 'puppo' in val:
    dog = 'puppo'
elif 'floofer' in val:
    dog = 'floofer'
else:
    dog = None
print(Tid)
print(full_text)
print(retweet_count)
print(fav_count)
print(url)
print(index)
print(numerator)
print(denominator)
print(name)
892420643555336193
This is Phineas. He's a mystical boy. Only ever appears in the hole of a donut. 13/10 https://t.co/MgUWQ76dJU
8541
38625
https://t.co/MgUWQ76dJU
82
13
10
Phineas
In [11]:
#Another Check for parsing the JSON (it has quite a complicated Schema.)
data[0]["extended_entities"]["media"][0]["url"]
Out[11]:
'https://t.co/MgUWQ76dJU'

Here we are extracting data which will be used to solve various data Quality issues.
These are Dog Name, Numerator, Denominator and the type of dog (doggo, fluffer, etc)

Creating the Final Dataframe : api

In [82]:
#Extracting Required feilds from JSON and making a new data frame df
df_list = []
for val in data:
    Tid = val['id_str']
    full_text = val['full_text']
    retweet_count = val['retweet_count']
    fav_count = val['favorite_count']
    index = val['full_text'].index('/')
    numerator = full_text[index-2:index]
    denominator = full_text[index+1:index+3]
    
    name = full_text.split('.')[0].split(" ")[-1]
    
    if 'doggo' in full_text:
        dog = 'doggo'
    elif 'pupper' in full_text:
        dog = 'pupper'
    elif 'puppo' in full_text:
        dog = 'puppo'
    elif 'floofer' in full_text:
        dog = 'floofer'
    else:
        dog = None
    
    df_list.append({'tweet_id': int(Tid),
                    'full_text': full_text,
                    'retweet_count': int(retweet_count),
                    'fav_count' : int(fav_count),
                    'numerator' : numerator, #[Q#1] 
                    'denominator': denominator, #[Q#3]
                    'pet_name' : name, #[Q#2]
                    'dog' : dog #[T#1]
                   })
    


api = pd.DataFrame(data=df_list)
In [70]:
#Checking our newly created DataFrame.
api.head(50)
Out[70]:
denominator dog fav_count full_text name numerator retweet_count tweet_id
0 10 None 38625 This is Phineas. He's a mystical boy. Only eve... Phineas 13 8541 892420643555336193
1 10 None 33105 This is Tilly. She's just checking pup on you.... Tilly 13 6282 892177421306343426
2 10 None 24922 This is Archie. He is a rare Norwegian Pouncin... Archie 12 4161 891815181378084864
3 10 None 42022 This is Darla. She commenced a snooze mid meal... Darla 13 8670 891689557279858688
4 10 None 40172 This is Franklin. He would like you to stop ca... Franklin 12 9422 891327558926688256
5 10 None 20140 Here we have a majestic great white breaching ... coast 13 3118 891087950875897856
6 10 None 11807 Meet Jax. He enjoys ice cream so much he gets ... Jax 13 2076 890971913173991426
7 10 None 65260 When you watch your owner call another dog a g... boy 13 18929 890729181411237888
8 10 None 27682 This is Zoey. She doesn't want to be one of th... Zoey 13 4275 890609185150312448
9 10 doggo 31823 This is Cassie. She is a college pup. Studying... Cassie 14 7434 890240255349198849
10 10 None 30563 This is Koda. He is a South Australian decksha... Koda 13 7353 890006608113172480
11 10 None 27679 This is Bruno. He is a service shark. Only get... Bruno 13 4980 889880896479866881
12 10 puppo 47935 Here's a puppo that seems to be on the fence a... her 13 10083 889665388333682689
13 10 None 27070 This is Ted. He does his best. Sometimes that'... Ted 12 4551 889638837579907072
14 10 puppo 15040 This is Stuart. He's sporting his favorite fan... Stuart 13 2241 889531135344209921
15 10 None 25190 This is Oliver. You're witnessing one of his m... Oliver 13 5430 889278841981685760
16 10 None 28972 This is Jim. He found a fren. Taught him how t... Jim 12 4508 888917238123831296
17 10 None 25482 This is Zeke. He has a new stick. Very proud o... Zeke 13 4353 888804989199671297
18 10 None 19824 This is Ralphus. He's powering up. Attempting ... Ralphus 13 3588 888554962724278272
19 10 None 21677 This is Gerald. He was just told he didn't get... Gerald 12 3500 888078434458587136
20 10 None 30067 This is Jeffrey. He has a monopoly on the pool... Jeffrey 13 5405 887705289381826560
21 10 None 46065 I've yet to rate a Venezuelan Hover Wiener. Th... Wiener 14 11693 887517139158093824
22 10 None 68851 This is Canela. She attempted some fancy porch... Canela 13 18259 887473957103951883
23 10 None 33548 You may not have known you needed to see this ... today 13 10422 887343217045368832
24 10 None 30425 This... is a Jubilant Antarctic House Bear. We... This 12 5975 887101392804085760
25 10 None 35026 This is Maya. She's very shy. Rarely leaves he... Maya 13 7791 886983233522544640
26 10 None 12015 This is Mingus. He's a wonderful father to his... Mingus 13 3302 886736880519319552
27 10 None 22325 This is Derek. He's late for a dog meeting. 13... Derek 13 4477 886680336477933568
28 10 pupper 21112 This is Roscoe. Another pupper fallen victim t... Roscoe 12 3203 886366144734445568
29 10 None 116 @NonWhiteHat @MayhewMayhem omg hello tanner yo... caution 12 4 886267009285017600
30 10 None 27869 This is Waffles. His doggles are pupside down.... Waffles 13 6294 886258384151887873
31 10 None 0 RT @Athletics: 12/10 #BATP https://t.co/WxwJmv... https://t 12 104 886054160059072513
32 10 None 32578 Viewer discretion advised. This is Jimbo. He w... advised 12 6819 885984800019947520
33 10 None 35856 This is Maisey. She fell asleep mid-excavation... Maisey 13 6436 885528943205470208
34 10 None 20341 I have a new hero and his name is Howard. 14/1... Howard 14 3762 885518971528720385
35 10 None 0 RT @dog_rates: This is Lilly. She just paralle... Lilly 13 18601 885311592912609280
36 10 None 21865 Here we have a corgi undercover as a malamute.... malamute 13 4386 885167619883638784
37 10 None 77250 This is Earl. He found a hat. Nervous about wh... Earl 12 18455 884925521741709313
38 10 None 27835 This is Lola. It's her first time outside. Mus... Lola 13 5793 884876753390489601
39 10 None 24212 This is Kevin. He's just so happy. 13/10 what ... Kevin 13 4870 884562892145688576
40 10 None 26881 I present to you, Pup in Hat. Pup in Hat is gr... Hat 14 5651 884441805382717440
41 10 None 72719 OMG HE DIDN'T MEAN TO HE WAS JUST TRYING A LIT... https://t 13 20460 884247878851493888
42 10 doggo 20309 Meet Yogi. He doesn't have any important dog m... Yogi 12 2986 884162670584377345
43 10 None 21822 This is Noah. He can't believe someone made th... Noah 12 3444 883838122936631299
44 10 None 45778 This is Bella. She hopes her smile made you sm... Bella .5 9964 883482846933004288
45 10 floofer 22488 Meet Grizzwald. He may be the floofiest floofe... Grizzwald 13 3680 883360690899218434
46 10 None 37094 Please only send dogs. We don't rate mechanics... dogs 13 6674 883117836046086144
47 10 None 23871 This is Rusty. He wasn't ready for the first p... Rusty 13 3917 882992080364220416
48 10 pupper 28219 This is Gus. He's quite the cheeky pupper. Alr... Gus 12 4924 882762694511734784
49 10 None 27802 This is Stanley. He has his first swim lesson ... Stanley 13 6097 882627270321602560
In [ ]:
#Rearanging the DF Columns to make more sense when read in.
api = api[['tweet_id', 'full_text', 'fav_count','retweet_count', 'pet_name', 'dog', 'numerator', 'denominator']]
api.head()
In [ ]:
#Saving Twitter Data extracted from API as CSV
api.to_csv('data/twitter_archive_api.csv')

Testing Code is Below Please Check for Understanding how I reached the above solutions

In [55]:
#Sample Test Block for the loop used above.
df_api = []
for val in api['full_text']:
    #Code for finding numberator and denominator
    Tid = api["tweet_id"]
    index = val.index('/')
    rating_numerator = val[index-2:index]
    rating_denominator = val[index+1:index+3]
    name = (val.split('.')[0].split(" ")[-1])
    if 'doggo' in val:
        dog = 'doggo'
    elif 'pupper' in val:
        dog = 'pupper'
    elif 'puppo' in val:
        dog = 'puppo'
    elif 'floofer' in val:
        dog = 'floofer'
    else:
        dog = None

    
    df_api.append({
        'tweet_id' : Tid,
        'name' : name,
        'rating_numerator' : rating_numerator,
        'rating_denominator' : rating_denominator,
        'dog' : dog
    })
    
df_api_pd = pd.DataFrame(data=df_api)
df_api_pd.head(50)
Out[55]:
dog name rating_denominator rating_numerator tweet_id
0 None Phineas 10 13 0 892420643555336193 1 89217742130...
1 None Tilly 10 13 0 892420643555336193 1 89217742130...
2 None Archie 10 12 0 892420643555336193 1 89217742130...
3 None Darla 10 13 0 892420643555336193 1 89217742130...
4 None Franklin 10 12 0 892420643555336193 1 89217742130...
5 None coast 10 13 0 892420643555336193 1 89217742130...
6 None Jax 10 13 0 892420643555336193 1 89217742130...
7 None boy 10 13 0 892420643555336193 1 89217742130...
8 None Zoey 10 13 0 892420643555336193 1 89217742130...
9 doggo Cassie 10 14 0 892420643555336193 1 89217742130...
10 None Koda 10 13 0 892420643555336193 1 89217742130...
11 None Bruno 10 13 0 892420643555336193 1 89217742130...
12 puppo her 10 13 0 892420643555336193 1 89217742130...
13 None Ted 10 12 0 892420643555336193 1 89217742130...
14 puppo Stuart 10 13 0 892420643555336193 1 89217742130...
15 None Oliver 10 13 0 892420643555336193 1 89217742130...
16 None Jim 10 12 0 892420643555336193 1 89217742130...
17 None Zeke 10 13 0 892420643555336193 1 89217742130...
18 None Ralphus 10 13 0 892420643555336193 1 89217742130...
19 None Gerald 10 12 0 892420643555336193 1 89217742130...
20 None Jeffrey 10 13 0 892420643555336193 1 89217742130...
21 None Wiener 10 14 0 892420643555336193 1 89217742130...
22 None Canela 10 13 0 892420643555336193 1 89217742130...
23 None today 10 13 0 892420643555336193 1 89217742130...
24 None This 10 12 0 892420643555336193 1 89217742130...
25 None Maya 10 13 0 892420643555336193 1 89217742130...
26 None Mingus 10 13 0 892420643555336193 1 89217742130...
27 None Derek 10 13 0 892420643555336193 1 89217742130...
28 pupper Roscoe 10 12 0 892420643555336193 1 89217742130...
29 None caution 10 12 0 892420643555336193 1 89217742130...
30 None Waffles 10 13 0 892420643555336193 1 89217742130...
31 None https://t 10 12 0 892420643555336193 1 89217742130...
32 None advised 10 12 0 892420643555336193 1 89217742130...
33 None Maisey 10 13 0 892420643555336193 1 89217742130...
34 None Howard 10 14 0 892420643555336193 1 89217742130...
35 None Lilly 10 13 0 892420643555336193 1 89217742130...
36 None malamute 10 13 0 892420643555336193 1 89217742130...
37 None Earl 10 12 0 892420643555336193 1 89217742130...
38 None Lola 10 13 0 892420643555336193 1 89217742130...
39 None Kevin 10 13 0 892420643555336193 1 89217742130...
40 None Hat 10 14 0 892420643555336193 1 89217742130...
41 None https://t 10 13 0 892420643555336193 1 89217742130...
42 doggo Yogi 10 12 0 892420643555336193 1 89217742130...
43 None Noah 10 12 0 892420643555336193 1 89217742130...
44 None Bella 10 .5 0 892420643555336193 1 89217742130...
45 floofer Grizzwald 10 13 0 892420643555336193 1 89217742130...
46 None dogs 10 13 0 892420643555336193 1 89217742130...
47 None Rusty 10 13 0 892420643555336193 1 89217742130...
48 pupper Gus 10 12 0 892420643555336193 1 89217742130...
49 None Stanley 10 13 0 892420643555336193 1 89217742130...
In [52]:
#Sample code used for Calculating Numerator, Denominator and Pet Name
index = val.index('/')
print(val[index-2:index])
print(val[index+1:index+3])
print(val.split('.')[0].split(" ")[-1])
 8
10
Setter
In [53]:
#Checking the value of variable val which contains full_text from the twitter api
val
Out[53]:
'Here we have a Japanese Irish Setter. Lost eye in Vietnam (?). Big fan of relaxing on stair. 8/10 would pet https://t.co/BLDqew2Ijj'
In [54]:
#Re initing Val with a diffrent Data value (without a dog Name)
val = api["full_text"][12]
val
Out[54]:
"Here's a puppo that seems to be on the fence about something haha no but seriously someone help her. 13/10 https://t.co/BxvuXk0UCm"
In [ ]:
str(val)
if 'doggo' in val:
    dog = ('doggo')
elif 'pupper' in val:
    dog = ('pupper')
elif 'puppo' in val:
    dog = ('puppo')
elif 'floofer' or 'floof' in val:
    dog =  ('floofer')
else:
    dog = ("None")