Skip to content

Commit

Permalink
Fix handling of string dtypes for Perspective (#5467)
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr authored Sep 1, 2023
1 parent 4c716bb commit 6bc3a07
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions panel/pane/perspective.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from ..io.resources import CDN_DIST
from ..io.state import state
from ..reactive import ReactiveData
from ..util import lazy_load
from ..util import datetime_types, lazy_load
from ..viewable import Viewable
from .base import ModelPane

Expand Down Expand Up @@ -387,23 +387,23 @@ def _get_properties(self, doc, source=None):
for col, array in source.data.items():
if not isinstance(array, np.ndarray):
array = np.asarray(array)
kind = array.dtype.kind.lower()
if kind == 'm':
kind = array.dtype.kind
if kind == 'M':
schema[col] = 'datetime'
elif kind in 'ui':
schema[col] = 'integer'
elif kind == 'b':
schema[col] = 'boolean'
elif kind == 'f':
schema[col] = 'float'
elif kind == 'su':
elif kind in 'sU':
schema[col] = 'string'
else:
if len(array):
value = array[0]
if isinstance(value, dt.date):
schema[col] = 'date'
elif isinstance(value, dt.datetime):
elif isinstance(value, datetime_types):
schema[col] = 'datetime'
elif isinstance(value, str):
schema[col] = 'string'
Expand Down

0 comments on commit 6bc3a07

Please sign in to comment.