Skip to content

Commit

Permalink
#365: fixed display issues with KDE
Browse files Browse the repository at this point in the history
  • Loading branch information
aschonfeld committed Dec 24, 2020
1 parent d7d713e commit 9a99f9e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion dtale/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2311,7 +2311,7 @@ def build_kde(s, hist_labels, code, return_data):
try:
kde = sts.gaussian_kde(s)
kde_data = kde.pdf(hist_labels)
kde_data = [json_float(k) for k in kde_data[1:]]
kde_data = [json_float(k, precision=8) for k in kde_data]
code.append("import scipy.stats as sts\n")
code.append("kde = sts.gaussian_kde(s['{}'])".format(selected_col))
code.append("kde_data = kde.pdf(np.linspace(labels.min(), labels.max()))")
Expand Down
1 change: 1 addition & 0 deletions static/popups/analysis/columnAnalysisUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ function buildHistogramAxes(baseCfg, fetchedData, _chartOpts) {
scaleLabel: { display: true, labelString: "KDE" },
id: "y-2",
position: "right",
ticks: { min: 0, max: _.max(kde) },
});
datasets = _.concat(
_.assignIn(
Expand Down
2 changes: 1 addition & 1 deletion tests/dtale/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1921,7 +1921,7 @@ def test_get_column_analysis_kde():
query_string=dict(col="a", type="histogram", bins=50),
)
response_data = json.loads(response.data)
assert len(response_data["kde"]) == 50
assert len(response_data["kde"]) == 51


CORRELATIONS_CODE = """# DISCLAIMER: 'df' refers to the data you passed in when calling 'dtale.show'
Expand Down

0 comments on commit 9a99f9e

Please sign in to comment.