unexpected behavior of pd.core.algorithms._ensure_data() #22160
Labels
Algos
Non-arithmetic algos: value_counts, factorize, sorting, isin, clip, shift, diff
Bug
Missing-data
np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate
Milestone
Examples
Example 1:
results in
array([False, True], dtype=bool)
Example 2:
results in
array([False, False], dtype=bool)
Expected Output
The results should be
[False, False]
for example 1 and[False, True]
for example 2.Problem description
The problem can be tracked down to this line: https://github.com/pandas-dev/pandas/blob/master/pandas/core/algorithms.py#L137
np.asarray(values)
tries to do smart things (like converting 42 to a string), it should be probably avoided by passingdtype=np.object
to it.Output of
pd.show_versions()
pandas 0.22.0
The text was updated successfully, but these errors were encountered: