I have two identical sized dataframes (df1 & df2). I would like to create a new dataframe with values that are df1 column1 / df2 column1. So essentially df3 = df1(c1)/df2(c1), df1(c2)/df2(c2), df1(c3)/df2(c3)...
I've tried the below code, however both give a dataframe filled with NaN
#attempt 1
df3 = df2.divide(df1, axis='columns')
#attempt 2
df3= df2/df1
print(df1.shape, df2.shape)
? – Erfandf1.dtypes
anddf2.dtypes
. Do you getobject
? Orint
andfloat
? – Erfandf1 / df2
should just work, what do you get as output when you try that code? – Erfan