Open RehanSD opened 2 years ago
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?
Catching UnsupportedOperation (and maybe AttributeError) and then re-raising a more clear message might be worth it.
Pandas version checks
[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.
[X] 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