valueLabels property of header does not preserve order of labels
Issue #49
new
For the project I want to use savReaderWriter for, the order of the labels returned by valueLabels matters. Because savReaderWriter returns them as a dictionary, the order is lost. I have been able to modify the source of header.py in my local copy to use collections.OrderedDict instead (including changing decode() to use OrderedDictwhen original dict is OrderedDict). However surely I'm not the only one this matters to?
Incidentally the decode process also seems to convert codes from floats to Unicode strings as well.
Comments (1)
-
repo owner - Log in to comment
Hi,
Sorry for my slow reply. I have created savReaderWriter several years ago now, and nobody had made this request before now. But now, almost in the same week, two people asked for it.:-) I thought you were one of my colleagues and I had already replied to him. Yep, changing it so the
valueLabels
property returns anOrderedDict
is easy enough. I will do that. Re: the decode function: so you're saying that, ioUtf8=True,value_labels = {1.0: b"apple", 2.0: b"pear"}
becomesvalue_labels = {u"1.0": u"apple", u"2.0": u"pear"}
? What Python version are you using?