-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
speed up the repr for big MultiIndex objects (#4846)
* print the repr of a multiindex using only a subset of the coordinate values * don't index if we have less items than available width * don't try to shorten arrays which are way too short * col_width seems to be the maximum number of elements, not characters * add a asv benchmark * Apply suggestions from code review Co-authored-by: Maximilian Roos <5635139+max-sixty@users.noreply.github.com> Co-authored-by: Maximilian Roos <5635139+max-sixty@users.noreply.github.com>
- Loading branch information
Showing
2 changed files
with
27 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import pandas as pd | ||
|
||
import xarray as xr | ||
|
||
|
||
class ReprMultiIndex: | ||
def setup(self, key): | ||
index = pd.MultiIndex.from_product( | ||
[range(10000), range(10000)], names=("level_0", "level_1") | ||
) | ||
series = pd.Series(range(100000000), index=index) | ||
self.da = xr.DataArray(series) | ||
|
||
def time_repr(self): | ||
repr(self.da) | ||
|
||
def time_repr_html(self): | ||
self.da._repr_html_() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters