Open akre54 opened 4 years ago
Hi there - is there an equivalent to https://pandas.pydata.org/docs/reference/api/pandas.melt.html for pivoting columns?
My csv looks like this:
id,name,type,2000-01-31,2000-02-29,2000-03-31,2000-04-30 102001,demo,test,70759,70760,70767,70815
I'd like the resulting dataframe to look like:
[ {id: 102001, name: 'demo', type: 'test', date: '2000-01-31', value: 70759}, {id: 102001, name: 'demo', type: 'test', date: '2000-02-29', value: 70760}, {id: 102001, name: 'demo', type: 'test', date: '2000-03-31', value: 70767}, {id: 102001, name: 'demo', type: 'test', date: '2000-04-30', value: 70815} ]
In pandas I'd write that as:
pd.melt(trends, id_vars =['id','name','type'], var_name='date', value_name='value' )
Not sure how active this project is, but hopefully this helps someone
Hi there - is there an equivalent to https://pandas.pydata.org/docs/reference/api/pandas.melt.html for pivoting columns?
My csv looks like this:
I'd like the resulting dataframe to look like:
In pandas I'd write that as:
Not sure how active this project is, but hopefully this helps someone