SaltySenator
SaltySenator

Reputation: 63

How can I reshape my wide data into a time series/long format?

See the following data snippet:

enter image description here

The column from the right is a data variable ranging from August 2001 to August '97 What I would like to do is merge all these columns together into one 'Date' column. For further context, the columns are of equal length.

Upvotes: 0

Views: 41

Answers (1)

SophieOH
SophieOH

Reputation: 178

If all you need is the dates, how much was purchased and the id of the material you could drop the columns that aren't dates (i.e. Del. time- Total) and transpose your dataset.

In pandas

dataframe = dataframe.T

Upvotes: 1

Related Questions