Answers for "python pandas create dataframe from dictionary"

1

create pandas dataframe from dictionary

In [11]: pd.DataFrame(d.items())  # or list(d.items()) in python 3
Out[11]:
             0    1
0   2012-07-02  392
1   2012-07-06  392
2   2012-06-29  391
3   2012-06-28  391
...

In [12]: pd.DataFrame(d.items(), columns=['Date', 'DateValue'])
Out[12]:
          Date  DateValue
0   2012-07-02        392
1   2012-07-06        392
2   2012-06-29        391
Posted by: Guest on May-01-2021
0

convert pandas dataframe to dict with a column as key

df.set_index('columnName').T.to_dict()
Posted by: Guest on March-17-2021

Code answers related to "python pandas create dataframe from dictionary"

Python Answers by Framework

Browse Popular Code Answers by Language