Skip to content

BUG: to_datetime with Index arg does not retain name in all cases #21697

Closed
@mroeschke

Description

@mroeschke
#Example

In [17]: idx = pd.Index([15e9], name='name')

In [18]: pd.to_datetime(idx, errors='ignore', box=True, unit='s').name

In [19]: pd.__version__
Out[19]: '0.24.0.dev0+193.gdc45fba'

There are certain cases where the name attribute of the passed Index are not retained after to_datetime.

The name kwarg looks to be missing from these locations:

return Index(result)

return Index(tz_results)

return Index(result)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions