-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
df.groupby('key').groups printed all: problem with large arrays #1135
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
@jorisvandenbossche hah...this issue is from u 2 years ago! a good idea! |
ah yes :-) long time ago. I think my first one! |
I was hoping to take a shot at this. Does anyone have a recommended approach? |
i think u can use pprint: https://docs.python.org/3/library/pprint.html use compact=True |
I found >>> from pandas.io.formats.printing import pprint_thing
>>> z = [list('abc') for _ in range(100)]
>>> print(pprint_thing(z, max_seq_items=3))
[[a, b, c], [a, b, c], [a, b, c], ...] However it truncates at the end rather than in the middle, which doesn't match df. Maybe Also, |
Would it be better to implement as I've described above and discuss further in the PR? |
When you are working with a large array, it is not printed out in its entirety in the console, but when you have grouped them with
groupby('key')
, the groups are all printed out. Would it be possible to also restrict the output ofgroupby('key').groups
to eg the first and last groups?I was working with a rather large dataframe (around 80000 rows), and first it took a long time to print it all, and second the console got stuck for a while (but that could also be an issue with spyder).
I know it is not very useful to print out the groups, but I was curious to see what it would look like, but it was not a very good idea with such a large array.
The text was updated successfully, but these errors were encountered: