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

ENH: Allow support for dtype datetime64[ms] or other units or numpy.datetime64 cols. #37647

Closed
isichei opened this issue Nov 5, 2020 · 1 comment
Labels
Enhancement Needs Triage Issue that has not been reviewed by a pandas team member

Comments

@isichei
Copy link

isichei commented Nov 5, 2020

Is your feature request related to a problem?

I would like to be able to use Pandas datetime datatype column for datetimes beyond the bounds for ns units (which are 1677-09-21 00:12:43.145225 and 2262-04-11 23:47:16.854775807).

As will often be dealing with dates above and below these thresholds. Apologies if already open on another issue but couldn't quite find this. Not sure if tied in with this issue

Describe the solution you'd like

df = pd.DataFrame({"col": ["2020-01-01", "2999-01-01", "1990-01-01", None]})

One of the following:

import pandas as pd

df = pd.DataFrame({"col": ["2020-01-01", "2999-01-01", "1990-01-01", None]})
df.col = pd.to_datetime(df.col, base_unit="ms")
df.col.dtype # datetime64[ms]

or

import pandas as pd
import numpy as np

df = pd.DataFrame()
df["col"] = np.array(["2020-01-01", "2999-01-01", "1990-01-01", None], dtype='datetime64[ms]')
df.col.dtype # datetime64[ms]

API breaking implications

Not sure, I assume this might be a big ask depending on how the column casting internals work.

Describe alternatives you've considered

At the moment the only workaround is having an object column with datetimes. However I believe this stops you from using the .dt method on the column which is really handy.

@isichei isichei added Enhancement Needs Triage Issue that has not been reviewed by a pandas team member labels Nov 5, 2020
@mroeschke
Copy link
Member

Thanks. This falls into the same core request in #7307, so going to close of a duplicate of that request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Needs Triage Issue that has not been reviewed by a pandas team member
Projects
None yet
Development

No branches or pull requests

2 participants