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 unit mapping ignores utc and box arguments #23760

mroeschke opened this issue Nov 18, 2018 · 2 comments


3 participants
Copy link

commented Nov 18, 2018

In [12]: pd.__version__
Out[12]: '0.24.0.dev0+1040.g24bce1a5f'

In [13]: df = pd.DataFrame({'year': [2015, 2016],
    ...:                        'month': [2, 3],
    ...:                        'day': [4, 5]})

In [14]: pd.to_datetime(df, box=False)
0   2015-02-04
1   2016-03-05
dtype: datetime64[ns]

In [15]: pd.to_datetime(df, utc=True)
0   2015-02-04
1   2016-03-05
dtype: datetime64[ns]

These arguments need to be handled directly in this function or the output

result = _assemble_from_unit_mappings(arg, errors=errors)

Expected Output

In [16]: pd.to_datetime(df, box=False).values
array(['2015-02-04T00:00:00.000000000', '2016-03-05T00:00:00.000000000'],

In [17]: pd.to_datetime(df, utc=True).dt.tz_localize('UTC')
0   2015-02-04 00:00:00+00:00
1   2016-03-05 00:00:00+00:00
dtype: datetime64[ns, UTC]

This comment has been minimized.

Copy link

commented Nov 20, 2018


Can my team and I contribute to this issue?



This comment has been minimized.

Copy link
Member Author

commented Nov 20, 2018

Sure, go for it @evangelineliu

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.