Skip to content

Instantly share code, notes, and snippets.

@ivanvoid
Created November 9, 2021 02:39
Show Gist options
  • Save ivanvoid/e7447f295cc39090629839011c6fb22b to your computer and use it in GitHub Desktop.
Save ivanvoid/e7447f295cc39090629839011c6fb22b to your computer and use it in GitHub Desktop.
dict to dataframe
# transform data from dict to dataframe
import pandas as pd
from tqdm import tqdm
data = pd.DataFrame(columns=['category', 'name'])
for category in tqdm(all_categories):
names = category_lines[category]
for name in names:
frame = {'category':category, 'name':name}
data = data.append(frame, ignore_index=True)
data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment