-
-
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
pd.ExcelFile closes stream on destruction in pandas 1.0.0 #31467
Comments
Possibly related to #30096 since that added a @johny-b if you do |
|
I don’t think this is a bug. del simply decrements a reference count but makes no guarantees around when the GC will actually destroy the object. |
in read_csv where we track if an open stream is given (as opposed to a file), then can close only things that we opened. this might take a bit of work to fix though. if someone wants to do this for 1.0.1 great, but won't consider this a blocker. |
Yes, the "bug" (or missing feature, how you want to call it) is that that |
take |
Code Sample, a copy-pastable example if possible
Problem description
Above script behaves in different way in pandas 0.25.3 and 1.0.0:
It seems that stream is closed when ExcelFile is destroyed - and I don't see why.
Expected Output
I'd expect either notice in release notes, or the same output in 0.25.3 and 1.0.0.
Output of
pd.show_versions()
INSTALLED VERSIONS
commit : None
python : 3.6.8.final.0
python-bits : 64
OS : Linux
OS-release : 5.0.0-1028-gcp
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : C.UTF-8
LOCALE : en_US.UTF-8
pandas : 1.0.0
numpy : 1.18.1
pytz : 2019.3
dateutil : 2.8.1
pip : 9.0.1
setuptools : 39.0.1
Cython : None
pytest : 4.3.0
hypothesis : None
sphinx : 1.8.5
blosc : None
feather : None
xlsxwriter : None
lxml.etree : 4.4.1
html5lib : 0.999999999
pymysql : None
psycopg2 : 2.8.3 (dt dec pq3 ext lo64)
jinja2 : 2.10.1
IPython : None
pandas_datareader: None
bs4 : 4.8.0
bottleneck : None
fastparquet : None
gcsfs : None
lxml.etree : 4.4.1
matplotlib : None
numexpr : None
odfpy : None
openpyxl : 2.5.14
pandas_gbq : None
pyarrow : None
pytables : None
pytest : 4.3.0
pyxlsb : None
s3fs : None
scipy : 1.2.0
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : 1.2.0
xlwt : None
xlsxwriter : None
numba : None
The text was updated successfully, but these errors were encountered: