I have a Pandas dataframe with values which should lie between, say, 11-100
. However, sometimes I'll have values between 1-10
, and this is because the person who was entering that row used a convention that the value in question should be multiplied by 10. So what I'd like to do is run a Pandas command which will fix those particular rows by multiplying their value by 10
.
I can reference the values in question by doing something like
my_dataframe[my_dataframe['column_name']<10]
and I could set them all to a particular value, like 50, like so
my_dataframe[my_dataframe['column_name']<10] = 50
but how do I set them to a value which is 10* the value of that particular row?
I think you can use:
my_dataframe[my_dataframe['column_name']<10] *= 10