Note that there are some explanatory texts on larger screens.

plurals
  1. POBar chart in pandas on time series data
    primarykey
    data
    text
    <p>I am trying to do bar chart in pandas on time series data.</p> <p>Documentation says it is not possible: <a href="http://pandas.pydata.org/pandas-docs/stable/visualization.html#bar-plots" rel="nofollow">http://pandas.pydata.org/pandas-docs/stable/visualization.html#bar-plots</a></p> <p>Is there some workaround ?</p> <p>This is my code </p> <pre><code># there must be ORDER BY, other wise rows will not be ordered df = sql.read_frame("SELECT * FROM hzmo_report ORDER BY datum;", cnx, index_col='datum') df.index = pd.to_datetime(df.index) # converting to DatetimeIndex df['korisnika'].plot(ax=axs1[0], title='SOMETHING', marker='o') df['korisnika'].diff().plot(ax=axs1[1], title='SOMETHING', marker='o') # i would like this to be bar plot </code></pre> <p>If I do </p> <pre><code>df['korisnika'].diff().plot(kind='bar', ax=axs1[1], title='SOMETHING', marker='o') </code></pre> <p>I have just added kind='bar'</p> <p>I get:</p> <pre><code>--------------------------------------------------------------------------- AttributeError Traceback (most recent call last) &lt;ipython-input-109-d41eb2b2e3a7&gt; in &lt;module&gt;() 36 fig1.suptitle('Umirovljenici', fontsize=16) 37 df['korisnika'].plot(ax=axs1[0], title='Broj korisnika mirovine', marker='o') ---&gt; 38 ( df['korisnika'].diff() ).plot(ax=axs1[1], kind='bar', title='Apsolutna razlika naspram prethodnog mjeseca', marker='o') 39 #df['korisnika'].diff().hist() 40 C:\Documents and Settings\hr1ub098\Application Data\Python\Python27\site-packages\pandas\tools\plotting.pyc in plot_series(series, label, kind, use_index, rot, xticks, yticks, xlim, ylim, ax, style, grid, legend, logy, secondary_y, **kwds) 1504 secondary_y=secondary_y, **kwds) 1505 -&gt; 1506 plot_obj.generate() 1507 plot_obj.draw() 1508 C:\Documents and Settings\hr1ub098\Application Data\Python\Python27\site-packages\pandas\tools\plotting.pyc in generate(self) 731 self._compute_plot_data() 732 self._setup_subplots() --&gt; 733 self._make_plot() 734 self._post_plot_logic() 735 self._adorn_subplots() C:\Documents and Settings\hr1ub098\Application Data\Python\Python27\site-packages\pandas\tools\plotting.pyc in _make_plot(self) 1291 else: 1292 rect = bar_f(ax, self.ax_pos + i * 0.75 / K, y, 0.75 / K, -&gt; 1293 start=pos_prior, label=label, **kwds) 1294 rects.append(rect) 1295 labels.append(label) C:\Documents and Settings\hr1ub098\Application Data\Python\Python27\site-packages\pandas\tools\plotting.pyc in f(ax, x, y, w, start, **kwds) 1251 if self.kind == 'bar': 1252 def f(ax, x, y, w, start=None, **kwds): -&gt; 1253 return ax.bar(x, y, w, bottom=start, **kwds) 1254 elif self.kind == 'barh': 1255 def f(ax, x, y, w, start=None, **kwds): C:\Documents and Settings\hr1ub098\Application Data\Python\Python27\site-packages\matplotlib\axes.pyc in bar(self, left, height, width, bottom, **kwargs) 4779 label='_nolegend_' 4780 ) -&gt; 4781 r.update(kwargs) 4782 r.get_path()._interpolation_steps = 100 4783 #print r.get_label(), label, 'label' in kwargs C:\Documents and Settings\hr1ub098\Application Data\Python\Python27\site-packages\matplotlib\artist.pyc in update(self, props) 657 func = getattr(self, 'set_'+k, None) 658 if func is None or not callable(func): --&gt; 659 raise AttributeError('Unknown property %s'%k) 660 func(v) 661 changed = True AttributeError: Unknown property marker </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload