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
When the option use_inf_as_na is set to True reading any csv-file fails with this error:
File "C:\Users\My.Name\AppData\Local\Continuum\miniconda3\envs\main\lib\site-packages\pandas\io\parsers.py", line 686, in read_csv
return _read(filepath_or_buffer, kwds)
File "C:\Users\My.Name\AppData\Local\Continuum\miniconda3\envs\main\lib\site-packages\pandas\io\parsers.py", line 458, in _read
data = parser.read(nrows)
File "C:\Users\My.Name\AppData\Local\Continuum\miniconda3\envs\main\lib\site-packages\pandas\io\parsers.py", line 1201, in read
df = DataFrame(col_dict, columns=columns, index=index)
File "C:\Users\My.Name\AppData\Local\Continuum\miniconda3\envs\main\lib\site-packages\pandas\core\frame.py", line 467, in __init__
mgr = init_dict(data, index, columns, dtype=dtype)
File "C:\Users\My.Name\AppData\Local\Continuum\miniconda3\envs\main\lib\site-packages\pandas\core\internals\construction.py", line 250, in init_dict
missing = arrays.isna()
File "C:\Users\My.Name\AppData\Local\Continuum\miniconda3\envs\main\lib\site-packages\pandas\core\series.py", line 4795, in isna
return super().isna()
File "C:\Users\My.Name\AppData\Local\Continuum\miniconda3\envs\main\lib\site-packages\pandas\core\generic.py", line 7109, in isna
return isna(self).__finalize__(self, method="isna")
File "C:\Users\My.Name\AppData\Local\Continuum\miniconda3\envs\main\lib\site-packages\pandas\core\dtypes\missing.py", line 124, in isna
return _isna(obj)
File "C:\Users\My.Name\AppData\Local\Continuum\miniconda3\envs\main\lib\site-packages\pandas\core\dtypes\missing.py", line 157, in _isna
return _isna_ndarraylike(obj, inf_as_na=inf_as_na)
File "C:\Users\My.Name\AppData\Local\Continuum\miniconda3\envs\main\lib\site-packages\pandas\core\dtypes\missing.py", line 218, in _isna_ndarraylike
result = _isna_string_dtype(values, dtype, inf_as_na=inf_as_na)
File "C:\Users\My.Name\AppData\Local\Continuum\miniconda3\envs\main\lib\site-packages\pandas\core\dtypes\missing.py", line 246, in _isna_string_dtype
vec = libmissing.isnaobj_old(values.ravel())
File "pandas\_libs\missing.pyx", line 160, in pandas._libs.missing.isnaobj_old
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
EDIT 1: Error also happens with read_table() and when feeding a StringIO object to read_csv().
EDIT 2: read_excel() fails as well.
Output of pd.show_versions()
INSTALLED VERSIONS
commit : d9fff27
python : 3.7.8.final.0
python-bits : 64
OS : Windows
OS-release : 10
Version : 10.0.19041
machine : AMD64
processor : Intel64 Family 6 Model 79 Stepping 1, GenuineIntel
byteorder : little
LC_ALL : None
LANG : en
LOCALE : None.None
Khris777
changed the title
BUG: read_csv() fails when option use_inf_as_na is set to True
BUG: Reading files fails when option use_inf_as_na is set to True
Aug 10, 2020
[ x] I have checked that this issue has not already been reported.
[ x] I have confirmed this bug exists on the latest version of pandas.
(optional) I have confirmed this bug exists on the master branch of pandas.
Code Sample, a copy-pastable example
Problem description
When the option
use_inf_as_na
is set toTrue
reading any csv-file fails with this error:EDIT 1: Error also happens with
read_table()
and when feeding aStringIO
object toread_csv()
.EDIT 2:
read_excel()
fails as well.Output of
pd.show_versions()
INSTALLED VERSIONS
commit : d9fff27
python : 3.7.8.final.0
python-bits : 64
OS : Windows
OS-release : 10
Version : 10.0.19041
machine : AMD64
processor : Intel64 Family 6 Model 79 Stepping 1, GenuineIntel
byteorder : little
LC_ALL : None
LANG : en
LOCALE : None.None
pandas : 1.1.0
numpy : 1.19.1
pytz : 2020.1
dateutil : 2.8.1
pip : 20.2.1
setuptools : 49.2.1.post20200802
Cython : 0.29.21
pytest : None
hypothesis : None
sphinx : 3.1.2
blosc : None
feather : None
xlsxwriter : 1.3.1
lxml.etree : 4.5.2
html5lib : 1.1
pymysql : None
psycopg2 : None
jinja2 : 2.11.2
IPython : 7.17.0
pandas_datareader: None
bs4 : 4.9.1
bottleneck : None
fsspec : 0.8.0
fastparquet : 0.4.1
gcsfs : None
matplotlib : 3.3.0
numexpr : None
odfpy : None
openpyxl : 3.0.4
pandas_gbq : None
pyarrow : 1.0.0
pytables : None
pyxlsb : None
s3fs : None
scipy : 1.5.0
sqlalchemy : 1.3.18
tables : None
tabulate : 0.8.7
xarray : None
xlrd : 1.2.0
xlwt : None
numba : 0.50.1
The text was updated successfully, but these errors were encountered: