In df.divide(df2, axis='index')
, you need to provide the axis/row of df2 (ex. df2.iloc[0]
).
import pandas as pd
data1 = {"a":[1.,3.,5.,2.],
"b":[4.,8.,3.,7.],
"c":[5.,45.,67.,34]}
data2 = {"a":[4.],
"b":[2.],
"c":[11.]}
df1 = pd.DataFrame(data1)
df2 = pd.DataFrame(data2)
df1.div(df2.iloc[0], axis='columns')
or you can use df1/df2.values[0,:]
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…