python 2.7 - Obtaining a pandas dataframe from a dict with tuples as keys -
i new python , have been struggling problem quite while. have dict this:
dict1 = {(a,a) : 5, (a,b) :10, (a,c) : 11, (b,a): 4, (b,b) : 8, (b,c) : 3....}
what convert pandas dataframe looks this:
b c 5 10 11 b 4 8 3 c .. .. ..
after create multiple bar plot in jupyter notebook. know can display data pandas series show following:
dataset = pd.series(dict1) print dataset 5 b 10 c 11 b 4 b 8 c 3 c .. b .. c ..
however, not able create multiple bar plot that.
you're there, need unstack:
dataset.unstack()
i prefer use page reference, rather official documentation.
Comments
Post a Comment