There's two dataframes, all the colnames are the same but the index is different. I've tried several ways but I've been getting NaN
. I'm guessing it is because it's trying to match the index but I am stuck.
I've tried:
df1.ix['Norm']-df2.ix['Norm']
df1 - df2.ix['Norm']
df1.astype(float) - df2.astype(float)
would like something like this
df1 - df2[df1.column.names]
When you don't want index-aligned arithmetic, get rid of the indexes. You can subtract the numpy arrays to the same effect:
(df1.values - df2[df1.column.names].values)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.