DS-5920 fixed incorrect dash in histogram tooltips for Windows case

Merge-request: IJ-MR-118912
Merged-by: Georgii Zorabov <georgii.zorabov@jetbrains.com>

GitOrigin-RevId: 5e07344b21850196e10570e4ab114ea957e364e2
This commit is contained in:
Georgii.Zorabov
2023-11-07 02:44:28 +00:00
committed by intellij-monorepo-bot
parent 8fa81e9a27
commit 263f637545
2 changed files with 5 additions and 2 deletions

View File

@@ -194,7 +194,8 @@ def analyze_numeric_column(column):
else:
format_function = lambda x: round(x, 1)
bin_labels = ['{}{}'.format(format_function(bin_edges[i]), format_function(bin_edges[i+1])) for i in range(ColumnVisualisationUtils.NUM_BINS)]
# so {} — {} will be correctly viewed both on Mac and Windows
bin_labels = ['{} \u2014 {}'.format(format_function(bin_edges[i]), format_function(bin_edges[i+1])) for i in range(ColumnVisualisationUtils.NUM_BINS)]
bin_count_dict = {label: count for label, count in zip(bin_labels, counts)}
res = bin_count_dict
return add_custom_key_value_separator(res.items())

View File

@@ -159,7 +159,9 @@ def analyze_numeric_column(column, col_name):
if unique_values > ColumnVisualisationUtils.NUM_BINS:
counts, bin_edges = np.histogram(column, bins=ColumnVisualisationUtils.NUM_BINS)
format_function = int if column.is_integer() else lambda x: round(x, 1)
bin_labels = ['{}{}'.format(format_function(bin_edges[i]), format_function(bin_edges[i + 1])) for i in range(ColumnVisualisationUtils.NUM_BINS)]
# so {} — {} will be correctly viewed both on Mac and Windows
bin_labels = ['{} \u2014 {}'.format(format_function(bin_edges[i]), format_function(bin_edges[i + 1])) for i in range(ColumnVisualisationUtils.NUM_BINS)]
res = add_custom_key_value_separator(zip(bin_labels, counts))
else:
counts = column.value_counts().sort(by=col_name).to_dict()