* t1
datetime.datetime(2022, 9, 28, 19, 54, 50, 670360)
None
* t2
datetime.datetime(2022, 9, 29, 2, 54, 50, 671375, tzinfo=datetime.timezone.utc)
0:00:00
* t3
datetime.datetime(2022, 9, 28, 18, 54, 50, 671375, tzinfo=datetime.timezone(datetime.timedelta(days=-1, seconds=61200)))
-1 day, 17:00:00
* x.dtypes
t1 datetime64[ns]
t2 datetime64[ns, UTC]
t3 datetime64[ns, UTC-07:00]
dtype: object
Traceback (most recent call last):
File "C:\tmp\tz.py", line 18, in <module>
sbdf.export_data(x, "C:/tmp/tz.sbdf")
File "C:\src\spotfire-python\spotfire\sbdf.py", line 169, in export_data
columns, column_names, column_types, table_metadata, column_metadata = _export_columnize_data(obj,
File "C:\src\spotfire-python\spotfire\sbdf.py", line 220, in _export_columnize_data
column_types = {str(k): _ValueTypeId.infer_from_dtype(v, f"column '{str(k)}'") for (k, v) in obj.items()}
File "C:\src\spotfire-python\spotfire\sbdf.py", line 220, in <dictcomp>
column_types = {str(k): _ValueTypeId.infer_from_dtype(v, f"column '{str(k)}'") for (k, v) in obj.items()}
File "C:\src\spotfire-python\spotfire\sbdf.py", line 1082, in infer_from_dtype
raise SBDFError(f"unknown dtype '{dtype}' in {series_description}")
spotfire.sbdf.SBDFError: unknown dtype 'datetime64[ns, UTC]' in column 't2'
(The t3 column also results in an SBDFError: spotfire.sbdf.SBDFError: unknown dtype 'datetime64[ns, UTC-07:00]' in column 't3'.)
Exporting timezone-aware datetime objects should result in timezone-unaware data being exported (since the SBDF format does not have the capacity to encode timezone information).
Running the following script results in an exception:
(The
t3
column also results in anSBDFError
:spotfire.sbdf.SBDFError: unknown dtype 'datetime64[ns, UTC-07:00]' in column 't3'
.)Exporting timezone-aware
datetime
objects should result in timezone-unaware data being exported (since the SBDF format does not have the capacity to encode timezone information).