Skip to content

Commit 2784f44

Browse files
committed
FEAT: resize columns automatically when changing number of digits (closes #145)
and heavily refactor that part of the code
1 parent b3e881b commit 2784f44

File tree

5 files changed

+215
-146
lines changed

5 files changed

+215
-146
lines changed

doc/source/changes/version_0_34.rst.inc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ Backward incompatible changes
1717
New features
1818
^^^^^^^^^^^^
1919

20+
* the initial column width is now set depending on the content and resized automatically when changing the number of
21+
digits (closes :editor_issue:`145`).
22+
2023
* added a feature (see the :ref:`miscellaneous section <misc_editor>` for details).
2124

2225
* added another feature in the editor (closes :editor_issue:`1`).

larray_editor/arrayadapter.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,12 +212,15 @@ def _plot(self, data):
212212
def get_axes_filtered_data(self):
213213
return self.get_axes(self.filtered_data)
214214

215-
def get_sample(self):
215+
def get_finite_sample(self):
216216
"""Return a sample of the internal data"""
217217
data = self._get_raw_data(self.filtered_data)
218218
# this will yield a data sample of max 200
219219
sample = get_sample(data, 200)
220-
return sample[np.isfinite(sample)]
220+
if np.issubdtype(sample.dtype, np.number):
221+
return sample[np.isfinite(sample)]
222+
else:
223+
return sample
221224

222225
def get_axes_names(self, fold_last_axis=False):
223226
axes_names = [axis.name for axis in self.get_axes_filtered_data()]

0 commit comments

Comments
 (0)