Subtract one dataframe from another excluding the first column Pandas

后端 未结 3 1633
说谎
说谎 2021-01-27 17:22

I have to dataframes with the same columns. My task should be to subtract the df_tot from df_nap without touching the first column (\'A\'). What is the easiest solution for it?<

3条回答
  •  星月不相逢
    2021-01-27 17:53

    you can also use join and iloc:

    df_tot.iloc[:,:1].join(df_tot.iloc[:,1:]-df_nap.iloc[:,1:])
    

    but this implies to have the same order of columns and 'wavelength' being the first one

提交回复
热议问题