-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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
BUG: Inconsistent dtype behavior between read_csv and convert_dtypes with pyarrow backend for datetime #55422
Comments
Hey there, thanks for reporting the issue. As you can see here this is using a pyarrow method pandas/pandas/core/arrays/arrow/array.py Lines 183 to 202 in 1681cc7
See here about pandas/pandas/io/parsers/readers.py Lines 185 to 187 in 1681cc7
|
I think this works correctly with the pyarrow engine (If you add I think this is an issue with the C and Python engines, though. |
Thanks. I was under the impression that
Confirmed. And this issue can be considered closed. |
I do not agree with the OP. |
Using pandas 2.1.4. I'm seeing the same error using read_sql and the engine cannot be specified. |
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
I'm uncertain whether this is a bug or intentional design.
On pandas 2.1.1, when utilizing
read_csv(..., dtype_backend="pyarrow")
, a column specified inparse_dates
returns adatetime64[ns]
type, whereas I expect atimestamp[ns][pyarrow]
type, as indicated by the results of.convert_dtypes(dtype_backend="pyarrow")
.Thanks,
Expected Behavior
Installed Versions
$ docker run -it --rm python:3.11.6-slim bash
root@2eff93196ac4:/# pip install -U pip & pip install pandas==2.1.1 & pip install pyarrow==13.0.0
root@2eff93196ac4:/# python
>>> pd.show_versions()
/usr/local/lib/python3.11/site-packages/_distutils_hack/init.py:33: UserWarning: Setuptools is replacing distutils.
warnings.warn("Setuptools is replacing distutils.")
INSTALLED VERSIONS
commit : e86ed37
python : 3.11.6.final.0
python-bits : 64
OS : Linux
OS-release : 5.15.49-linuxkit-pr
Version : #1 SMP Thu May 25 07:17:40 UTC 2023
machine : x86_64
processor :
byteorder : little
LC_ALL : None
LANG : C.UTF-8
LOCALE : en_US.UTF-8
pandas : 2.1.1
numpy : 1.26.0
pytz : 2023.3.post1
dateutil : 2.8.2
setuptools : 65.5.1
pip : 23.2.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 : None
pandas_datareader : None
bs4 : None
bottleneck : None
dataframe-api-compat: None
fastparquet : None
fsspec : None
gcsfs : None
matplotlib : None
numba : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : 13.0.0
pyreadstat : None
pyxlsb : None
s3fs : None
scipy : None
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
zstandard : None
tzdata : 2023.3
qtpy : None
pyqt5 : None
The text was updated successfully, but these errors were encountered: