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
It seems that the error is because fileno is being called on a BytesIO object. This code does work in pandas 1.3.4, which is odd, so I took a look at the sources to see what was different and noticed that in _maybe_memory_map, the except when trying to instant the _MMapWrapper was removed from common.py. (Old common.py for reference).
Expected Behavior
I would expect the read_csv to succeed and the DataFrame to be read.
Installed Versions
INSTALLED VERSIONS
commit : bb1f651
python : 3.8.12.final.0
python-bits : 64
OS : Darwin
OS-release : 21.1.0
Version : Darwin Kernel Version 21.1.0: Wed Oct 13 17:33:23 PDT 2021; root:xnu-8019.41.5~1/RELEASE_X86_64
machine : x86_64
processor : i386
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
I don't think there is a point in using memory_map with BytesIO. The data is already in memory.
This was purposefully changed in #44777 and is mentioned in the whatsnew for 1.4.0. Silently failing (previous behavior) gives the illusion that it worked, even though it was never using mmap for BytesIO.
Thank you @twoertwein! I just wanted to confirm that this was expected behavior! I'm wondering though if it makes sense to include a more descriptive error message so people know what's going on?
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
The
read_csv
fails, and provides this error:It seems that the error is because
fileno
is being called on aBytesIO
object. This code does work in pandas 1.3.4, which is odd, so I took a look at the sources to see what was different and noticed that in_maybe_memory_map
, theexcept
when trying to instant the_MMapWrapper
was removed from common.py. (Old common.py for reference).Expected Behavior
I would expect the
read_csv
to succeed and the DataFrame to be read.Installed Versions
INSTALLED VERSIONS
commit : bb1f651
python : 3.8.12.final.0
python-bits : 64
OS : Darwin
OS-release : 21.1.0
Version : Darwin Kernel Version 21.1.0: Wed Oct 13 17:33:23 PDT 2021; root:xnu-8019.41.5~1/RELEASE_X86_64
machine : x86_64
processor : i386
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
pandas : 1.4.0
numpy : 1.21.4
pytz : 2021.3
dateutil : 2.8.2
pip : 21.3.1
setuptools : 58.0.4
Cython : None
pytest : 6.2.5
hypothesis : None
sphinx : 4.3.1
blosc : None
feather : 0.4.1
xlsxwriter : None
lxml.etree : 4.6.4
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 3.0.3
IPython : 7.30.0
pandas_datareader: None
bs4 : None
bottleneck : None
fastparquet : None
fsspec : 2021.11.1
gcsfs : None
matplotlib : 3.2.2
numba : None
numexpr : 2.7.3
odfpy : None
openpyxl : 3.0.9
pandas_gbq : 0.16.0
pyarrow : 3.0.0
pyreadstat : None
pyxlsb : None
s3fs : 2021.11.1
scipy : 1.7.3
sqlalchemy : 1.4.27
tables : 3.6.1
tabulate : None
xarray : 0.20.1
xlrd : 2.0.1
xlwt : None
zstandard : None
The text was updated successfully, but these errors were encountered: