Python: Divide each row of a DataFrame by another DataFrame vector

前端 未结 5 2082
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-08 20:26

I have a DataFrame (df1) with a dimension 2000 rows x 500 columns (excluding the index) for which I want to divide each row by another DataFrame (df2) with dime

5条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-08 21:03

    to divide a row (with single or multiple columns), we need to do the below:

    df.loc['index_value'] = df.loc['index_value'].div(10000)
    

提交回复
热议问题