Closed ahuang11 closed 3 months ago
Very often the data you have is not a dict, but a dataframe
To be consistent with other widgets, I like the idea of keeping dict, list. (I suppose Tabulator/Perspective uses param.DataFrame)
Also, I think transforming a dataframe to a dict is semi-trivial df.to_dict()
I wonder how a dataframe with multi-level would look.
Usually you'd have a multi-index that maps to the dict. I'm fine with a .from_index()
method or similar.
Generally I've always wanted a .from_pandas
method for most widgets that automatically computes the bounds for sliders and the options for select widgets.
To be consistent with other widgets, I like the idea of keeping dict, list. (I suppose Tabulator/Perspective uses param.DataFrame)
Also, I think transforming a dataframe to a dict is semi-trivial
df.to_dict()
I wonder how a dataframe with multi-level would look.
Its not just transforming a dataframe to a dictionary. You might have a DataFrame with 10mn rows containing categorical columns category1
, category2
, category3
and other columns. You then want to select first from the unique category1 values. Then from the reduced set of unique category2
values under category1
etc.
So I suppose this widget should definitely support n-nesting, and I agree that I prefer from_pandas
or from_index
instead of a param.DataFrame
field.
I can try creating a prototype. Would this be a CompositeWidget
?
One thing to note is that it would be nice to have some more complex dependencies. For example you could have one widgets contents be dependent on two independent widgets.
Interesting idea; not entirely clear how to express that as a Python type--perhaps tuples as keys?
{("temperature", 1000): [*times], ("temperature", 500): [*other_times]}
or actually is that the same as
{"temperature": {"1000": [*times], "500": [*other_times]}}
Ah I understand, it's two separate widgets simultaneously shown...
File Type + Variable -> Levels -> Times vs File Type -> Variable -> Levels -> Times
However, is it necessary to show both simultaneously?
If so, is it within the scope of this widget or separate?
Although this feature is already merged, I want to ask, if this could be extended to Multiselect.
Can we have something like a nested, n-dim select dropdown built-in to Panel widgets? (I vaguely remember seeing @jlstevens implement this somewhere?)
Not sure if it's enough to support just one level, but for multiple levels, I imagine a dict of dict of list?
{"precip": {"conus": [1000], "global": [1000]}, "temp": {"conus": [1000, 925, 700, 500, 300], "global": {"temp": [1000, 500]}}}
Here's an applicable example of multi-level dropdowns: