错误熊猫情节

时间:2014-03-25 10:47:50

标签: python pandas time-series

当我想要策划一个时间表时,我遇到了一个奇怪的问题。这是我第一次遇到这种错误。

我可以打印时间表,但是当我想要绘制它时我有问题。

有人知道如何更正吗?

>>> df.head(35)
DATES
2015-01-01    0.002587
2015-01-02    0.003685
2015-01-03    0.003369
2015-01-04    0.002586
2015-01-05    0.002586
2015-01-06    0.002586
2015-01-07    0.003684
2015-01-08    0.003684
2015-01-09    0.003684
2015-01-10    0.003369
2015-01-11    0.002586
2015-01-12    0.003684
2015-01-13    0.003684
2015-01-14    0.003684
2015-01-15    0.003684
2015-01-16    0.003684
2015-01-17    0.003369
2015-01-18    0.002586
2015-01-19    0.003684
2015-01-20    0.003684
2015-01-21    0.003684
2015-01-22    0.003684
2015-01-23    0.003684
2015-01-24    0.003369
2015-01-25    0.002586
2015-01-26    0.003684
2015-01-27    0.003684
2015-01-28    0.003684
2015-01-29    0.003684
2015-01-30    0.003684
2015-01-31    0.003369
2015-02-01    0.002586
2015-02-02    0.003684
2015-02-03    0.003684
2015-02-04    0.003684
Freq: D, dtype: float64
>>> df.head(35).plot()
<matplotlib.axes.AxesSubplot object at 0x06F7E3D0>
>>> Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\matplotlib\backends\backend_qt4.py", line 374, in     idle_draw
    self.draw()
  File "C:\Python27\lib\site-packages\matplotlib\backends\backend_qt4agg.py", line 148,     in draw
    FigureCanvasAgg.draw(self)
  File "C:\Python27\lib\site-packages\matplotlib\backends\backend_agg.py", line 451, in     draw
    self.figure.draw(self.renderer)
  File "C:\Python27\lib\site-packages\matplotlib\artist.py", line 54, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "C:\Python27\lib\site-packages\matplotlib\figure.py", line 1034, in draw
    func(*args)
  File "C:\Python27\lib\site-packages\matplotlib\artist.py", line 54, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "C:\Python27\lib\site-packages\matplotlib\axes.py", line 2086, in draw
    a.draw(renderer)
  File "C:\Python27\lib\site-packages\matplotlib\artist.py", line 54, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "C:\Python27\lib\site-packages\matplotlib\axis.py", line 1087, in draw
    ticks_to_draw = self._update_ticks(renderer)
  File "C:\Python27\lib\site-packages\matplotlib\axis.py", line 945, in _update_ticks
    tick_tups = [t for t in self.iter_ticks()]
  File "C:\Python27\lib\site-packages\matplotlib\axis.py", line 893, in iter_ticks
    for i, val in enumerate(majorLocs)]
  File "C:\Python27\lib\site-packages\pandas\tseries\converter.py", line 973, in     __call__
    return Period(ordinal=int(x), freq=self.freq).strftime(fmt)
  File "C:\Python27\lib\site-packages\pandas\tseries\period.py", line 427, in strftime
    return tslib.period_format(self.ordinal, base, fmt)
  File "tslib.pyx", line 2357, in pandas.tslib.period_format (pandas\tslib.c:34856)
  File "tslib.pyx", line 2412, in pandas.tslib._period_strftime (pandas\tslib.c:35375)
  File "C:\Python27\lib\encodings\utf_8.py", line 16, in decode
    return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xe9 in position 3: invalid     continuation byte
Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\matplotlib\backends\backend_qt4.py", line 299, in     resizeEvent
    self.draw()
  File "C:\Python27\lib\site-packages\matplotlib\backends\backend_qt4agg.py", line 148,     in draw
    FigureCanvasAgg.draw(self)
  File "C:\Python27\lib\site-packages\matplotlib\backends\backend_agg.py", line 451, in     draw
    self.figure.draw(self.renderer)
  File "C:\Python27\lib\site-packages\matplotlib\artist.py", line 54, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "C:\Python27\lib\site-packages\matplotlib\figure.py", line 1034, in draw
    func(*args)
  File "C:\Python27\lib\site-packages\matplotlib\artist.py", line 54, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "C:\Python27\lib\site-packages\matplotlib\axes.py", line 2086, in draw
    a.draw(renderer)
  File "C:\Python27\lib\site-packages\matplotlib\artist.py", line 54, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "C:\Python27\lib\site-packages\matplotlib\axis.py", line 1087, in draw
    ticks_to_draw = self._update_ticks(renderer)
  File "C:\Python27\lib\site-packages\matplotlib\axis.py", line 945, in _update_ticks
    tick_tups = [t for t in self.iter_ticks()]
  File "C:\Python27\lib\site-packages\matplotlib\axis.py", line 893, in iter_ticks
    for i, val in enumerate(majorLocs)]
  File "C:\Python27\lib\site-packages\pandas\tseries\converter.py", line 973, in     __call__
    return Period(ordinal=int(x), freq=self.freq).strftime(fmt)
  File "C:\Python27\lib\site-packages\pandas\tseries\period.py", line 427, in strftime
    return tslib.period_format(self.ordinal, base, fmt)
  File "tslib.pyx", line 2357, in pandas.tslib.period_format (pandas\tslib.c:34856)
  File "tslib.pyx", line 2412, in pandas.tslib._period_strftime (pandas\tslib.c:35375)
  File "C:\Python27\lib\encodings\utf_8.py", line 16, in decode
    return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xe9 in position 3: invalid     continuation byte

0 个答案:

没有答案