Python Forum

Full Version: Cmparing columns in dataframe
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
hi,
I have two dataframes df1 & df2. Both df1 & df2 have same index. I want to compare 2nd column of df1 with 3rd column of df2 and if it is equal or greater or lesser and then perform certain set of mathematical operations on other two columns one each in df1 & df2 and then store the results obtained in df3. df3 will also have the same index. how do i go about it. is it possible to make such comparison and calculations.

I tired np.where, however i am not aware how do i make a bigger calculations if the result is true and then store the result in another dataframe.

Thanks in advance
Rejoice