Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plotting datetime x axis -> NameError: name 'pandas_datetime_types' is not defined #5046

Closed
N4321D opened this issue Jul 28, 2021 · 2 comments

Comments

@N4321D
Copy link

N4321D commented Jul 28, 2021

plotting lines with datetime x axis produces a NameError since
version '1.14.4' :

It is also visible in the docs at the Datetime axes section:
http://dev.holoviews.org/user_guide/Customizing_Plots.html
image

full traceback

---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
~/anaconda3/lib/python3.8/site-packages/IPython/core/formatters.py in __call__(self, obj, include, exclude)
    968 
    969             if method is not None:
--> 970                 return method(include=include, exclude=exclude)
    971             return None
    972         else:

~/anaconda3/lib/python3.8/site-packages/panel/viewable.py in _repr_mimebundle_(self, include, exclude)
    614         doc = _Document()
    615         comm = state._comm_manager.get_server_comm()
--> 616         model = self._render_model(doc, comm)
    617         ref = model.ref['id']
    618         manager = CommManager(comm_id=comm.id, plot_id=ref)

~/anaconda3/lib/python3.8/site-packages/panel/viewable.py in _render_model(self, doc, comm)
    453         if comm is None:
    454             comm = state._comm_manager.get_server_comm()
--> 455         model = self.get_root(doc, comm)
    456 
    457         if config.embed:

~/anaconda3/lib/python3.8/site-packages/panel/viewable.py in get_root(self, doc, comm, preprocess)
    510         """
    511         doc = init_doc(doc)
--> 512         root = self._get_model(doc, comm=comm)
    513         if preprocess:
    514             self._preprocess(root)

~/anaconda3/lib/python3.8/site-packages/panel/layout/base.py in _get_model(self, doc, root, parent, comm)
    120         if root is None:
    121             root = model
--> 122         objects = self._get_objects(model, [], doc, root, comm)
    123         props = dict(self._init_params(), objects=objects)
    124         model.update(**self._process_param_change(props))

~/anaconda3/lib/python3.8/site-packages/panel/layout/base.py in _get_objects(self, model, old_objects, doc, root, comm)
    110             else:
    111                 try:
--> 112                     child = pane._get_model(doc, root, model, comm)
    113                 except RerenderError:
    114                     return self._get_objects(model, current_objects[:i], doc, root, comm)

~/anaconda3/lib/python3.8/site-packages/panel/param.py in _get_model(self, doc, root, parent, comm)
    802         if not self._evaled:
    803             self._replace_pane(force=True)
--> 804         return super()._get_model(doc, root, parent, comm)
    805 
    806     #----------------------------------------------------------------

~/anaconda3/lib/python3.8/site-packages/panel/pane/base.py in _get_model(self, doc, root, parent, comm)
    416             if ref in self._models:
    417                 self._cleanup(root)
--> 418         model = self._inner_layout._get_model(doc, root, parent, comm)
    419         if root is None:
    420             ref = model.ref['id']

~/anaconda3/lib/python3.8/site-packages/panel/layout/base.py in _get_model(self, doc, root, parent, comm)
    120         if root is None:
    121             root = model
--> 122         objects = self._get_objects(model, [], doc, root, comm)
    123         props = dict(self._init_params(), objects=objects)
    124         model.update(**self._process_param_change(props))

~/anaconda3/lib/python3.8/site-packages/panel/layout/base.py in _get_objects(self, model, old_objects, doc, root, comm)
    110             else:
    111                 try:
--> 112                     child = pane._get_model(doc, root, model, comm)
    113                 except RerenderError:
    114                     return self._get_objects(model, current_objects[:i], doc, root, comm)

~/anaconda3/lib/python3.8/site-packages/panel/pane/holoviews.py in _get_model(self, doc, root, parent, comm)
    237             plot = self.object
    238         else:
--> 239             plot = self._render(doc, comm, root)
    240 
    241         plot.pane = self

~/anaconda3/lib/python3.8/site-packages/panel/pane/holoviews.py in _render(self, doc, comm, root)
    304                 kwargs['comm'] = comm
    305 
--> 306         return renderer.get_plot(self.object, **kwargs)
    307 
    308     def _cleanup(self, root):

~/anaconda3/lib/python3.8/site-packages/holoviews/plotting/bokeh/renderer.py in get_plot(self_or_cls, obj, doc, renderer, **kwargs)
     71         combining the bokeh model with another plot.
     72         """
---> 73         plot = super(BokehRenderer, self_or_cls).get_plot(obj, doc, renderer, **kwargs)
     74         if plot.document is None:
     75             plot.document = Document() if self_or_cls.notebook_context else curdoc()

~/anaconda3/lib/python3.8/site-packages/holoviews/plotting/renderer.py in get_plot(self_or_cls, obj, doc, renderer, comm, **kwargs)
    236             if isinstance(obj, AdjointLayout):
    237                 obj = Layout(obj)
--> 238             plot = self_or_cls.plotting_class(obj)(obj, renderer=renderer,
    239                                                    **plot_opts)
    240             defaults = [kd.default for kd in plot.dimensions]

~/anaconda3/lib/python3.8/site-packages/holoviews/plotting/bokeh/plot.py in __init__(self, layout, keys, **params)
    706     def __init__(self, layout, keys=None, **params):
    707         super(LayoutPlot, self).__init__(layout, keys=keys, **params)
--> 708         self.layout, self.subplots, self.paths = self._init_layout(layout)
    709         if self.top_level:
    710             self.traverse(lambda x: attach_streams(self, x.hmap, 2),

~/anaconda3/lib/python3.8/site-packages/holoviews/plotting/bokeh/plot.py in _init_layout(self, layout)
    718         frame_ranges = self.compute_ranges(layout, None, None)
    719         keys = self.keys[:1] if self.dynamic else self.keys
--> 720         frame_ranges = OrderedDict([(key, self.compute_ranges(layout, key, frame_ranges))
    721                                     for key in keys])
    722         layout_items = layout.grid_items()

~/anaconda3/lib/python3.8/site-packages/holoviews/plotting/bokeh/plot.py in <listcomp>(.0)
    718         frame_ranges = self.compute_ranges(layout, None, None)
    719         keys = self.keys[:1] if self.dynamic else self.keys
--> 720         frame_ranges = OrderedDict([(key, self.compute_ranges(layout, key, frame_ranges))
    721                                     for key in keys])
    722         layout_items = layout.grid_items()

~/anaconda3/lib/python3.8/site-packages/holoviews/plotting/plot.py in compute_ranges(self, obj, key, ranges)
    636             if (not (axiswise and not isinstance(obj, HoloMap)) or
    637                 (not framewise and isinstance(obj, HoloMap))):
--> 638                 self._compute_group_range(group, elements, ranges, framewise,
    639                                           axiswise, robust, self.top_level,
    640                                           prev_frame)

~/anaconda3/lib/python3.8/site-packages/holoviews/plotting/plot.py in _compute_group_range(cls, group, elements, ranges, framewise, axiswise, robust, top_level, prev_frame)
    853                     continue
    854                 matching &= (
--> 855                     len({'date' if isinstance(v, util.datetime_types) else 'number'
    856                          for rng in rs for v in rng if util.isfinite(v)}) < 2
    857                 )

~/anaconda3/lib/python3.8/site-packages/holoviews/plotting/plot.py in <setcomp>(.0)
    854                 matching &= (
    855                     len({'date' if isinstance(v, util.datetime_types) else 'number'
--> 856                          for rng in rs for v in rng if util.isfinite(v)}) < 2
    857                 )
    858             if matching:

~/anaconda3/lib/python3.8/site-packages/holoviews/core/util.py in isfinite(val)
    902         return finite
    903     elif isinstance(val, datetime_types+timedelta_types):
--> 904         return not isnat(val)
    905     elif isinstance(val, (basestring, bytes)):
    906         return True

~/anaconda3/lib/python3.8/site-packages/holoviews/core/util.py in isnat(val)
    866     elif pd and val is pd.NaT:
    867         return True
--> 868     elif pd and isinstance(val, pandas_datetime_types+pandas_timedelta_types):
    869         return pd.isna(val)
    870     else:

NameError: name 'pandas_datetime_types' is not defined
@N4321D N4321D closed this as completed Jul 28, 2021
@N4321D
Copy link
Author

N4321D commented Jul 28, 2021

related to:
#5009

Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant