Skip to content

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

Closed
wants to merge 2 commits into from

Conversation

abonte
Copy link
Contributor

@abonte abonte commented Jan 10, 2023

  1. 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)

  2. dtype: add dtype parameter in docstring and add warning as indicated in TimedeltaArray, since the argument is used to construct a TimedeltaArray.


.. warning::

A future version of pandas will change dtype to be an instance
Copy link
Member

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?

Copy link
Contributor Author

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

Copy link
Member

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?

Copy link
Contributor Author

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?

Copy link
Member

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

Copy link
Contributor Author

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?

Copy link
Member

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

Copy link
Contributor Author

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

Copy link
Contributor Author

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

@github-actions
Copy link
Contributor

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.

@github-actions github-actions bot added the Stale label Feb 11, 2023
@simonjayhawkins
Copy link
Member

Thanks @abonte for the PR. closing as stale but please comment if you want to continue and will re-open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DOC: closed and dtype missing from TimedeltaIndex docs
3 participants