-3

there is a column in my data set that I should convert its elements to another unit(e.g. bit to byte), and there is some missing values(e.g. " ") that I should change all of them to "np.nan". I can do that separately and using something like a 'for' loop, but I believe there is a better way. any help please.

1 Answers1

0

Try something like this:

data['column'] = np.where(data['column'] == ' ', np.nan, data['column'])
Gedas Miksenas
  • 959
  • 7
  • 15