-
-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Open
Labels
DocsDtype ConversionsUnexpected or buggy dtype conversionsUnexpected or buggy dtype conversionsNeeds DiscussionRequires discussion from core team before further actionRequires discussion from core team before further action
Description
In #23167, I'm trying consistently infer the dtype of the underlying Series/Index while calling the constructor of the .str
-accessor. For testing this thoroughly, I wanted to build a parametrized fixture that returns an ndarray for all the dtypes that lib.infer_dtype
can infer. I based myself on the list in the docstring, but found the following:
- the docstring mentions
'complex'
as a possible outcome, but this does not work (instead returning'mixed'
)
>>> lib.infer_dtype([1+1j, 2+2j])
'mixed'
>>> lib.infer_dtype([np.complex128(1+1j)])
'mixed'
and I don't believe it's actually possible to achieve this, given the code.
- the docstring mentions
'timedelta64'
, but this similarly does not work (returning'timedelta'
; and can't be hit either, IMO)
>>> lib.infer_dtype([np.timedelta64(1, 'D')])
'timedelta'
- the docstring does not mention
'interval'
, but that is a possible outcome:
>>> lib.infer_dtype([pd.Interval(0, 1), pd.Interval(0, 2)])
'interval'
So it needs to be discussed if 'complex'
/'timedelta64'
should be added to the code or removed from the docstring, and vice versa for 'interval'
.
Metadata
Metadata
Assignees
Labels
DocsDtype ConversionsUnexpected or buggy dtype conversionsUnexpected or buggy dtype conversionsNeeds DiscussionRequires discussion from core team before further actionRequires discussion from core team before further action