1
I have two dfs:
1 - Quotation of a share of the month of January-2020 (23 lines)
2 - Quotation of a share of the month of January-2021 (23 lines)
I need to put all this together in a single date table, that is, the date of 2020 can be 2021 or vice versa, as long as they stay on the same line as if they were on the same date. When I merge or reindex, because they are different dates it returns null values for one of the columns.
df_sp1 = DataReader('^GSPC', data_source='yahoo', start='2020-1-1', end="2020-02-04")
df_sp2 = DataReader('^GSPC', data_source='yahoo', start='2021-1-1')
df_sp2["2020"] = df_sp1["Adj Close"]
df_sp2
Thank you.
Welcome to the stackoverflow community. Could post the code?
– Danizavtz
I edited the code. This was one of several attempts, the added column gets null values, because the dates (index) are different.
– Jessé Felício
Jesse, please state which exit
df_sp2
and what the output would you like to see– RFL