jeudi 11 novembre 2021

Lambda Function With "isinstance"

I've been trying to round a vector of a DataFrame using lambda function. In my vector I also have string values, so I tried this code

dff.apply(lambda x: round(x, 2) if (isinstance(x,float)))

It marks me a syntax error, but I don´t know how to solve it

Aucun commentaire:

Enregistrer un commentaire