Skip to content

Instantly share code, notes, and snippets.

@kurasaiteja
Last active May 28, 2020 21:19
Show Gist options
  • Save kurasaiteja/6ad1b54f2223dc5d7420ca13979967cb to your computer and use it in GitHub Desktop.
Save kurasaiteja/6ad1b54f2223dc5d7420ca13979967cb to your computer and use it in GitHub Desktop.
# Print created_at to see the original format of datetime in Twitter data
print(df_tweet['created_at'].head())
# Convert the created_at column to np.datetime object
df_tweet['created_at'] = pd.to_datetime(df_tweet['created_at'])
# Print created_at to see new format
print(df_tweet['created_at'].head())
# Set the index of df_tweet to created_at
df_tweet = df_tweet.set_index('created_at')
# Create a python column
df_tweet['python'] = check_word_in_tweet('python', df_tweet)
# Create an js column
df_tweet['js'] = check_word_in_tweet('javascript', df_tweet)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment