BUG: in HTMLFormatter._write_header(), str() fails on column names in unicode · Issue #6098 · pandas-dev/pandas (original) (raw)

IPython snippet reproducing the problem

import pandas as pd import numpy as np df = pd.DataFrame({u'clé1': [u'a', u'a', u'b', u'b', u'a'], u'clé2': [u'1er', u'2ème', u'1er', u'2ème', u'1er'], 'données1': np.random.randn(5), 'données2': np.random.randn(5)}) df.pivot_table(rows=[u'clé1'], cols=[u'clé2'])

INSTALLED VERSIONS

Python: 2.7.5.final.0
OS: Linux
Release: 2.6.32-358.14.1.el6.x86_64
Processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8

pandas: 0.13.0
Cython: 0.19.2
Numpy: 1.8.0
Scipy: Not installed
statsmodels: Not installed
patsy: Not installed
scikits.timeseries: Not installed
dateutil: 2.2
pytz: 2013.9
bottleneck: Not installed
PyTables: Not Installed
numexpr: Not Installed
matplotlib: Not installed
openpyxl: Not installed
xlrd: 0.9.2
xlwt: 0.7.5
xlsxwriter: Not installed
sqlalchemy: Not installed
lxml: 3.2.5
bs4: Not installed
html5lib: Not installed
bigquery: Not installed
apiclient: Not installed

Expected behavior

HTML formatted table.

Seen instead

Warning message in IPython:

WARNING: Exception in text/html formatter: 'ascii' codec can't encode character u'\xe9' in position 2: ordinal not in range(128)