-
Notifications
You must be signed in to change notification settings - Fork 89
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
feat: add pretty nbytes repr to .show and jupyter repr #3348
Conversation
Love this improvement! There's the usual caveat note about |
Yes 👍, also it does not take into account the python objects/structure and whatever is in |
This is very nice! But can we make it say " Also, are you making the right distinction between "MB" (megabytes) and "MiB" (mebibytes)? One system uses factors of 1000 and the other uses factors of 1024. |
I chose
That should be correct, I'm using factors of |
Oh btw, one thing that I noticed is that the typetracer backend reports |
https://simple.wikipedia.org/wiki/Mebibyte (I'm in a meeting) |
as discussed I changed:
Example: In [1]: import awkward as ak; import numpy as np
In [2]: array = ak.with_named_axis(
...: ak.zip({
...: "one": np.full((1234567,), 1.0),
...: "two": np.full((1234567,), 2.0),
...: "three": np.full((1234567,), 3.0),
...: }),
...: named_axis=("some",),
...: )
In [3]: array.show(type=True, named_axis=True, nbytes=True, backend=True)
type: 1234567 * {
one: float64,
two: float64,
three: float64
}
axes: some:0
nbytes: 29.6 MB
backend: cpu
[{one: 1, two: 2, three: 3},
{one: 1, two: 2, three: 3},
{one: 1, two: 2, three: 3},
{one: 1, two: 2, three: 3},
{one: 1, two: 2, three: 3},
{one: 1, two: 2, three: 3},
{one: 1, two: 2, three: 3},
{one: 1, two: 2, three: 3},
{one: 1, two: 2, three: 3},
{one: 1, two: 2, three: 3},
..., For For the Jupyter repr the order is: |
@jpivarski could you have one last look at this PR? thanks 🙏 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks great! I see that the code duplication is gone (now in highlevel_array_show_rows
) and it has an all
argument. I think the PR is ready to merge.
This is a little PR that adds (optionally, default is False) a new line to
.show(nbytes=True)
and the jupyter repr of high-level ak.Arrays and ak.Records. It's for the lazy (like me) who don't want to do the calculation in their head...Preview (
.show()
):Preview (Jupyter repr):
What do you think?