I have three pandas df one of them has been \'row\'-shifted and the first element is empty. When I concatenate the three df to obtain a single 3-column dataframe I get all NaN i
In [2]: index = pd.DatetimeIndex(['2010-12-31', '2011-01-01', '2011-01-02'])
In [3]: df1 = pd.DataFrame({'S':[True,False,False]}, index=index)
In [4]: df2 = pd.DataFrame({'P':['','On','On']}, index=index)
In [5]: df3 = pd.DataFrame({'C':['On','On','On']}, index=index)
If your DataFrames are defined as above, then pd.concat
with axis=1
should work:
In [7]: pd.concat([df1,df2,df3], axis=1)
Out[7]:
S P C
2010-12-31 True On
2011-01-01 False On On
2011-01-02 False On On
[3 rows x 3 columns]