I am new here, ideally i would have commented this on the question from where i learned this usage of idxmax :
I used same approach and below is my code
df = pd.DataFrame(np.arange(16).reshape(4,4),columns=["A","B","C","D"],index=[0,1,2,3])
As soon as i use df[(df>6)]
on this df these int values change to float?
A B C D
0 NaN NaN NaN NaN
1 NaN NaN NaN 7.0
2 8.0 9.0 10.0 11.0
3 12.0 13.0 14.0 15.0
Why does pandas do that? Also, i read somewhere i could use dtype=object on series , but are there some other ways to avoid such thing?