Skip to content

Instantly share code, notes, and snippets.

@emmagrimaldi
Last active September 27, 2018 14:39
Show Gist options
  • Select an option

  • Save emmagrimaldi/8403c0aa24d05977c0e8c8fdc31874be to your computer and use it in GitHub Desktop.

Select an option

Save emmagrimaldi/8403c0aa24d05977c0e8c8fdc31874be to your computer and use it in GitHub Desktop.
# the range of the iteration starts from 2 because the first 2
# elements are not posts but instructions related to the page
shower_thoughts_list = [shower_thoughts[i]['data']['title'] + ' ' +
shower_thoughts[i]['data']['selftext']
for i in range(2,len(shower_thoughts))]
# creating the dataframe from the list
st_df = pd.DataFrame(shower_thoughts_list, columns=['post'])
# adding the subreddit column
st_df['subreddit'] = 'shower_thoughts'
# checking
st_df.head()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment