Skip to content

bug: error with the latest dev version AttributeError: 'list' object has no attribute 'dtype' #411

@syrte

Description

@syrte

Got error with the latest dev version:

fig, ax = pplt.subplot()
ax.plot(np.arange(10))

Traceback

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
/tmp/ipykernel_109695/309448141.py in <module>
      1 fig, ax = pplt.subplot()
----> 2 ax.plot(np.arange(10))

~/local/conda/envs/nemo/lib/python3.8/site-packages/proplot/internals/inputs.py in _preprocess_or_redirect(self, *args, **kwargs)
    292 
    293                 # Call main function
--> 294                 return func(self, *args, **kwargs)  # call unbound method
    295 
    296         return _preprocess_or_redirect

~/local/conda/envs/nemo/lib/python3.8/site-packages/proplot/axes/plot.py in plot(self, *args, **kwargs)
   2899         """
   2900         kwargs = _parse_vert(default_vert=True, **kwargs)
-> 2901         return self._apply_plot(*args, **kwargs)
   2902 
   2903     @inputs._preprocess_or_redirect('y', 'x', allow_extra=True)

~/local/conda/envs/nemo/lib/python3.8/site-packages/proplot/axes/plot.py in _apply_plot(self, vert, *pairs, **kwargs)
   2858             ys, kw = inputs._dist_reduce(ys, **kw)
   2859             guide_kw = _pop_params(kw, self._update_guide)  # after standardize
-> 2860             for _, n, x, y, kw in self._iter_arg_cols(xs, ys, **kw):
   2861                 kw = self._parse_cycle(n, **kw)
   2862                 *eb, kw = self._add_error_bars(x, y, vert=vert, default_barstds=True, **kw)  # noqa: E501

~/local/conda/envs/nemo/lib/python3.8/site-packages/proplot/axes/plot.py in _iter_arg_cols(self, label, labels, values, *args, **kwargs)
   4216             labels = [
   4217                 str(_not_none(label, ''))
-> 4218                 for label in inputs._to_numpy_array(labels)
   4219             ]
   4220         else:

~/local/conda/envs/nemo/lib/python3.8/site-packages/proplot/internals/inputs.py in _to_numpy_array(data, strip_units)
    131     elif isinstance(data, (DataFrame, Series, Index)):
    132         data = data.values
--> 133     if data.dtype == bool:
    134         data = data.view(np.uint8)
    135     if Quantity is not ndarray and isinstance(data, Quantity):

AttributeError: 'list' object has no attribute 'dtype'

debug

> ~/local/conda/envs/nemo/lib/python3.8/site-packages/proplot/internals/inputs.py(133)_to_numpy_array()
    131     elif isinstance(data, (DataFrame, Series, Index)):
    132         data = data.values
--> 133     if data.dtype == bool:
    134         data = data.view(np.uint8)
    135     if Quantity is not ndarray and isinstance(data, Quantity):

ipdb> p data
[None]

The error seems related to this PR #410.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions