Skip to content

Commit

Permalink
fix panel input datetime.date to datetime.datetime, acceptable by numba
Browse files Browse the repository at this point in the history
  • Loading branch information
AjayThorve committed Feb 9, 2024
1 parent 0db558b commit 9e2913e
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions python/cuxfilter/charts/panel_widgets/plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,10 @@ def compute_query_dict(self, query_str_dict, query_local_variables_dict):
reference to dashboard.__cls__.query_dict
"""
if self.chart.value != (self.chart.start, self.chart.end):
min_temp, max_temp = (datetime.datetime.fromordinal(x.toordinal()) for x in self.chart.value)
min_temp, max_temp = (
datetime.datetime.fromordinal(x.toordinal())
for x in self.chart.value
)
query = f"@{self.x}_min<={self.x}<=@{self.x}_max"
query_str_dict[self.name] = query
query_local_variables_dict[self.x + "_min"] = min_temp
Expand Down Expand Up @@ -397,18 +400,12 @@ def compute_query_dict(self, query_str_dict, query_local_variables_dict):
if len(self.chart.value) == 0:
query_str_dict.pop(self.name, None)
else:
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))
query_str_dict[self.name] = self.source.str.contains(
"|".join(self.chart.value)
)
else:
query_str_dict[self.name] = df_module.DataFrame(
self.source.isin(self.chart.value)
)
query_str_dict[self.name] = self.source.isin(self.chart.value)

def apply_theme(self, theme):
"""
Expand Down

0 comments on commit 9e2913e

Please sign in to comment.