Skip to content
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

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

Closed
mroeschke opened this issue Jul 1, 2018 · 2 comments · Fixed by #22918
Closed

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

mroeschke opened this issue Jul 1, 2018 · 2 comments · Fixed by #22918
Labels

Comments

@mroeschke
Copy link
Member

#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)

@uds5501
Copy link
Contributor

uds5501 commented Jul 2, 2018

@mroeschke Sir, for adding kwargs, will the following work?

return Index(result ,  {"name": name})

@mroeschke
Copy link
Member Author

Just simply, Index(..., name=name)

uds5501 added a commit to uds5501/pandas that referenced this issue Jul 3, 2018
uds5501 added a commit to uds5501/pandas that referenced this issue Jul 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants