mardi 23 janvier 2018

How to replace values in a column using for loop if conditions are met pandas

I'm having trouble changing values in a column using for loops if certain conditions are met.

Just a simple example, let's a we have a column of numbers, and I want to replace all numbers less than a 5 into some string like "Hello". How can I do this? I saw .iterrows() and and .set_value() but I'm not sure how to exactly code the for loop-if statement.

Aucun commentaire:

Enregistrer un commentaire