BUG: parse_dates=False while passing date_parser tries to use date parser · Issue #44366 · pandas-dev/pandas (original) (raw)
Navigation Menu
- Explore
- Pricing
Provide feedback
Saved searches
Use saved searches to filter your results more quickly
Appearance settings
Description
- 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 master branch of pandas.
Reproducible Example
with open('tmp.csv', 'w+') as handle: handle.write('a;b;c\n0;0,00;0')
def parser(p): raise ValueError("Tried to use parser")
pd.read_csv('tmp.csv', date_parser=parser, parse_dates=False)
Issue Description
Date parser gets run even when parse_dates
is set to False. This happens because Line 510 in readers.py (link only checks whether parse_dates
is a bool rather than the value.
I've not been able to reproduce without the comma and semicolons in there.
Expected Behavior
Getting the same result as pd.read_csv('tmp.csv')
which is a malformed DataFrame.
Installed Versions
INSTALLED VERSIONS
commit : 2cb9652
python : 3.8.10.final.0
python-bits : 64
OS : Windows
OS-release : 10
Version : 10.0.18363
machine : AMD64
processor : Intel64 Family 6 Model 85 Stepping 4, GenuineIntel
byteorder : little
LC_ALL : None
LANG : None
LOCALE : English_United Kingdom.1252
pandas : 1.2.4
numpy : 1.20.2
pytz : 2021.1
dateutil : 2.8.1
pip : 21.1.1
setuptools : 52.0.0.post20210125
Cython : None
pytest : 6.2.4
hypothesis : 6.14.1
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
fsspec : None
fastparquet : None
gcsfs : None
matplotlib : None
numexpr : None
odfpy : None
openpyxl : 3.0.7
pandas_gbq : None
pyarrow : None
pyxlsb : 1.0.8
s3fs : None
scipy : None
sqlalchemy : 1.4.22
tables : None
tabulate : None
xarray : None
xlrd : 2.0.1
xlwt : None
numba : None