I have a column that contains both valid numbers as well as NaN. I want to apply sign function on its values and keep the result in a new column.
When I use np.sign as follows, it fails saying: {TypeError} unorderable types for comparison.
df['new_column'] = np.sign(df['column'])
Note that I cannot replace NaN with 0 or something beforehand. In my case if it is a NaN, its sign should be NaN as well.