Skip to content

Instantly share code, notes, and snippets.

@yang-zhang
Created June 20, 2018 15:19
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 yang-zhang/633a4f8e20b2dd7dbe1ccffde7679a10 to your computer and use it in GitHub Desktop.
Save yang-zhang/633a4f8e20b2dd7dbe1ccffde7679a10 to your computer and use it in GitHub Desktop.
Convert a dictionary to pandas dataframe
dict_ = {'001.jpg': 'dog', '002.jpg': 'cat', }
df = pd.DataFrame.from_dict(dict_, orient='index').reset_index()
df.columns = ['image_name', 'tags']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment