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] Datetime to string conversion shouldn't convert sub-second and hours, mins & seconds data if none exists #14152

Closed
galipremsagar opened this issue Sep 21, 2023 · 0 comments
Assignees
Labels
bug Something isn't working Python Affects Python cuDF API.

Comments

@galipremsagar
Copy link
Contributor

Describe the bug
When a DatetimeColumn is converted to StringColumn, we seem to be converting the entire sub-second & H:M:S data without checking if there is any data for those units. Pandas doesn't generate the data if these values are 0's. We should be matching the behavior atleast in pandas-compatibility mode, because this can only be achieved with some amount of overhead.

Steps/Code to reproduce bug

In [34]: import pandas as pd

In [35]: s = pd.Series(['2000-01-01 00:00:00.000000000'], dtype='datetime64[ns]')

In [36]: s
Out[36]: 
0   2000-01-01
dtype: datetime64[ns]

In [37]: s.astype("str")
Out[37]: 
0    2000-01-01
dtype: object

In [38]: gs = cudf.from_pandas(s)

In [39]: gs
Out[39]: 
0   2000-01-01
dtype: datetime64[ns]

In [40]: gs.astype('str')
Out[40]: 
0    2000-01-01 00:00:00.000000000
dtype: object

Expected behavior

In [37]: gs.astype("str")
Out[37]: 
0    2000-01-01
dtype: object

Environment overview (please complete the following information)

  • Environment location: [Bare-metal]
  • Method of cuDF install: [from source]
@galipremsagar galipremsagar added bug Something isn't working Python Affects Python cuDF API. labels Sep 21, 2023
@galipremsagar galipremsagar self-assigned this Sep 21, 2023
@galipremsagar galipremsagar changed the title [BUG] Datetime to string conversion doesn't match pandas [BUG] Datetime to string conversions doesn't match pandas Sep 21, 2023
@galipremsagar galipremsagar changed the title [BUG] Datetime to string conversions doesn't match pandas [BUG] Datetime to string conversion shouldn't convert sub-second and hours, mins & seconds data if none exists Sep 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Python Affects Python cuDF API.
Projects
Archived in project
Development

No branches or pull requests

1 participant