-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
REGR: Notebook (html) repr of DataFrame no longer follows min_rows/max_rows settings #37359
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
Comments
We do have tests for this: pandas/pandas/tests/io/formats/test_format.py Lines 472 to 477 in 4aa41b8
but apparently, they pass when not in a notebook environment, and |
Can confirm it is a regression due to #36434 |
Does it mean that tests must be modified first? I can work on fixing the issue, but I would be grateful if somebody creates/fix tests, so that they fail. |
I am not directly sure how to fix the tests. A first step would probably be to understand why it is returning something different for |
So it is console:
I think this is related to this pandas/pandas/io/formats/format.py Lines 634 to 637 in 4aa41b8
Do you remember why you added that? |
Originally there was a complex logic in _truncate() method.
So, instead of a comment I extracted method. I would like to check everything, but I struggle to install dev environment with jupyter.
File "setup.py", line 94, in run
self._run_cmake()
File "setup.py", line 273, in _run_cmake
raise RuntimeError('Not supported on 32-bit Windows')
RuntimeError: Not supported on 32-bit Windows
----------------------------------------
ERROR: Failed building wheel for pyarrow
Building wheel for aiohttp (PEP 517): started
Building wheel for aiohttp (PEP 517): finished with status 'done'
Created wheel for aiohttp: filename=aiohttp-3.6.3-cp38-cp38-win32.whl size=601804 sha256=346f18929faa79c6bb86c777633cb97b27c86ed5d7876d418da25f82567d4996
Stored in directory: c:\users\mivanov4\appdata\local\pip\cache\wheels\2d\6d\bb\486f8c893f1dcc917860a5b3e2f2ca286c398f7d548ffc649c
Successfully built black blosc aiohttp
Failed to build pyarrow
ERROR: Could not build wheels for pyarrow which use PEP 517 and cannot be installed directly
Do I need python 64 for this? |
My general recommnedation then is: use conda .. (it's trying to build a pyarrow wheel, not sure why that is, because there should be wheels for pyarrow for windows)
The main difference might be that you now "return" directly self.max_rows in this case, while before whether you were in a terminal or not, there was still other code (not in the |
I will install it via conda then and check. Probably this will help:
|
Yep, I think that more or less sounds correct. For testing, we might want to check if we can "monkeypatch" pandas to think it is in a notebook, when running the repr_html tests |
Another option would be to set the max_columns option to something non-zero, which is what happens in a notebook |
On master, the html repr in notebooks of a DataFrame is no longer following the min_rows/max_rows logic (see https://pandas.pydata.org/docs/dev/user_guide/options.html#frequently-used-options).
If you have a DataFrame with many rows, it incorrectly shows 60 (max_rows) rows in the truncated repr intead of 10 (min_rows).
cc @ivanovmg (might be related to the refactoring you have been doing, but to be clear, I didn't check if this is actually the case!)
The text was updated successfully, but these errors were encountered: