所以我有两个df,一个是历史数据的时间序列(df1),另一个是最近一年的数据(df2)
so for example
df(1):
Date DebtGDP Credit Expenditure
2020 0.053078 0.501184 757.000000
2021 0.935433 0.050437 229.000000
2022 NaN NaN NaN
2023 NaN NaN NaN
df(2):
Date DebtGDP Credit Expenditure
2022 0.056078 0.401184 757.000000
2023 0.605842 0.661184 900.000000
I want df1 to read from df2 and update the recent ones
所需输出:
df(1) would be:
Date DebtGDP Credit Expenditure
2020 0.053078 0.501184 757.000000
2021 0.935433 0.050437 229.000000
2022 0.056078 0.401184 757.000000
2023 0.605842 0.661184 900.000000
1条答案
按热度按时间lsmepo6l1#
可以使用
merge
和combine_first
:或者:
输出: