Created
May 24, 2020 05:56
-
-
Save prrao87/63dc5eaa0d4ae567e65fbc0cdbc99770 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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