vaex icon indicating copy to clipboard operation
vaex copied to clipboard

POC: Feat plotly express support

Open maartenbreddels opened this issue 5 years ago • 0 comments

Proof of concept, requires this patch to plotly:

diff --git a/packages/python/plotly/_plotly_utils/basevalidators.py b/packages/python/plotly/_plotly_utils/basevalidators.py
index 0ade83a95..0065125ec 100644
--- a/packages/python/plotly/_plotly_utils/basevalidators.py
+++ b/packages/python/plotly/_plotly_utils/basevalidators.py
@@ -75,6 +75,7 @@ def copy_to_readonly_numpy_array(v, kind=None, force_numeric=False):
     """
     np = get_module("numpy")
     pd = get_module("pandas")
+    vaex = get_module("vaex")
     assert np is not None

     # ### Process kind ###
@@ -89,6 +90,9 @@ def copy_to_readonly_numpy_array(v, kind=None, force_numeric=False):
     numeric_kinds = {"u", "i", "f"}
     kind_default_dtypes = {"u": "uint32", "i": "int32", "f": "float64", "O": "object"}

+    # Handle vaex expressions
+    if vaex and isinstance(v, vaex.expression.Expression):
+        v = v.values
     # Handle pandas Series and Index objects
     if pd and isinstance(v, (pd.Series, pd.Index)):
         if v.dtype.kind in numeric_kinds:
@@ -168,10 +172,12 @@ def is_homogeneous_array(v):
     """
     np = get_module("numpy")
     pd = get_module("pandas")
+    vaex = get_module("vaex")
     if (
         np
         and isinstance(v, np.ndarray)
         or (pd and isinstance(v, (pd.Series, pd.Index)))
+        or (vaex and isinstance(v, (vaex.expression.Expression)))
     ):
         return True
     if is_numpy_convertable(v):

But it works :) image

maartenbreddels avatar Aug 22 '19 19:08 maartenbreddels