larray-project / larray

N-dimensional labelled arrays in Python
https://larray.readthedocs.io/
GNU General Public License v3.0
8 stars 6 forks source link

Array.dump should allow dumping with column titles but no row labels #1096

Open gdementen opened 9 months ago

gdementen commented 9 months ago

For DC, it would have helped me to have this functionality. I think I also needed the opposite at some point.

>>> arr = ndtest((2, "c=c0..c2"))
>>> arr
{0}*\c  c0  c1  c2
     0   0   1   2
     1   3   4   5
>>> arr.dump(axes_names=False)
[['', 'c0', 'c1', 'c2'], [0, 0, 1, 2], [1, 3, 4, 5]]
>>> arr.dump(header=False)
[[0, 1, 2], [3, 4, 5]]

I had to use this workaround:

>>> [arr.c.labels.tolist()] + arr.dump(header=False)
[['c0', 'c1', 'c2'], [0, 1, 2], [3, 4, 5]]