Skip to content

plotting._stringify not unicode safe #1685

Closed
JoeGermuska opened this Issue Jul 26, 2012 · 2 comments

3 participants

@JoeGermuska

/Users/germuska/.virtualenvs/data/lib/python2.6/site-packages/pandas/tools/plotting.pyc in _stringify(x)
1073 return '|'.join(str(y) for y in x)
1074 else:
-> 1075 return str(x)
1076
1077

UnicodeEncodeError: 'ascii' codec can't encode character u'\u2019' in position 1: ordinal not in range(128)

If labels can't be unicode, perhaps can a clearer error be thrown?

@changhiskhan
Python for Data member

Matplotlib supports unicode so we don't have to limit pandas plotting functions either I think.
Would you be interested in making a pull request on this? You can use the stringify functionality in pandas.core.common as a reference

@lodagro
Python for Data member
lodagro commented Aug 6, 2012

fixed

In [13]: df
Out[13]: 
c0     bar   
c1       Δ  Ε
i0 i1        
α  0     8  5
   1     6  5
β  2     2  4
   3     8  7
γ  4     1  8
   5     7  7
δ  6     9  3
   7     5  7

In [14]: df.plot(title=u'\u03A3')
Out[14]: <matplotlib.axes.AxesSubplot at 0xa01cbac>

plot

@lodagro lodagro closed this in be94b91 Aug 6, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.