Here is how to create a pandas DataFrame from a dictionary in Python.

import pandas

# Create a sample dictionary of str:list
mydata = {'Celsius':[10, 20, 30], 
    'Fahr':[4, 5, 6], 'Kelvin':[7,8,9]} 
# Create dataframe from the dictionary
df = pandas.DataFrame(mydata) 
# Print out the dataframe


   Celsius  Fahr  Kelvin

0       10     4       7

1       20     5       8

2       30     6       9


Since the structure of a pandas dataframe is similar to that of a Python dictionary, it is enough to provide the dictionary as an argument to the DataFrame class and we end up with a dataframe object. Notice that the dictionary keys are transformed into dataframe columns names. 

Related HowTos
Schedule a Python script for execution at a specific time every day
Store Python passwords securely on Windows, Mac, and Linux
Do dictionary comprehension
Do list comprehension
Create a virtual environment
Create a new file
Merge two lists
Extract items from two different lists into one list
Check if a text file is empty
Randomly select an item from a list
Generate a random integer
Break a while loop
Create a pandas DataFrame from a list
Get the last item of a list
Delete a column from a pandas dataframe
Access a column of a pandas dataframe
Create a class
Make a webpage request
Get the first two characters of a string
Recommended Course

Learn Flask development and learn to build cool apps with our premium Python course on Udemy.

Mailing List

We will keep you Python-motivated if you subscribe below.