Python Forum

Full Version: How to combine timeseries data under one column?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have two columns A and B that consists of the same timestamps with different data, it is like 2 sensors collecting data at the same time. These two columns are in one dataframe. But now I want to have these 2 columns merged under one bigger column say C. How can I do this correctly? I have tried many ways but no luck in getting the desired output. What I have tried so far is using the below code but it is actually creating a new data frame which is not what I need.

data = pd.DataFrame({'a': df.loc[9]['b'],'b':df.loc[9]['c']}

i used .loc[9] just to see how it will be merged for one observation.

any advice will be much appreciated.
It would be easier to understand, if you could also show some part of your current dataframe, and then what would be your desired output out of that.