8
8
from copy import deepcopy
9
9
10
10
import numpy as np
11
+ import pandas as pd
11
12
import re
12
13
13
14
# Utility functions
@@ -19,6 +20,7 @@ def copy_to_contiguous_readonly_numpy_array(v, dtype=None, force_numeric=False):
19
20
# If dtype was not specified then it will be passed to the numpy array constructor as None and the data type
20
21
# will be inferred automatically
21
22
23
+ # TODO: support datetime dtype here and in widget serialization
22
24
numeric_kinds = ['u' , 'i' , 'f' ]
23
25
24
26
if not isinstance (v , np .ndarray ):
@@ -28,7 +30,7 @@ def copy_to_contiguous_readonly_numpy_array(v, dtype=None, force_numeric=False):
28
30
else :
29
31
new_v = v .copy ()
30
32
31
- # Handle force numeric param
33
+ # Handle force numeric param
32
34
# --------------------------
33
35
if force_numeric and new_v .dtype .kind not in numeric_kinds : # (un)signed int, or float
34
36
raise ValueError ('Input value is not numeric and force_numeric parameter set to True' )
@@ -55,7 +57,9 @@ def copy_to_contiguous_readonly_numpy_array(v, dtype=None, force_numeric=False):
55
57
56
58
57
59
def is_array (v ):
58
- return isinstance (v , (list , tuple )) or (isinstance (v , np .ndarray ) and v .ndim == 1 )
60
+ return (isinstance (v , (list , tuple )) or
61
+ (isinstance (v , np .ndarray ) and v .ndim == 1 ) or
62
+ isinstance (v , pd .Series ))
59
63
60
64
61
65
def type_str (v ):
0 commit comments