I have 2 dataframes with different timestamps and different lengths.
First Dataframe,df
, has 1054 rows and looks like this:
Second Dataframe,df_temp
, has 2629 rows and looks like this:
I have no clue where to begin. The time stamp is almost close and I know how to merge dataframes with similar index but not this one. Any help would be appreciated. Thank you!
df_merged=pd.concat([df,df_temp]).sort_index()
I tried this before as well. When I add these together the index is kind of sorted but it gives me NaN values for where the data is missing.
CodePudding user response:
Can you try this ?
pd.concat([df,df_temp]).sort_index()
or
pd.concat([df,df_temp.rename(columns=dict(zip(df_temp.columns,df.columns)))]).sort_index()