Combina serie per data

Oct 06 2020

Le seguenti 2 serie di azioni in un unico file excel:

Può essere combinato utilizzando la data come indice?

Il risultato dovrebbe essere così:

Risposte

1 MayankPorwal Oct 05 2020 at 23:26

Hai bisogno di un semplice df.merge()qui:

df = pd.merge(df1, df2, left_index=True, right_index=True, how='outer')

O

df = df1.join(df2, how='outer')
1 DanielBittencourt Oct 05 2020 at 23:23

Sto provando questo:

df3 = pd.concat([df1, df2]).sort_values('Date').reset_index(drop=True)

o

df3 = df1.append(df2).sort_values('Date').reset_index(drop=True)