fix(pandas-postprocessing): percentage compare to use correct column (#16716)
This commit is contained in:
parent
836b5e2c86
commit
a839649e5c
|
|
@ -508,7 +508,7 @@ def compare( # pylint: disable=too-many-arguments
|
|||
diff_series = df[s_col] - df[c_col]
|
||||
elif compare_type == PandasPostprocessingCompare.PCT:
|
||||
diff_series = (
|
||||
((df[s_col] - df[c_col]) / df[s_col]).astype(float).round(precision)
|
||||
((df[s_col] - df[c_col]) / df[c_col]).astype(float).round(precision)
|
||||
)
|
||||
else:
|
||||
# compare_type == "ratio"
|
||||
|
|
|
|||
|
|
@ -513,7 +513,7 @@ class TestPostProcessing(SupersetTestCase):
|
|||
post_df.columns.tolist(), ["label", "y", "z", "percentage__y__z",]
|
||||
)
|
||||
self.assertListEqual(
|
||||
series_to_list(post_df["percentage__y__z"]), [0.0, -1.0, -4.0, -3],
|
||||
series_to_list(post_df["percentage__y__z"]), [0.0, -0.5, -0.8, -0.75],
|
||||
)
|
||||
|
||||
# `ratio` comparison
|
||||
|
|
|
|||
Loading…
Reference in New Issue