Description
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
import pandas as pd, pyarrow as pa, numpy as np, datetime as dt
arrow_dt = pa.array([dt.date.fromisoformat('2020-01-01')], type=pa.date32())
ser = pd.Series(arrow_dt, dtype=pd.ArrowDtype(arrow_dt.type))
ser
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\asafs\Miniconda3\envs\test\lib\site-packages\pandas\core\series.py", line 1594, in __repr__
return self.to_string(**repr_params)
File "C:\Users\asafs\Miniconda3\envs\test\lib\site-packages\pandas\core\series.py", line 1687, in to_string
result = formatter.to_string()
File "C:\Users\asafs\Miniconda3\envs\test\lib\site-packages\pandas\io\formats\format.py", line 397, in to_string
fmt_values = self._get_formatted_values()
File "C:\Users\asafs\Miniconda3\envs\test\lib\site-packages\pandas\io\formats\format.py", line 381, in _get_formatted_values
return format_array(
File "C:\Users\asafs\Miniconda3\envs\test\lib\site-packages\pandas\io\formats\format.py", line 1328, in format_array
return fmt_obj.get_result()
File "C:\Users\asafs\Miniconda3\envs\test\lib\site-packages\pandas\io\formats\format.py", line 1359, in get_result
fmt_values = self._format_strings()
File "C:\Users\asafs\Miniconda3\envs\test\lib\site-packages\pandas\io\formats\format.py", line 1833, in _format_strings
fmt_values = [formatter(x) for x in values]
File "C:\Users\asafs\Miniconda3\envs\test\lib\site-packages\pandas\io\formats\format.py", line 1833, in <listcomp>
fmt_values = [formatter(x) for x in values]
File "C:\Users\asafs\Miniconda3\envs\test\lib\site-packages\pandas\io\formats\format.py", line 1802, in <lambda>
return lambda x: _format_datetime64_dateonly(
File "C:\Users\asafs\Miniconda3\envs\test\lib\site-packages\pandas\io\formats\format.py", line 1792, in _format_datetime64_dateonly
return x._date_repr
AttributeError: 'datetime.date' object has no attribute '_date_repr'
Issue Description
I saw in the "what's new" for the new release the functionality for creating general Arrow-backed objects and wanted to try it out. So I created a simple test Arrow Array
with date32
type and tried to make a series from it as described, but the series cannot be displayed without erroring. The ser
value itself can be created and its array values accessed still.
This issue didn't occur with eg pa.int32
but I did not comprehensively test across Arrow data types.
And while I'm here, thank you to the team for all your work on the awesome Arrow integration/extension features!
Expected Behavior
ser
can be displayed in an interactive REPL as usual and repr(ser)
does not error.
Installed Versions
INSTALLED VERSIONS
commit : 224458e
python : 3.10.1.final.0
python-bits : 64
OS : Windows
OS-release : 10
Version : 10.0.19044
machine : AMD64
processor : Intel64 Family 6 Model 78 Stepping 3, GenuineIntel
byteorder : little
LC_ALL : None
LANG : None
LOCALE : English_United States.1252
pandas : 1.5.0rc0
numpy : 1.23.2
pytz : 2022.2.1
dateutil : 2.8.2
setuptools : 60.2.0
pip : 21.3.1
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : None
IPython : 7.31.0
pandas_datareader: None
bs4 : None
bottleneck : None
brotli :
fastparquet : None
fsspec : None
gcsfs : None
matplotlib : None
numba : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : 8.0.0
pyreadstat : None
pyxlsb : None
s3fs : None
scipy : None
snappy : None
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
zstandard : None
tzdata : None