[BUG] examples/tutorial/01-preprocess.ipynb: Convert timestamp from datetime - NotImplementedError: cuDF does not yet support timezone-aware datetimes #777
File ~/miniconda3/lib/python3.10/site-packages/cudf/core/column/string.py:5749, in StringColumn.as_datetime_column(self, dtype, format)
5742 return cast(
5743 "cudf.core.column.DatetimeColumn",
5744 column.column_empty(
5745 len(self), dtype=out_dtype, masked=True
5746 ),
5747 )
5748 else:
-> 5749 format = datetime.infer_format(
5750 self.apply_boolean_mask(self.notnull()).element_indexing(0)
5751 )
5753 if format.endswith("%z"):
5754 raise NotImplementedError(
5755 "cuDF does not yet support timezone-aware datetimes"
5756 )
File ~/miniconda3/lib/python3.10/site-packages/cudf/core/column/datetime.py:108, in infer_format(element, **kwargs)
106 if fmt is not None:
107 if "%z" in fmt or "%Z" in fmt:
--> 108 raise NotImplementedError(
109 "cuDF does not yet support timezone-aware datetimes"
110 )
111 if ".%f" not in fmt:
112 # For context read:
113 # https://github.com/pandas-dev/pandas/issues/52418
114 # We cannot rely on format containing only %f
115 # c++/libcudf expects .%3f, .%6f, .%9f
116 # Logic below handles those cases well.
117 return fmt
NotImplementedError: cuDF does not yet support timezone-aware datetimes
Steps/Code to reproduce bug
just run the code raw_df['event_time'].astype('datetime64[s]')
Expected behavior
No error
Environment details
Platform: WSL2 + win 11
Python version: 3.10.14
cuDF version: '24.04.00'
nvtabular version: '23.08.00'
PyTorch version (GPU): '2.2.2+cu121'
Additional context
Problem solved by adding one line
## added one line
raw_df['event_time'] = cudf.to_datetime(raw_df['event_time'], format='%Y-%m-%d %H:%M:%S')
##
raw_df['event_time_dt'] = raw_df['event_time'].astype('datetime64[s]')
raw_df['event_time_ts']= raw_df['event_time_dt'].astype('int')
raw_df.head()
Bug description
Steps/Code to reproduce bug
raw_df['event_time'].astype('datetime64[s]')
Expected behavior
No error
Environment details
Additional context
Problem solved by adding one line