Let's say I have the dataframe below:
my_df = pd.DataFrame({'A': [1, 2, 3]})
my_df
A
0 1
1 2
2 3
I want to add a column B with values X if the corresponding number in A is odd, otherwise Y. I would like to do it in this way if possible:
my_df['B'] = np.where(my_df['A'] IS ODD, 'X', 'Y')
I don't know how to check if the value is odd.