-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: to_pydatetime() -> 'pyarrow.lib.DataType' object has no attribute 'unit' #52812
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
Comments
Can you post the pull traceback? |
~/.local/lib/python3.9/site-packages/pandas/core/indexes/accessors.py in to_pydatetime(self)
211
212 def to_pydatetime(self):
--> 213 return cast(ArrowExtensionArray, self._parent.array)._dt_to_pydatetime()
214
215 def isocalendar(self):
~/.local/lib/python3.9/site-packages/pandas/core/arrays/arrow/array.py in _dt_to_pydatetime(self)
2085 def _dt_to_pydatetime(self):
2086 data = self._data.to_pylist()
-> 2087 if self._dtype.pyarrow_dtype.unit == "ns":
2088 data = [None if ts is None else ts.to_pydatetime(warn=False) for ts in data]
2089 return np.array(data, dtype=object)
AttributeError: 'pyarrow.lib.DataType' object has no attribute 'unit' |
Okay here's a pandas reproducer
Not 100% that this should work, |
isnt this why we have |
Looks specifically used for The issue here is |
Labelling 2.0.1 for now, think it might make sense back porting a better error message |
Pandas version checks
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
Issue Description
For context, I was feeding a pandas DataFrame with pyarrow dtypes into the
dash
package, which calleds.dt.to_pydatetime()
on a date seriess
. Maybe the problem is dash's fault, but this seems like a pandas bug.Expected Behavior
Return datetime objects as expected.
Installed Versions
ModuleNotFoundError: No module named 'PySide6'
The text was updated successfully, but these errors were encountered: