Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Convert list of dictionaries to a pandas DataFrame

np.random.seed(0)
data = pd.DataFrame(
    np.random.choice(10, (3, 4)), columns=list('ABCD')).to_dict('r')

print(data)
[{'A': 5, 'B': 0, 'C': 3, 'D': 3},
 {'A': 7, 'B': 9, 'C': 3, 'D': 5},
 {'A': 2, 'B': 4, 'C': 7, 'D': 6}]
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Convert #list #dictionaries #pandas #DataFrame
ADD COMMENT
Topic
Name
3+3 =