diff --git a/superset/result_set.py b/superset/result_set.py index 170de1869c830..1c4ae98dc9112 100644 --- a/superset/result_set.py +++ b/superset/result_set.py @@ -70,14 +70,14 @@ def stringify_values(array: NDArray[Any]) -> NDArray[Any]: for obj in it: if na_obj := pd.isna(obj): # pandas type cannot be converted to string - obj[na_obj] = None + obj[na_obj] = None # type: ignore else: try: # for simple string conversions # this handles odd character types better - obj[...] = obj.astype(str) + obj[...] = obj.astype(str) # type: ignore except ValueError: - obj[...] = stringify(obj) + obj[...] = stringify(obj) # type: ignore return result diff --git a/superset/utils/pandas_postprocessing/boxplot.py b/superset/utils/pandas_postprocessing/boxplot.py index e2706345b1ea9..d4c78bf15e8c8 100644 --- a/superset/utils/pandas_postprocessing/boxplot.py +++ b/superset/utils/pandas_postprocessing/boxplot.py @@ -57,10 +57,10 @@ def boxplot( """ def quartile1(series: Series) -> float: - return np.nanpercentile(series, 25, interpolation="midpoint") + return np.nanpercentile(series, 25, method="midpoint") def quartile3(series: Series) -> float: - return np.nanpercentile(series, 75, interpolation="midpoint") + return np.nanpercentile(series, 75, method="midpoint") if whisker_type == PostProcessingBoxplotWhiskerType.TUKEY: @@ -99,8 +99,8 @@ def whisker_low(series: Series) -> float: return np.nanpercentile(series, low) else: - whisker_high = np.max - whisker_low = np.min + whisker_high = np.max # type: ignore + whisker_low = np.min # type: ignore def outliers(series: Series) -> Set[float]: above = series[series > whisker_high(series)] diff --git a/superset/utils/pandas_postprocessing/flatten.py b/superset/utils/pandas_postprocessing/flatten.py index db783c4bed264..1026164e454ee 100644 --- a/superset/utils/pandas_postprocessing/flatten.py +++ b/superset/utils/pandas_postprocessing/flatten.py @@ -85,7 +85,7 @@ def flatten( _columns = [] for series in df.columns.to_flat_index(): _cells = [] - for cell in series if is_sequence(series) else [series]: + for cell in series if is_sequence(series) else [series]: # type: ignore if pd.notnull(cell): # every cell should be converted to string and escape comma _cells.append(escape_separator(str(cell))) diff --git a/tests/integration_tests/result_set_tests.py b/tests/integration_tests/result_set_tests.py index 626468fc5aae0..18135c486dbea 100644 --- a/tests/integration_tests/result_set_tests.py +++ b/tests/integration_tests/result_set_tests.py @@ -169,13 +169,13 @@ def test_nested_types(self): "id": 4, "dict_arr": '[{"table_name": "unicode_test", "database_id": 1}]', "num_arr": "[1, 2, 3]", - "map_col": '{"chart_name": "scatter"}', + "map_col": "{'chart_name': 'scatter'}", }, { "id": 3, "dict_arr": '[{"table_name": "birth_names", "database_id": 1}]', "num_arr": "[4, 5, 6]", - "map_col": '{"chart_name": "plot"}', + "map_col": "{'chart_name': 'plot'}", }, ], )