Python pandas replace by None actually replaces with previous value

This is because to_replace is a scalar and value is None. That behaviour is described in the documentation:

The method to use when for replacement, when to_replace is a scalar, list or tuple and value is None.

The default method is pad, if you take a look at the code. This probably happens because None is often used to express the absence of the parameter.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top