I have prepared an example:
from datetime import datetime, timedelta
import pandas as pd
now= datetime.now()
time1= pd.Timestamp(now.year, now.month, now.day)- timedelta(days=1)
time2= pd.Timestamp(now.year, now.month, now.day)- timedelta(days=2)
data1= {time1:1}
data2= {time2:2}
series1 =pd.Series(data1)
series2 =pd.Series(data2)
print(series1)
print(series2)
merged= pd.DataFrame()
merged= pd.concat(series1,series2)
print(merged)
I have two pandas series, series1&2 and I want to merge them into one single pandas dataframe despite having different keys (dates). So the final dataframe simply has 2 columns with the name of the series and one row below holding the data ie 1 and 2.
I have tried to concat the two series but can't since the keys are different.
Desired columns:
column1, column2
Desired data beneath columns:
1,2
ie the key(date) is completely removed and we have a dataframe with defined column names with only the data from the two pandas series