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)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With