From e64b2bcae4769844dee54728238322d9755d1cd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20H=C3=B8xbro=20Hansen?= Date: Fri, 11 Oct 2024 15:47:21 +0200 Subject: [PATCH] enh!: Respect input order of collection in summary --- datashader/reductions.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/datashader/reductions.py b/datashader/reductions.py index c11e90823..353a751ac 100644 --- a/datashader/reductions.py +++ b/datashader/reductions.py @@ -2128,9 +2128,15 @@ class summary(Expr): performed in two stages. """ def __init__(self, **kwargs): - ks, vs = zip(*sorted(kwargs.items())) - self.keys = ks - self.values = vs + self._collection = kwargs + + @property + def keys(self): + return list(self._collection) + + @property + def values(self): + return list(self._collection.values()) def __hash__(self): return hash((type(self), tuple(self.keys), tuple(self.values)))