-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
DOC: fix closed and dtype arguments of TimedeltaIndex #50660
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
||
.. warning:: | ||
|
||
A future version of pandas will change dtype to be an instance |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not familiar with that are of the code. Is this already enforced?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, dtype is enforced to be 'timedelta64[ns]' inside the constructor TimedeltaArray._from_sequence_not_strict
, which is called inside TimedeltaIndex constructor. The definition of TimedeltaArray._from_sequence_not_strict
is here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the warning is no longer necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know, since the instantiated class TimedeltaArray reports that warning, I've copied it. Do I remove it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you show an example? Code-example
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sorry, would you mind clarifying which code example?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That shows the warning you are describing here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I got the question. The TimedeltaArray
docstring reports this warning (see here https://pandas.pydata.org/docs/dev/reference/api/pandas.arrays.TimedeltaArray.html) and also the TimedeltaArray.dtype
property docstring report a similar warning https://github.com/pandas-dev/pandas/blob/main/pandas/core/arrays/timedeltas.py#L160.
This is the function that validate the dtype of TimedeltaArray
https://github.com/pandas-dev/pandas/blob/main/pandas/core/arrays/timedeltas.py#L1029
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@phofl
is there something that I can do to get it merged? thank you
This pull request is stale because it has been open for thirty days with no activity. Please update and respond to this comment if you're still interested in working on this. |
Thanks @abonte for the PR. closing as stale but please comment if you want to continue and will re-open. |
Tests added and passed if fixing a bug or adding a new featureAdded type annotations to new arguments/methods/functions.Added an entry in the latestdoc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.closed: removed unused argument (xref DOC: add closed and dtype in TimedeltaIndex parameters #49167). It was already deprecated in version 0.24.0. (See https://github.com/TomAugspurger/pandas/blob/4d0fce26a87f7c6d74b77743fbcf96dd9c3cc338/pandas/core/indexes/timedeltas.py#L82)
dtype: add dtype parameter in docstring and add warning as indicated in TimedeltaArray, since the argument is used to construct a TimedeltaArray.