posit-dev / posit-dev/positron

Enhancements to range handling of Histograms in Data Explorer

Open
#9,801 1 comment 1 reaction 1 assignee View on GitHub

@wesm is already working on this.

Since Oct 6, 2025.

area: data explorer
Dominant language
TypeScript
Stars
4.3k
Forks
184
Avg merge
1d 9h
Merged PRs (30d)
195

Description

While testing #9482, I did some regression testing around histograms' display in data explorer, got together with @wesm, and identified some issues that would be worth improving.

Generate a data frame using the following Python script
import pandas as pd
import numpy as np

data = {
    "pure_small_integers": [0, 1, 2, 3, 4],
    "negative_integers": [-5, -4, -3, -2, -2],
    "floats_with_decimals": [0.5, 1.5, 2.5, 2.5, 2.5],
    "floats_that_are_whole": [0.0, 1.0, 2.0, 2.0, 2.0],
    "mixed_ints_and_decimals": [0, 1.25, 2, 3.5, 3.5],
    "single_value_integer": [7, 7, 7, 7, 7],
    "single_value_decimal": [3.3, 3.3, 3.3, 3.3, 3.3],
    "integers_with_nans": [0, 1, np.nan, 3, 3],
    "decimals_with_nans": [0.5, np.nan, 2.5, 2.5, 2.5],
    "very_large_integers": [1000000, 1000001, 1000002, 1000003, 1000005],
    "tiny_decimals": [0.001, 0.002, 0.003, 0.002, 0.003],
    "negative_decimals": [-2.25, -1.75, -2.0, -2.0, -1.75],
    "booleans": [True, False, True, False, True],
    "mixed_numeric_strings": ["1", "2", "3.5", "2", "3.5"],
    "mixed_object": [0, "1", 2, "3.5", 4],
    "inf_nan_present": [1.0, np.inf, -np.inf, np.nan, 3.5]
}

df_test_cases = pd.DataFrame(data)

df_test_cases.head()
Sub-issue A
  • In pure_small_integers, range 2 is in both lower and upper bounds (0-2 and 2-4).
  • It should be 0-1 and 2-4
Sub-issue B
  • Evaluating floats_with_decimals, floats_that_are_whole, and mixed_ints_and_decimals, please note that the number of decimal places is now inconsistent.
  • We should consider using same value formatting logic that is in the data grid, or have a logic that is different but at least consistent
Sub-issue C
  • It is confusing when range is inclusive or exclusive of extreme bounds.
  • It would be helpful to have () or [] added to the ranges to make it clear to the user if range is exclusive or inclusive.
Sub-issue D
  • When evaluating mixed_object, notice that no histogram is generated in the data frame tab.
  • We should consider enabling handling of object arrays so that sparklines can be computed in these cases.
Sub-issue E
  • Posted as part of description by @hadley at #9833

(This display also reveals another challenge of histograms here: if you have one more unique value than number of bins, one of the bins is much larger than the others)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.