Skip to content

Commit 6b7d6c6

Browse files
committed
implemented LArray.dump(light=True)
1 parent a10358f commit 6b7d6c6

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

larray/core/array.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2432,7 +2432,7 @@ def as_table(self, maxlines=None, edgeitems=5, light=False, wide=True, value_nam
24322432
# returns next line (labels of N-1 first axes + data)
24332433
yield list(tick) + dataline.tolist()
24342434

2435-
def dump(self, header=True, wide=True, value_name='value'):
2435+
def dump(self, header=True, wide=True, value_name='value', light=False):
24362436
"""Dump array as a 2D nested list
24372437
24382438
Parameters
@@ -2446,6 +2446,9 @@ def dump(self, header=True, wide=True, value_name='value'):
24462446
value_name : str, optional
24472447
Name of the column containing the values (last column) when `wide=False` (see above).
24482448
Not used if header=False. Defaults to 'value'.
2449+
light : bool, optional
2450+
Whether or not to hide repeated labels. In other words, only show a label if it is different from the
2451+
previous one. Defaults to False.
24492452
24502453
Returns
24512454
-------
@@ -2455,7 +2458,7 @@ def dump(self, header=True, wide=True, value_name='value'):
24552458
# flatten all dimensions except the last one
24562459
return self.data.reshape(-1, self.shape[-1]).tolist()
24572460
else:
2458-
return list(self.as_table(wide=wide, value_name=value_name))
2461+
return list(self.as_table(wide=wide, value_name=value_name, light=light))
24592462

24602463
# XXX: should filter(geo=['W']) return a view by default? (collapse=True)
24612464
# I think it would be dangerous to make it the default

0 commit comments

Comments
 (0)