Skip to content

Instantly share code, notes, and snippets.

@prrao87
Created May 24, 2020 05:56
Show Gist options
  • Save prrao87/63dc5eaa0d4ae567e65fbc0cdbc99770 to your computer and use it in GitHub Desktop.
Save prrao87/63dc5eaa0d4ae567e65fbc0cdbc99770 to your computer and use it in GitHub Desktop.
def read_data(inputfile):
"Read in a tab-separated file with date, headline and news content"
df = pd.read_csv(inputfile, sep='\t', header=None,
names=['date', 'headline', 'content'])
df['date'] = pd.to_datetime(df['date'], format="%Y-%m-%d")
return df
df = read_data(inputfile)
df.head(3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment