pandas icon indicating copy to clipboard operation
pandas copied to clipboard

REGR: Fix regression RecursionError when replacing numeric scalar with None

Open phofl opened this issue 3 years ago • 1 comments

  • [x] closes #48231 (Replace xxxx with the Github issue number)
  • [x] Tests added and passed if fixing a bug or adding a new feature
  • [x] All code checks passed.
  • [x] Added type annotations to new arguments/methods/functions.
  • [x] Added an entry in the latest doc/source/whatsnew/vX.X.X.rst file if fixing a bug or adding a new feature.

If value is None, self.coerce_to_target_dtype returns float64 if self is Numeric. But: self._can_hold_element(value) is False, since NumPy can not set None into a numeric array.

This should probably be consistent...

phofl avatar Aug 24 '22 20:08 phofl

blocking for the short term

we have #48034 on the 1.4.x milestone. knowing that the backport of replace changes was not trivial last time due to changes on main, lets not make any other changes till that issue has been investigated.

looking at #48034, it appears that that issue is moreless orthogonal to this issue, so perhaps no reason to block.

simonjayhawkins avatar Aug 26 '22 13:08 simonjayhawkins

LGTM (IMO I think the 1.4.x behavior is more reasonable than the RecurssionError behavior). cc @simonjayhawkins not sure if you still have any objections with moving forward with this behavior in 1.5.x

mroeschke avatar Oct 17 '22 22:10 mroeschke

Could you merge main once more? I tried restarting the (seemingly) unrelated test failures but they are still failing.

mroeschke avatar Oct 24 '22 21:10 mroeschke

Yeah restarted as well earlier. Merged main now

phofl avatar Oct 24 '22 21:10 phofl

Thanks @phofl. Maybe please create an issue regarding using replace to replace NA-like values with NA-like values if we don't have one

mroeschke avatar Oct 31 '22 17:10 mroeschke

Opened #49421

phofl avatar Oct 31 '22 18:10 phofl