Skip to content

Instantly share code, notes, and snippets.

@brockmanmatt
Last active October 10, 2019 03:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brockmanmatt/1ff604b2b777f46a6c658895d75e94b5 to your computer and use it in GitHub Desktop.
Save brockmanmatt/1ff604b2b777f46a6c658895d75e94b5 to your computer and use it in GitHub Desktop.
PullSelectNewsArticles
mySources = ["nytimes.com", "washingtonpost.com", "foxnews.com", "cnn.com"]
df = pd.DataFrame()
k = os.listdir("data")
for i in k:
print(i)
if i.endswith(".pkl"):
tmp = pd.read_pickle("data/"+i)
tmp = tmp[tmp["SOURCES"].apply(lambda x: x in mySources)]
df = pd.concat([df, tmp])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment