-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Proposal: Shorter default Series/DataFrame repr when truncated #27000
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
so this would add two display options and two arguments, to personally, since this proposal is display related and not so relevant to IO, I would prefer not to see the additional arguments to |
I would personally only start with And also personally for me, I am fine with only adding it as a general display option for now, and not necessarily to |
+1 in that case. |
+1 from me as well. |
cc @pandas-dev/pandas-core we might still include this in 0.25.0. Any concerns about the above proposal? |
+1 sounds great to me |
+1 for me too |
I'm +1. |
There haven been previous attempts to reduce the length of the Series/DataFrame repr (
pandas.options.display.max_rows
), eg #20514. Related pandas-dev email: https://mail.python.org/pipermail/pandas-dev/2018-March/000732.htmlIn that discussion, I once made the following proposal to introduce two thresholds:
rows to show in a truncated repr, and a max number of rows to show
without truncating
lower than 20 and only show first/last 5 (so like a max_rows of 10)
to the threshold.
We would still need to define those two thresholds. But for example, using the current max_rows of 60: we could show a full repr up to 60 rows, and once the number of rows > 60, we only show 10 (first/last 5).
You can then still set both thresholds at the same number (like 20, as in the linked PR above) to not get this variable behaviour.
This is actually similar to what numpy arrays do (but with a bigger threshold: eg np.random.randn(1000) shows all 1000 elements, np.random.randn(1001) shows the first/lst 3).
And it is also very similar to what R tibbles do: they have a "print_min" and "print_max" options with exactly this behaviour, only their "print_max" is lower (it's 10 and 20, respectively):
The text was updated successfully, but these errors were encountered: