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
We cast the iterable to an Index, which will cast None to NaN and thus the fixtures won't match anymore. I think it makes sense here to keep object if idx is also object dtype?
I would expect we coerce the list to an Index with the dtype of the calling index, but so that is not the case?
At least for object dtype we should do that, I think. Also without the string inference, you can already run into "issues" with this in case of mixed objects:
In [34]: idx = pd.Index(["a", 0.2, None], dtype="object")
In [35]: idx.get_indexer([0.2, None])
Out[35]: array([ 1, -1])
I think it makes sense here to keep object if idx is also object dtype?
In most cases in get_indexer we end up casting self/target to a common dtype, which would be object in this case anyway. So avoiding the inference step wouldn't be so bad. The caveats that come to mind are 1) _maybe_downcast_for_indexing can downcast in some cases, 2) i think Categorical has some special handling, 3) in a perfect world we'd avoid that upcasting altogether
Pandas version checks
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
Issue Description
We cast the iterable to an Index, which will cast None to NaN and thus the fixtures won't match anymore. I think it makes sense here to keep object if idx is also object dtype?
cc @jbrockmendel @jorisvandenbossche
Expected Behavior
See above
Installed Versions
Replace this line with the output of pd.show_versions()
The text was updated successfully, but these errors were encountered: