How to use Data Science Superpowers for Useless Things: Finding an Old Article
1 minute read
- Get sent an article years ago that is super profound
- Forget about it for some more years
- Think about it and try to find it
- … fail miserably
- Contact the person who sent you the article
- … they too cannot find
- Panic. Panic horribly. This is your worst fear. How will you ever be able to exist in a world where you cannot find things you’ve read about?
- SOLUTION: set up an email account JUST for forwarding things to that you don’t want to forget.
- PROBLEM: This email address is now full
- SOLUTION: export??!
- While unpacking why you did this to yourself, you remember The Article
- You also remember that you recently searched through all your old text messages (yes, this is something you do because (1) you export your text messages on a yearly basis for searching purposes (2) you like having a little “journal” of what you were doing that day)
- You re-open this document in google sheets and then realize you should 100% be doing this with python
- Start a new python file and get to work.
- Create a subset of the data that is ONLY the conversations between you and the person who sent you the article
- Search through the smaller DB for the word “article”
- Find it within four minutes. Win forever.
import pandas as pd
df = pd.read_csv('Messages_06_2015_to_08_2019_all - Messages_06_2015_to_08_2019_all.csv')
df.columns = ['status', 'datetime', 'person', 'number','text']
derek = df[df['person'] == "Derek Schulte"]
derek
df = derek.copy()
df_text = df[df['text'].str.contains("article")]
for text in df_text['text']:
print(text)