Skip to content

DOC: DatetimeIndex says that data is optional, but it is not #48097

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
1 task done
Dr-Irv opened this issue Aug 15, 2022 · 1 comment · Fixed by #48118
Closed
1 task done

DOC: DatetimeIndex says that data is optional, but it is not #48097

Dr-Irv opened this issue Aug 15, 2022 · 1 comment · Fixed by #48118
Assignees
Labels
Docs Index Related to the Index class or subclasses

Comments

@Dr-Irv
Copy link
Contributor

Dr-Irv commented Aug 15, 2022

Pandas version checks

  • I have checked that the issue still exists on the latest versions of the docs on main here

Location of the documentation

https://pandas.pydata.org/docs/dev/reference/api/pandas.DatetimeIndex.html

Documentation problem

Docs for DatetimeIndex say:

data: array-like (1-dimensional), optional
Optional datetime-like data to construct index with.

But data isn't optional:

pd.DatetimeIndex()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<omitted>\site-packages\pandas\core\indexes\datetimes.py", line 321, in __new__
    raise cls._scalar_data_error(data)
TypeError: DatetimeIndex(...) must be called with a collection of some kind, None was passed

Suggested fix for documentation

The word "optional" should be removed from that place in the documentation.

@Dr-Irv Dr-Irv added Docs Needs Triage Issue that has not been reviewed by a pandas team member Index Related to the Index class or subclasses labels Aug 15, 2022
@nealxm
Copy link
Contributor

nealxm commented Aug 17, 2022

take

@mroeschke mroeschke removed the Needs Triage Issue that has not been reviewed by a pandas team member label Aug 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Docs Index Related to the Index class or subclasses
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants