Conversation

python q: i may be idiot but in my data ppl entered manual numbers to a q. some of the numbers are obviously dumb. Id like to delete all dumb numbers, so any number outside of a specified range, just wanna make NaNs. all google things i try do not work. column is float64.
28
66
This Tweet was deleted by the Tweet author. Learn more
This Tweet was deleted by the Tweet author. Learn more
Replying to
Try df.loc[(df['mycol'] >= 0) & (df['mycol'] <= 10), 'mycol'] = np.nan This is different because & (a bitwise operator) operates on each value rather than the two columns you generate from doing the two comparisons
1
10