mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +00:00
fix: Decimal values for Histogram bins (#32253)
This commit is contained in:
committed by
GitHub
parent
fa09d8187a
commit
ffe9244458
@@ -35,7 +35,13 @@ def test_histogram_no_groupby():
|
||||
)
|
||||
result = histogram(data_with_no_groupings, "a", [], bins)
|
||||
assert result.shape == (1, bins)
|
||||
assert result.columns.tolist() == ["1 - 2", "2 - 4", "4 - 6", "6 - 8", "8 - 10"]
|
||||
assert result.columns.tolist() == [
|
||||
"1.0 - 2.8",
|
||||
"2.8 - 4.6",
|
||||
"4.6 - 6.4",
|
||||
"6.4 - 8.2",
|
||||
"8.2 - 10.0",
|
||||
]
|
||||
assert result.values.tolist() == [[2, 2, 2, 2, 2]]
|
||||
|
||||
|
||||
@@ -44,11 +50,11 @@ def test_histogram_with_groupby():
|
||||
assert result.shape == (2, bins + 1)
|
||||
assert result.columns.tolist() == [
|
||||
"group",
|
||||
"1 - 2",
|
||||
"2 - 4",
|
||||
"4 - 6",
|
||||
"6 - 8",
|
||||
"8 - 10",
|
||||
"1.0 - 2.8",
|
||||
"2.8 - 4.6",
|
||||
"4.6 - 6.4",
|
||||
"6.4 - 8.2",
|
||||
"8.2 - 10.0",
|
||||
]
|
||||
assert result.values.tolist() == [["A", 2, 0, 2, 0, 2], ["B", 0, 2, 0, 2, 0]]
|
||||
|
||||
@@ -58,11 +64,11 @@ def test_histogram_with_groupby_and_normalize():
|
||||
assert result.shape == (2, bins + 1)
|
||||
assert result.columns.tolist() == [
|
||||
"group",
|
||||
"1 - 2",
|
||||
"2 - 4",
|
||||
"4 - 6",
|
||||
"6 - 8",
|
||||
"8 - 10",
|
||||
"1.0 - 2.8",
|
||||
"2.8 - 4.6",
|
||||
"4.6 - 6.4",
|
||||
"6.4 - 8.2",
|
||||
"8.2 - 10.0",
|
||||
]
|
||||
assert result.values.tolist() == [
|
||||
["A", 0.2, 0.0, 0.2, 0.0, 0.2],
|
||||
@@ -75,11 +81,11 @@ def test_histogram_with_groupby_and_cumulative():
|
||||
assert result.shape == (2, bins + 1)
|
||||
assert result.columns.tolist() == [
|
||||
"group",
|
||||
"1 - 2",
|
||||
"2 - 4",
|
||||
"4 - 6",
|
||||
"6 - 8",
|
||||
"8 - 10",
|
||||
"1.0 - 2.8",
|
||||
"2.8 - 4.6",
|
||||
"4.6 - 6.4",
|
||||
"6.4 - 8.2",
|
||||
"8.2 - 10.0",
|
||||
]
|
||||
assert result.values.tolist() == [["A", 2, 2, 4, 4, 6], ["B", 0, 2, 2, 4, 4]]
|
||||
|
||||
@@ -89,11 +95,11 @@ def test_histogram_with_groupby_and_cumulative_and_normalize():
|
||||
assert result.shape == (2, bins + 1)
|
||||
assert result.columns.tolist() == [
|
||||
"group",
|
||||
"1 - 2",
|
||||
"2 - 4",
|
||||
"4 - 6",
|
||||
"6 - 8",
|
||||
"8 - 10",
|
||||
"1.0 - 2.8",
|
||||
"2.8 - 4.6",
|
||||
"4.6 - 6.4",
|
||||
"6.4 - 8.2",
|
||||
"8.2 - 10.0",
|
||||
]
|
||||
assert result.values.tolist() == [
|
||||
[
|
||||
|
||||
Reference in New Issue
Block a user