deephaven / web-client-ui

Deephaven Web Client UI
Apache License 2.0
29 stars 31 forks source link

Improve clarity of pandas dataframe refresh tooltip #1643

Closed mattrunyon closed 1 year ago

mattrunyon commented 1 year ago

Description

Originally I filed this because I thought the button should refresh a dataframe created from a ticking table.

The tooltip to refresh a dataframe is unclear. Since Deephaven is based around ticking data, the tooltip as is can easily be misunderstood to mean it should update as if the dataframe ticked.

The engine takes a snapshot when creating a dataframe from a ticking table. That snapshot never updates. The refresh button is only applicable if you mutate the dataframe.

dsmmcken commented 1 year ago

I don't think that is expected to work. My understanding is to_pandas is a one way a static snapshot at the time of creation. The refresh is there for any subsequent pandas operations.

mattrunyon commented 1 year ago

The tooltip is too ambiguous then. It just says "Click to refresh pandas dataframe. Updates do not occur automatically"

Is the button just to update if the user performs some mutating pandas operation then? If it's non-mutating then the REPL would open the new version created automatically

dsmmcken commented 1 year ago

Correct, it's for mutations. to_pandas doesn't create a magically live pandas dataframe.

mattrunyon commented 1 year ago

Thoughts on clarifying the tooltip? Based on the tooltip I thought it would be for ticking data updates. Makes sense from the engine standpoint that it's just a snapshot, but from a user using Deephaven, I defaulted to thinking about ticking data as the likely meaning.

"Click to refresh dataframe. Pandas mutations do not display automatically" or something like that? From the pandas docs, they are mutable, but they say most operations do not mutate the original dataframe. See here

dsmmcken commented 1 year ago

Sure. Basically if it doesn't re-assign a new dataframe it won't update. Though I would argue most of your confusion here was with the to_pandas method, and you should make sure that docstring made sense to you.

Run:

import pandas as pd

data = {'Name': ['Jai', 'Princi', 'Gaurav', 'Anuj'],
        'Height': [5.1, 6.2, 5.1, 5.2],
        'Qualification': ['Msc', 'MA', 'Msc', 'Msc']}

df = pd.DataFrame(data)

Then: a. won't update:

  address = ['Delhi', 'Bangalore', 'Chennai', 'Patna']
  df['Address'] = address

b. would update:

  df = df.assign(address=['Delhi', 'Bangalore', 'Chennai', 'Patna'])
vbabich commented 1 year ago

Change text to "Changes to dataframe don't appear automatically. Click to refresh."

dsmmcken commented 1 year ago

Thought about, and I am not convinced this wording is actually better. "mutations" is too complex of a term, "changes" is no better than "updates". I am going to close this.