Skip to content

Commit

Permalink
Fix OrderedDict regression (#5925)
Browse files Browse the repository at this point in the history
  • Loading branch information
hoxbro authored Oct 11, 2023
1 parent 50c6aa6 commit 8c9ce6d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions holoviews/core/data/dictionary.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from collections import defaultdict
from collections import OrderedDict, defaultdict

import numpy as np

Expand All @@ -18,7 +18,7 @@ class DictInterface(Interface):
are collections representing the values in that column.
"""

types = (dict,)
types = (dict, OrderedDict)

datatype = 'dictionary'

Expand Down Expand Up @@ -109,10 +109,11 @@ def init(cls, eltype, data, kdims, vdims):

if not cls.expanded([vs for d, vs in unpacked if d in dimensions and not isscalar(vs)]):
raise ValueError('DictInterface expects data to be of uniform shape.')
if isinstance(data, dict):
# OrderedDict can't be replaced with dict: https://github.com/holoviz/holoviews/pull/5925
if isinstance(data, OrderedDict):
data.update(unpacked)
else:
data = dict(unpacked)
data = OrderedDict(unpacked)

return data, {'kdims':kdims, 'vdims':vdims}, {}

Expand Down

0 comments on commit 8c9ce6d

Please sign in to comment.