I have a dataframe like bellow, and I want to append t
as a new row data to the d1
, but it failed ?
CodePudding user response:
You can add the row directly:
df1.loc['new_index'] = t
CodePudding user response:
Use:
df.append(df.iloc[1]/df.iloc[0], ignore_index=True)
Demonstration, df:
after appending: