From bc073d73fea6c0dcb25abc496e030d64611b5cd8 Mon Sep 17 00:00:00 2001 From: Ajay Thorve Date: Wed, 16 Aug 2023 14:44:09 -0700 Subject: [PATCH] Add str support to dropdown (#529) This small PR adds str column support to `drop_down` and `multi_select` widgets, along with `charts.bar`, which already supports str columns directly since 23.08 ```python import cudf from cuxfilter import charts, DataFrame cux_df = DataFrame.from_dataframe(cudf.DataFrame({'val': ['A', 'B', 'C', 'D', 'E']})) multi_select = charts.multi_select('val') d = cux_df.dashboard([multi_select]) # View the individual multi_select chart part of the dashboard d multi_select.view(height=200) ``` ![image](https://github.com/rapidsai/cuxfilter/assets/20476096/5768f5ca-8915-410f-9d10-065b89cc94df) cc @exactlyallan Authors: - Ajay Thorve (https://github.com/AjayThorve) Approvers: - Allan (https://github.com/exactlyallan) URL: https://github.com/rapidsai/cuxfilter/pull/529 --- .../.doctrees/api_reference/dataframe.doctree | Bin 0 -> 89166 bytes docs/source/user_guide/charts/widgets.rst | 16 ++++----- python/cuxfilter/charts/core/core_widget.py | 2 +- .../core/non_aggregate/core_non_aggregate.py | 1 - .../charts/panel_widgets/panel_widgets.py | 12 +++---- .../cuxfilter/charts/panel_widgets/plots.py | 31 ++++++++++-------- .../tests/charts/core/test_core_widget.py | 2 +- 7 files changed, 33 insertions(+), 31 deletions(-) create mode 100644 docs/_html/.doctrees/api_reference/dataframe.doctree diff --git a/docs/_html/.doctrees/api_reference/dataframe.doctree b/docs/_html/.doctrees/api_reference/dataframe.doctree new file mode 100644 index 0000000000000000000000000000000000000000..7e3499fd5decb29d72478a97f5998b36337829c5 GIT binary patch literal 89166 zcmeHw3zQsJd8Quo(2QP|Y>jPXnUWt&&uC`!unqE9BO^aCGO}ZAFi1MBp6(h|mwLLJ z?rKS6aAKbTwxP%anjD@<*pnQRk*llk6r0Hsk>TC(GtZa3Ca`0NL-q zkGi+2t8Q2I^o(?Z1fK4$x{v>L|NGzn{`bF648D7A&Du5e&)?dtJLT&6nL?>lt(EL% z+uu;C6rG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UR8~k06%Ef#zKm!Ew%{s}*GyY}G zrK(prpLfcqoeKVg1P@edB>bD$J&F7(vL;A%xpr@2o-ITxFFxWxXGTQa zvUsLdM;BWFomck20j>$2f&A2p<>~^YK&l4BX%xL?Yd%u0yh!4UD_i(@9AHWbQnNU3 zmoSKzz+cC@qU4csr;Y(L)iw}+lqk#B}QMr#Yfk0BaF zCH8!n9`f%w_i~!hE~7uUVY+e;(w~j=a|8ag{1GZkS07PLUiukU@)=eN7gp}3=hT3+ ziPd(B&JQ}i`|tqTcpd$D6WyKgB>lN+1b=qXpZAR7&j;xbb>q@Z=^m#)r|8e^*gs-7 zBD$0gn&pgkDIXupOXyN&DVBc9rDL=%owar8c#2DBSX|m8WgDq3na3{K&@F$nE^>?p zn~P-#E)fxQ;ZI1n$a0+6`V(FbEP#kE&etk|6tkjNL>>mEM?x)*$X;2c?VyZORocOqgkh?-bA91wOr{{Sd}*z0iO*fGjj2wbWq_ zdtY0cOHB-U`B=@ugJSzD*sAice549}h#qjk6`k|UC5nD`8b zsj3MR-_0{i&uw?m?U~4K0%O$bnR?4;Ls9RA%+&i@R_eKbiyD$}xJOy657-u{Mz{_s r#Jp$w+XK@~Y9^*3HwKT{l(>;^8q*Yfnr6e%5?PPJ&>}t4nxFaq%ra8= literal 0 HcmV?d00001 diff --git a/docs/source/user_guide/charts/widgets.rst b/docs/source/user_guide/charts/widgets.rst index 4804948f..d1fb99e3 100644 --- a/docs/source/user_guide/charts/widgets.rst +++ b/docs/source/user_guide/charts/widgets.rst @@ -99,12 +99,12 @@ Example import cudf from cuxfilter import charts, DataFrame - cux_df = DataFrame.from_dataframe(cudf.DataFrame({'key': [0, 1, 2, 3, 4], 'val':[float(i + 10) for i in range(5)]})) - drop_down = charts.drop_down('val') + cux_df = DataFrame.from_dataframe(cudf.DataFrame({'val': ['A', 'B', 'C', 'D', 'E']})) + multi_select = charts.drop_down('val') - d = cux_df.dashboard([drop_down]) - #view the individual drop_down chart part of the dashboard d - drop_down.view() + d = cux_df.dashboard([multi_select]) + # View the individual multi_select chart part of the dashboard d + multi_select.view(height=200) Multiselect @@ -118,12 +118,12 @@ Example import cudf from cuxfilter import charts, DataFrame - cux_df = DataFrame.from_dataframe(cudf.DataFrame({'key': [0, 1, 2, 3, 4], 'val':[float(i + 10) for i in range(5)]})) + cux_df = DataFrame.from_dataframe(cudf.DataFrame({'val': ['A', 'B', 'C', 'D', 'E']})) multi_select = charts.multi_select('val') d = cux_df.dashboard([multi_select]) - #view the individual multi_select chart part of the dashboard d - multi_select.view() + # View the individual multi_select chart part of the dashboard d + multi_select.view(height=200) Number Chart diff --git a/python/cuxfilter/charts/core/core_widget.py b/python/cuxfilter/charts/core/core_widget.py index 3c41f024..d2cebc37 100644 --- a/python/cuxfilter/charts/core/core_widget.py +++ b/python/cuxfilter/charts/core/core_widget.py @@ -110,7 +110,7 @@ def _repr_mimebundle_(self, include=None, exclude=None): return None def view(self, width=400, height=10): - return pn.panel(self.chart, width=width, height=10) + return pn.Column(self.chart, width=width, height=height) def get_dashboard_view(self): return pn.panel(self.chart, sizing_mode="stretch_width") diff --git a/python/cuxfilter/charts/core/non_aggregate/core_non_aggregate.py b/python/cuxfilter/charts/core/non_aggregate/core_non_aggregate.py index 14b6e4f8..48bb8b1c 100644 --- a/python/cuxfilter/charts/core/non_aggregate/core_non_aggregate.py +++ b/python/cuxfilter/charts/core/non_aggregate/core_non_aggregate.py @@ -106,7 +106,6 @@ def cb(bounds, x_selection, y_selection): dashboard_cls._query_str_dict, dashboard_cls._query_local_variables_dict, ) - print("hello") # reload all charts with new queried data (cudf.DataFrame only) dashboard_cls._reload_charts() diff --git a/python/cuxfilter/charts/panel_widgets/panel_widgets.py b/python/cuxfilter/charts/panel_widgets/panel_widgets.py index a7aa4475..664bad98 100644 --- a/python/cuxfilter/charts/panel_widgets/panel_widgets.py +++ b/python/cuxfilter/charts/panel_widgets/panel_widgets.py @@ -28,7 +28,7 @@ def range_slider( ---------- x: str - column name from gpu dataframe + column name from gpu dataframe, dtype should be int or float data_points: int, default None when None, it means no custom number of bins are provided and @@ -64,7 +64,7 @@ def date_range_slider( ---------- x: str - column name from gpu dataframe + column name from gpu dataframe, dtype should be datetime data_points: int, default None when None, it means no custom number of bins are provided and @@ -99,7 +99,7 @@ def int_slider(x, data_points=None, step_size=1, **params): ---------- x: str - column name from gpu dataframe + column name from gpu dataframe, dtype should be int data_points: int, default None when None, it means no custom number of bins are provided and @@ -129,7 +129,7 @@ def float_slider(x, data_points=None, step_size=None, **params): ---------- x: str - column name from gpu dataframe + column name from gpu dataframe, dtype should be float data_points: int, default None when None, it means no custom number of bins are provided and @@ -165,7 +165,7 @@ def drop_down(x, **params): ---------- x: str - column name from gpu dataframe + column name from gpu dataframe, dtype [str, int, float] data_points: int, default number of unique values @@ -190,7 +190,7 @@ def multi_select(x, **params): ---------- x: str - column name from gpu dataframe + column name from gpu dataframe, dtype [str, int, float] data_points: int, default number of unique values diff --git a/python/cuxfilter/charts/panel_widgets/plots.py b/python/cuxfilter/charts/panel_widgets/plots.py index 22f7cc12..aadefb68 100644 --- a/python/cuxfilter/charts/panel_widgets/plots.py +++ b/python/cuxfilter/charts/panel_widgets/plots.py @@ -319,7 +319,7 @@ def compute_query_dict(self, query_str_dict, query_local_variables_dict): class MultiChoice(BaseWidget): - value = None + source = None def initiate_chart(self, dashboard_cls): """ @@ -328,16 +328,11 @@ def initiate_chart(self, dashboard_cls): self.min_value, self.max_value = get_min_max( dashboard_cls._cuxfilter_df.data, self.x ) - - if self.stride is None: - if self.max_value < 1 and self.stride_type == int: - self.stride_type = float - self.stride = self.stride_type(1) - + self.source = dashboard_cls._cuxfilter_df.data[self.x].reset_index( + drop=True + ) self.calc_list_of_values(dashboard_cls._cuxfilter_df.data) - self.generate_widget() - self.add_events(dashboard_cls) def calc_list_of_values(self, data): @@ -398,13 +393,21 @@ def compute_query_dict(self, query_str_dict, query_local_variables_dict): query_dict: reference to dashboard.__cls__.query_dict """ - if len(self.chart.value) == 0 or self.chart.value == [""]: + if len(self.chart.value) == 0: query_str_dict.pop(self.name, None) - elif len(self.chart.value) == 1: - query_str_dict[self.name] = f"{self.x}=={self.chart.value[0]}" else: - indices_string = ",".join(map(str, self.chart.value)) - query_str_dict[self.name] = f"{self.x} in ({indices_string})" + df_module = ( + cudf if isinstance(self.source, cudf.Series) else dask_cudf + ) + + if self.source.dtype == "object": + query_str_dict[self.name] = df_module.DataFrame( + self.source.str.contains("|".join(self.chart.value)) + ) + else: + query_str_dict[self.name] = df_module.DataFrame( + self.source.isin(self.chart.value) + ) def apply_theme(self, theme): """ diff --git a/python/cuxfilter/tests/charts/core/test_core_widget.py b/python/cuxfilter/tests/charts/core/test_core_widget.py index 2d0a3be0..fb25147a 100644 --- a/python/cuxfilter/tests/charts/core/test_core_widget.py +++ b/python/cuxfilter/tests/charts/core/test_core_widget.py @@ -31,7 +31,7 @@ def test_view(self, chart, _chart): bw = BaseWidget("test_x") bw.chart = chart - assert str(bw.view()) == str(pn.panel(_chart, width=400, height=10)) + assert str(bw.view()) == str(pn.Column(_chart, width=400, height=10)) def test_add_event(self): bw = BaseWidget("test_x")