Skip to content

Instantly share code, notes, and snippets.

@cj2001
Created February 9, 2021 23:53
Show Gist options
  • Save cj2001/869fd9b28a0b8e08e967acf0f0034255 to your computer and use it in GitHub Desktop.
Save cj2001/869fd9b28a0b8e08e967acf0f0034255 to your computer and use it in GitHub Desktop.
Add category and author nodes
categories = pd.DataFrame(df[['category_list']])
categories.rename(columns={'category_list':'category'},
inplace=True)
categories = categories.explode('category') \
.drop_duplicates(subset=['category'])
authors = pd.DataFrame(df[['cleaned_authors_list']])
authors.rename(columns={'cleaned_authors_list':'author'},
inplace=True)
authors=authors.explode('author').drop_duplicates(subset=['author'])
add_categories(categories)
add_authors(authors)
add_papers(df)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment