You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/dargueta/.pyenv/versions/3.7.2/lib/python3.7/site-packages/pandas/core/generic.py", line 5691, in astype
**kwargs)
File "/Users/dargueta/.pyenv/versions/3.7.2/lib/python3.7/site-packages/pandas/core/internals/managers.py", line 531, in astype
return self.apply('astype', dtype=dtype, **kwargs)
File "/Users/dargueta/.pyenv/versions/3.7.2/lib/python3.7/site-packages/pandas/core/internals/managers.py", line 395, in apply
applied = getattr(b, f)(**kwargs)
File "/Users/dargueta/.pyenv/versions/3.7.2/lib/python3.7/site-packages/pandas/core/internals/blocks.py", line 534, in astype
**kwargs)
File "/Users/dargueta/.pyenv/versions/3.7.2/lib/python3.7/site-packages/pandas/core/internals/blocks.py", line 595, in _astype
dtype = pandas_dtype(dtype)
File "/Users/dargueta/.pyenv/versions/3.7.2/lib/python3.7/site-packages/pandas/core/dtypes/common.py", line 2017, in pandas_dtype
dtype))
TypeError: data type 'datetime64[us, UTC]' not understood
data type 'datetime64[us, UTC]' not understood
Problem description
It appears that timestamps require the resolution to be in nanoseconds if you're going to have the Series be timezone-aware. This is confusing because I can cast a string to a timestamp of any valid resolution, but I can't use anything but nanoseconds if I want a tz-aware timestamp.
As for the relevance, I'm aware of #23990 but it doesn't seem to directly apply to astype().
Context: This is a problem because there's downstream code that expects microsecond resolution and timezones and will choke otherwise (long story). I also need to use astype because the code needs to work with any dtype handed to it, and since the dtypes are being loaded from YAML files passing in an object is not an option.
Expected Output
A Series shouldn't require nanosecond resolution to be timezone-aware.
Code Sample, a copy-pastable example if possible
Traceback:
Problem description
It appears that timestamps require the resolution to be in nanoseconds if you're going to have the Series be timezone-aware. This is confusing because I can cast a string to a timestamp of any valid resolution, but I can't use anything but nanoseconds if I want a tz-aware timestamp.
As for the relevance, I'm aware of #23990 but it doesn't seem to directly apply to
astype()
.Context: This is a problem because there's downstream code that expects microsecond resolution and timezones and will choke otherwise (long story). I also need to use
astype
because the code needs to work with any dtype handed to it, and since the dtypes are being loaded from YAML files passing in an object is not an option.Expected Output
A Series shouldn't require nanosecond resolution to be timezone-aware.
Output of
pd.show_versions()
The text was updated successfully, but these errors were encountered: