Skip to content

Commit 767e5b4

Browse files
More flexible handling due to multiple float types returns by estimators
1 parent abe8599 commit 767e5b4

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

causal_testing/testing/causal_test_result.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,18 +99,19 @@ def to_dict(self, json=False):
9999
def ci_low(self):
100100
"""Return the lower bracket of the confidence intervals."""
101101
if self.confidence_intervals:
102-
try:
102+
if isinstance(self.confidence_intervals[0], pd.Series):
103103
return self.confidence_intervals[0][0]
104-
except IndexError:
104+
else:
105105
return self.confidence_intervals[0]
106106
return None
107107

108108
def ci_high(self):
109109
"""Return the higher bracket of the confidence intervals."""
110-
try:
111-
return self.confidence_intervals[1][0]
112-
except IndexError:
113-
return self.confidence_intervals[1]
110+
if self.confidence_intervals:
111+
if isinstance(self.confidence_intervals[1], pd.Series):
112+
return self.confidence_intervals[1][0]
113+
else:
114+
return self.confidence_intervals[1]
114115
return None
115116

116117
def ci_valid(self) -> bool:

0 commit comments

Comments
 (0)