Profile picture

Create Dataframes

Last updated: December 5th, 20192019-12-05Project preview
In [1]:
# Import pandas library 
import pandas as pd
In [7]:
# A list of lists 
data = [['tom', 10], ['nick', 15], ['juli', 14]] 
  
# Create the pandas DataFrame 
df = pd.DataFrame(data, columns = ['Name', 'Age']) 

df
Out[7]:
Name Age
0 tom 10
1 nick 15
2 juli 14
In [6]:
# A list of dictionaries
data = [{'a': 1, 'b': 2, 'c':3}, {'a':10, 'b': 20, 'c': 30}] 
  
# Create the pandas DataFrame 
df = pd.DataFrame(data) 

df
Out[6]:
a b c
0 1 2 3
1 10 20 30
Notebooks AI
Notebooks AI Profile20060