想要得到下面解释的结果,但没有得到所需的结果. 已try .Update但失败.last_row应放在其列的空白行中.
给出:>
import pandas as pd
d1 = {
'a': [10],
'b': [20],
'c': [30],
'q': "",
'w': "",
'e': ""
}
df1 = pd.DataFrame(d1)
print(df1)
d2 = {
'q': [7,40],
'w': [8,50],
'e': [9,60]
}
df2 = pd.DataFrame(d2)
print(df2)
last_row = df2.tail(1)
print(last_row)
预期结果:>
result = {
'a': [10],
'b': [20],
'c': [30],
'q': [40],
'w': [50],
'e': [60]
}
df_result = pd.DataFrame(result)
print(df_result)