I have data values like this :
data = {'widgets' : [23,12,11,14], 'kernel' : [12,11,11,90], 'cell': [12,11,11,11]}
I am trying to convert these values in dataframe like this :
Where key in dict will be column values in DataFrame.
What I've tried so far :
dataframe = {'src': [], 'tar': []}
for key,value in data.items():
temp_data = [key for k in range(len(value))]
dataframe['src'].extend(temp_data)
dataframe['tar'].extend(value)
pd.DataFrame(dataframe)
It's not an elegant way to do this, How to do in pure pandas way?