I have a pandas df where df['value'] is a series of floats.
- Some of the floats will be whole numbers (like 25.0). I want to create a new column,
df['is_it_whole'][i]with values1(orTrue) is the correspondingdf['value'][i]is a whole number,0orFalseotherwise. - I know I can do a for loop, but I am wondering if there is any trick I can use to do it fast (I have a large df).
- I tried using
df['is_it_whole'] = df['value'].is_integer()but pandas series do not support theis_integermethod, I am looking for something similar that would work.
Suggestions?