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

Error datetime convert #4657

Closed
deatheyes opened this issue Mar 21, 2018 · 3 comments
Closed

Error datetime convert #4657

deatheyes opened this issue Mar 21, 2018 · 3 comments

Comments

@deatheyes
Copy link
Contributor

this line results wrong date time:
https://github.com/apache/incubator-superset/blob/fc47729233e7ce44e225edbeb628f6a5f0376eda/superset/viz.py#L158

the proper way is:
pd.to_datetime(df[DTTM_ALIAS], utc=False, unit="s") and df[DTTM_ALIAS] = pd.to_datatime(df[DTTM_ALIAS], utc=False, unit="ms")

@xrmx
Copy link
Contributor

xrmx commented Mar 21, 2018

Care to open a PR with a bit of explanation why the current code is wrong please?

Eternal gratitude if you add tests catching the issue :)

@deatheyes
Copy link
Contributor Author

deatheyes commented Mar 22, 2018

@xrmx this is my test case and output:
pd.to_datetime(1521475500, utc=False)
Timestamp('1970-01-01 00:00:01.521475500')

pd.to_datetime(1521475500, utc=False, unit="s")
Timestamp('2018-03-19 16:05:00')

pandas: 0.22.0

@mistercrunch
Copy link
Member

Please open a PR with the proposed changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants