You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As of version 1.1.5 (and earlier), the code snippet above yielded pd.Series([0]) (i.e. the replacement took place). As of version 1.2.0 (and later), the code snippet above yields pd.Series([1]) (i.e. the replacement does not take place). In both versions, the replacement takes place if we pass either an integer array (np.array([1])) or a list ([1.]) to replace instead of a float array (np.array([1.])). Is this change in behavior intentional?
lbittarello
changed the title
BUG: Change in behavior ofreplace with integer series and float to_replace
BUG: Change in behavior of replace with integer series and float to_replace
Mar 11, 2021
best guess is we need to either patch can_hold_element for integer dtype so it can tell that 1.0 may be present, or early-on coerce the np.array([1.0]) to np.array([1])
Code Sample, a copy-pastable example
Problem description
As of version 1.1.5 (and earlier), the code snippet above yielded
pd.Series([0])
(i.e. the replacement took place). As of version 1.2.0 (and later), the code snippet above yieldspd.Series([1])
(i.e. the replacement does not take place). In both versions, the replacement takes place if we pass either an integer array (np.array([1])
) or a list ([1.]
) toreplace
instead of a float array (np.array([1.])
). Is this change in behavior intentional?Output of
pd.show_versions()
The text was updated successfully, but these errors were encountered: