Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt711 committed Aug 8, 2024
1 parent 4fc4951 commit 1b2ba85
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 11 deletions.
2 changes: 1 addition & 1 deletion python/cuxfilter/charts/bokeh/plots/bar.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class InteractiveBar(param.Parameterized):
x = param.String("x", doc="x axis column name")
y = param.List(["y"], doc="y axis column names as a list")
source_df = param.ClassSelector(
class_=cudf.DataFrame, default=cudf.DataFrame(), doc="source dataframe"
class_=(cudf.DataFrame, pd.DataFrame), default=cudf.DataFrame(), doc="source dataframe"
)
box_stream = param.ClassSelector(
class_=hv.streams.SelectionXY, default=hv.streams.SelectionXY()
Expand Down
5 changes: 3 additions & 2 deletions python/cuxfilter/charts/core/core_chart.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import cudf
import pandas as pd
import dask_cudf
import logging
import panel as pn
Expand Down Expand Up @@ -61,15 +62,15 @@ def library_specific_params(self):
def x_dtype(self):
if isinstance(self.source, ColumnDataSource):
return self.source.data[self.data_x_axis].dtype
elif isinstance(self.source, (cudf.DataFrame, dask_cudf.DataFrame)):
elif isinstance(self.source, (cudf.DataFrame, dask_cudf.DataFrame, pd.DataFrame)):
return self.source[self.x].dtype
return None

@property
def y_dtype(self):
if isinstance(self.source, ColumnDataSource):
return self.source.data[self.data_x_axis].dtype
elif isinstance(self.source, (cudf.DataFrame, dask_cudf.DataFrame)):
elif isinstance(self.source, (cudf.DataFrame, dask_cudf.DataFrame, pd.DataFrame)):
return self.source[self.y].dtype
return None

Expand Down
5 changes: 3 additions & 2 deletions python/cuxfilter/charts/core/non_aggregate/core_graph.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from typing import Tuple
import cudf
import pandas as pd
import dask.dataframe as dd
import dask_cudf
import panel as pn
Expand Down Expand Up @@ -169,13 +170,13 @@ def __init__(

@property
def x_dtype(self):
if isinstance(self.nodes, (cudf.DataFrame, dask_cudf.DataFrame)):
if isinstance(self.nodes, (cudf.DataFrame, dask_cudf.DataFrame, pd.DataFrame)):
return self.nodes[self.node_x].dtype
return None

@property
def y_dtype(self):
if isinstance(self.nodes, (cudf.DataFrame, dask_cudf.DataFrame)):
if isinstance(self.nodes, (cudf.DataFrame, dask_cudf.DataFrame, pd.DataFrame)):
return self.nodes[self.node_y].dtype
return None

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import cudf
import pandas as pd
import dask_cudf
from typing import Tuple
import panel as pn
Expand Down Expand Up @@ -30,7 +31,7 @@ def y_dtype(self):
overwriting the y_dtype property from BaseChart for stackedLines where
self.y is a list of columns
"""
if isinstance(self.source, (cudf.DataFrame, dask_cudf.DataFrame)):
if isinstance(self.source, (cudf.DataFrame, dask_cudf.DataFrame, pd.DataFrame)):
return self.source[self.y[0]].dtype
return None

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import requests
from PIL import Image
from io import BytesIO
import pandas as pd


def load_image(url):
Expand Down Expand Up @@ -180,7 +181,7 @@ def add_reset_event(self, callback_fn):

class InteractiveDatashader(InteractiveDatashaderBase):
source_df = param.ClassSelector(
class_=(cudf.DataFrame, dask_cudf.DataFrame),
class_=(cudf.DataFrame, dask_cudf.DataFrame, pd.DataFrame),
doc="source cuDF/dask_cuDF dataframe",
)
x = param.String("x")
Expand Down Expand Up @@ -498,11 +499,11 @@ def view(self):

class InteractiveDatashaderGraph(InteractiveDatashaderBase):
nodes_df = param.ClassSelector(
class_=(cudf.DataFrame, dask_cudf.DataFrame),
class_=(cudf.DataFrame, dask_cudf.DataFrame, pd.DataFrame),
doc="nodes cuDF/dask_cuDF dataframe",
)
edges_df = param.ClassSelector(
class_=(cudf.DataFrame, dask_cudf.DataFrame),
class_=(cudf.DataFrame, dask_cudf.DataFrame, pd.DataFrame),
doc="edges cuDF/dask_cuDF dataframe",
)
node_x = param.String("x")
Expand Down
3 changes: 2 additions & 1 deletion python/cuxfilter/charts/datashader/plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import dask.dataframe as dd
import cupy as cp
import cudf
import pandas as pd
import holoviews as hv
from bokeh import events
from PIL import Image
Expand Down Expand Up @@ -145,7 +146,7 @@ def format_source_data(self, dataframe):
Ouput:
"""
if isinstance(dataframe, cudf.DataFrame):
if isinstance(dataframe, (cudf.DataFrame, pd.DataFrame)):
self.nodes = dataframe
else:
self.nodes = dataframe.data
Expand Down
3 changes: 2 additions & 1 deletion python/cuxfilter/charts/panel_widgets/plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from ...assets.cudf_utils import get_min_max
from bokeh.models import ColumnDataSource
import cudf
import pandas as pd
import dask_cudf
import panel as pn
import uuid
Expand Down Expand Up @@ -88,7 +89,7 @@ class DateRangeSlider(BaseWidget):
def x_dtype(self):
if isinstance(self.source, ColumnDataSource):
return self.source.data[self.data_x_axis].dtype
elif isinstance(self.source, (cudf.DataFrame, dask_cudf.DataFrame)):
elif isinstance(self.source, (cudf.DataFrame, dask_cudf.DataFrame, pd.DataFrame)):
return self.source[self.x].dtype
return None

Expand Down

0 comments on commit 1b2ba85

Please sign in to comment.