Skip to content

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

Closed
@Dr-Irv

Description

@Dr-Irv

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.

Metadata

Metadata

Assignees

Labels

DocsIndexRelated to the Index class or subclasses

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions