Skip to content

Commit

Permalink
Fixed bug with None types in result plots.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrucker committed Feb 4, 2024
1 parent 6780f9f commit 65ec4f9
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 139 deletions.
15 changes: 11 additions & 4 deletions coba/results/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,22 @@ def __new__(cls):
return cls._instance

def __str__(self):
return "Missing"
return "None"

def __repr__(self):
return "Missing"
return "None"

def __gt__(self,other):
return True

def __lt__(self,other):
return False

def __eq__(self,other):
return other is None or super().__eq__(other)

def __hash__(self):
return hash(None)

Missing = MissingType()

Expand Down Expand Up @@ -221,7 +227,7 @@ def insert(self, data:Union[Mapping, Sequence[Mapping], Sequence[Sequence]]=())
return self

if data_is_sequence_of_dicts:
data = {k:[d.get(k) for d in data] for k in set().union(*(d.keys() for d in data))}
data = {k:[d.get(k,Missing) for d in data] for k in set().union(*(d.keys() for d in data))}
data_is_mapping_of_cols = True

if data_is_mapping_of_cols:
Expand Down Expand Up @@ -1400,7 +1406,8 @@ def raw_contrast(self,
for g1_, g2_ in zip(g1,g2):
XY[g1_[1]].append((g1_[2],g2_[2]))
else:
makex = lambda x1,x2: x1 if x1 == x2 else f"{x2}-{x1}"
def makex(x1,x2):
return x1 if x1 == x2 else f"{x2}-{x1}"
for g1_,g2_ in product(g1,g2):
XY[makex(g1_[1],g2_[1])].append((g1_[2],g2_[2]))
p1,g1 = next(P1)
Expand Down
Loading

0 comments on commit 65ec4f9

Please sign in to comment.