python - Add pandas Series to a DataFrame, preserving index -


i have been having problems adding contents of pandas series pandas dataframe. start empty dataframe, initialised several columns (corresponding consecutive dates).

i sequentially fill dataframe using different pandas series, each 1 corresponding different date. however, each series has (potentially) different index.

i resulting dataframe have index union of each of series indices.

i have been doing far:

for date in dates:      df[date] = series_for_date 

however, df index corresponds of first series , data in successive series correspond index 'key' not in first series lost.

any appreciated!

ben

if understand can use concat:

pd.concat([series1,series2,series3],axis=1) 

Comments

Popular posts from this blog

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - UML - How would you draw a try catch in a sequence diagram? -

c++ - No viable overloaded operator for references a map -