Skip to content
Advertisement

Alternative to apply function in pandas

I would like to execute this simple transformation in a more efficient way.

JavaScript

Any ideas?

Advertisement

Answer

You can use pandas.Series.clip:

JavaScript

or numpy.clip:

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement