Holoviews plotting issues
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 30/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- pandas, python
- Ambito
- data-visualization
Direzione di ricerca
Start in streamz/dataframe/holoviews.py, especially Series.plot and the converter entry point shown in the trace. Reproduce both grouped-series and grouped-dataframe bar plots from the issue, then inspect the plotting paths involved. Done means both examples produce working bar plots without the reported AttributeError or ambiguous DataFrame truth-value error.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Given this setup
import pandas as pd
from streamz.dataframe import DataFrame, Random
import streamz.dataframe.holoviews
df = pd.DataFrame({'x': [1, 2, 3], 'y': [4.5, 5, 6.5]},
pd.DatetimeIndex([1, 2, 3]))
sdf = DataFrame(example=df)
This fails because Series.plot doesn't support bar.
sdf.groupby('x').y.mean().plot.bar()
AttributeError Traceback (most recent call last)
<ipython-input-11-1265e5d0fb4f> in <module>()
----> 1 sdf.groupby('x').y.mean().plot.bar()
/home/mrocklin/workspace/streamz/streamz/dataframe/holoviews.py in bar(self, **kwds)
298 axes : matplotlib.AxesSubplot or np.array of them
299 """
--> 300 return self(kind='bar', **kwds)
301
302 def barh(self, **kwds):
/home/mrocklin/workspace/streamz/streamz/dataframe/holoviews.py in __call__(self, kind, width, height, backlog, use_index, title, grid, legend, logx, logy, loglog, xticks, yticks, xlim, ylim, rot, fontsize, colormap, table, yerr, xerr, **kwds)
256 xticks=xticks, yticks=yticks, xlim=xlim, ylim=ylim, rot=rot,
257 fontsize=fontsize, colormap=colormap, yerr=yerr, xerr=xerr, **kwds)
--> 258 return converter(kind)
259
260 def line(self, **kwds):
/home/mrocklin/workspace/streamz/streamz/dataframe/holoviews.py in __call__(self, kind)
177
178 def __call__(self, kind):
--> 179 return getattr(self, kind)()
180
181 def chart(self, chart):
AttributeError: 'HoloViewsSeriesConverter' object has no attribute 'bar'
When we do the same thing with a dataframe we get a different error:
sdf.groupby('x').mean().plot.bar()
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/home/mrocklin/Software/anaconda/lib/python3.6/site-packages/IPython/core/formatters.py in __call__(self, obj)
305 pass
306 else:
--> 307 return printer(obj)
308 # Finally look for special method names
309 method = get_real_method(obj, self.print_method)
/home/mrocklin/workspace/holoviews/holoviews/ipython/display_hooks.py in pprint_display(obj)
257 if not ip.display_formatter.formatters['text/plain'].pprint:
258 return None
--> 259 return display(obj, raw=True)
260
261
/home/mrocklin/workspace/holoviews/holoviews/ipython/display_hooks.py in display(obj, raw, **kwargs)
243 elif isinstance(obj, (HoloMap, DynamicMap)):
244 with option_state(obj):
--> 245 html = map_display(obj)
246 else:
247 return repr(obj) if raw else IPython.display.display(obj, **kwargs)
/home/mrocklin/workspace/holoviews/holoviews/ipython/display_hooks.py in wrapped(element)
130 try:
131 html = fn(element,
--> 132 max_frames=OutputSettings.options['max_frames'])
133
134 # Only want to add to the archive for one display hook...
/home/mrocklin/workspace/holoviews/holoviews/ipython/display_hooks.py in map_display(vmap, max_frames)
198 return None
199
--> 200 return render(vmap)
201
202
/home/mrocklin/workspace/holoviews/holoviews/ipython/display_hooks.py in render(obj, **kwargs)
60 if renderer.fig == 'pdf':
61 renderer = renderer.instance(fig='png')
---> 62 return renderer.html(obj, **kwargs)
63
64
/home/mrocklin/workspace/holoviews/holoviews/plotting/renderer.py in html(self, obj, fmt, css, comm, **kwargs)
256 code to initialize a Comm, if the plot supplies one.
257 """
--> 258 plot, fmt = self._validate(obj, fmt)
259 figdata, _ = self(plot, fmt, **kwargs)
260 if css is None: css = self.css
/home/mrocklin/workspace/holoviews/holoviews/plotting/renderer.py in _validate(self, obj, fmt)
192 if isinstance(obj, tuple(self.widgets.values())):
193 return obj, 'html'
--> 194 plot = self.get_plot(obj, renderer=self)
195
196 fig_formats = self.mode_formats['fig'][self.mode]
/home/mrocklin/workspace/holoviews/holoviews/plotting/bokeh/renderer.py in get_plot(self_or_cls, obj, doc, renderer)
115 combining the bokeh model with another plot.
116 """
--> 117 plot = super(BokehRenderer, self_or_cls).get_plot(obj, renderer)
118 if self_or_cls.mode == 'server' and doc is None:
119 doc = curdoc()
/home/mrocklin/workspace/holoviews/holoviews/plotting/renderer.py in get_plot(self_or_cls, obj, renderer)
164 """
165 # Initialize DynamicMaps with first data item
--> 166 initialize_dynamic(obj)
167 backend = self_or_cls.backend
168
/home/mrocklin/workspace/holoviews/holoviews/plotting/util.py in initialize_dynamic(obj)
179 continue
180 if not len(dmap):
--> 181 dmap[dmap._initial_key()]
182
183
/home/mrocklin/workspace/holoviews/holoviews/core/spaces.py in __getitem__(self, key)
1024 # Not a cross product and nothing cached so compute element.
1025 if cache is not None: return cache
-> 1026 val = self._execute_callback(*tuple_key)
1027 if data_slice:
1028 val = self._dataslice(val, data_slice)
/home/mrocklin/workspace/holoviews/holoviews/core/spaces.py in _execute_callback(self, *args)
840 kdims = [kdim.name for kdim in self.kdims]
841 kwarg_items = [s.contents.items() for s in self.streams]
--> 842 hash_items = tuple(tuple(sorted(s.hashkey.items())) for s in self.streams)+args
843 flattened = [(k,v) for kws in kwarg_items for (k,v) in kws
844 if k not in kdims]
/home/mrocklin/workspace/holoviews/holoviews/core/spaces.py in <genexpr>(.0)
840 kdims = [kdim.name for kdim in self.kdims]
841 kwarg_items = [s.contents.items() for s in self.streams]
--> 842 hash_items = tuple(tuple(sorted(s.hashkey.items())) for s in self.streams)+args
843 flattened = [(k,v) for kws in kwarg_items for (k,v) in kws
844 if k not in kdims]
/home/mrocklin/workspace/holoviews/holoviews/streams.py in hashkey(self)
388 @property
389 def hashkey(self):
--> 390 if self._memoize:
391 return self.contents
392 return {'hash': uuid.uuid4().hex}
/home/mrocklin/Software/anaconda/lib/python3.6/site-packages/pandas/core/generic.py in __nonzero__(self)
1119 raise ValueError("The truth value of a {0} is ambiguous. "
1120 "Use a.empty, a.bool(), a.item(), a.any() or a.all()."
-> 1121 .format(self.__class__.__name__))
1122
1123 __bool__ = __nonzero__
ValueError: The truth value of a DataFrame is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
Out[15]:
:DynamicMap []
In [12]:
I'm on my plot-holoviews branch. cc @philippjfr
- Lingua principale
- Python
- Stelle
- 1.3k
- Fork
- 149
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di python-streamz/streamz
-
pkg_resources warning Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
python-streamz/streamz#481 · 4 commenti ·
-
Combining the streamz.Stream.filenames() and streamz.Stream.from_textfile() using dask scatter? Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
python-streamz/streamz#480 · 2 commenti ·
-
Compile the code into c++ Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 20/100
python-streamz/streamz#479 · 1 commento ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 20/100
python-streamz/streamz#478 · 6 commenti ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 10/100
python-streamz/streamz#476 · 17 commenti · 2 reazioni ·
Tutte le issue di python-streamz/streamz
Issue simili
-
triage/confirmed
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
agentscope-ai/agentscope#2775 ·
-
comp/desktop P3 type/bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 92/100
NousResearch/hermes-agent#118866 ·
-
bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
apache/cloudstack#14222 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100