I have a dictionary created run-time in my program which needs to be converted to a pandas dataframe.
dictio={'a':'abc','b':'zyx','c':'prq'} df=pd.Dataframe(dictio)
The above code returns me an empty dataframe with columns created. Can anyone point to what am i missing out?
#use from_dict and set orient to index and then transpose in the end.
pd.DataFrame.from_dict(dictio,orient='index').T
Out[263]:
a c b
0 abc prq zyx
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.