Closed
Description
Code Sample, a copy-pastable example if possible
I'm getting an error when running:
pd.DataFrame.from_dict({'a': {0: 1., 2: "A"}}).to_html()
The traceback is:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-114-53996628e131> in <module>()
----> 1 pd.DataFrame.from_dict({'a': {0: 1., 2: "A"}}).to_html()
/Users/tdhopper/miniconda/envs/envname/lib/python2.7/site-packages/pandas/core/frame.pyc in to_html(self, buf, columns, col_space, colSpace, header, index, na_rep, formatters, float_format, sparsify, index_names, justify, bold_rows, classes, escape, max_rows, max_cols, show_dimensions, notebook, decimal)
1539 decimal=decimal)
1540 # TODO: a generic formatter wld b in DataFrameFormatter
-> 1541 formatter.to_html(classes=classes, notebook=notebook)
1542
1543 if buf is None:
/Users/tdhopper/miniconda/envs/envname/lib/python2.7/site-packages/pandas/core/format.pyc in to_html(self, classes, notebook)
667 notebook=notebook)
668 if hasattr(self.buf, 'write'):
--> 669 html_renderer.write_result(self.buf)
670 elif isinstance(self.buf, compat.string_types):
671 with open(self.buf, 'w') as f:
/Users/tdhopper/miniconda/envs/envname/lib/python2.7/site-packages/pandas/core/format.pyc in write_result(self, buf)
987 indent += self.indent_delta
988 indent = self._write_header(indent)
--> 989 indent = self._write_body(indent)
990
991 self.write('</table>', indent)
/Users/tdhopper/miniconda/envs/envname/lib/python2.7/site-packages/pandas/core/format.pyc in _write_body(self, indent)
1139 fmt_values = {}
1140 for i in range(min(len(self.columns), self.max_cols)):
-> 1141 fmt_values[i] = self.fmt._format_col(i)
1142
1143 # write values
/Users/tdhopper/miniconda/envs/envname/lib/python2.7/site-packages/pandas/core/format.pyc in _format_col(self, i)
650 return format_array(frame.iloc[:, i]._values, formatter,
651 float_format=self.float_format, na_rep=self.na_rep,
--> 652 space=self.col_space, decimal=self.decimal)
653
654 def to_html(self, classes=None, notebook=False):
/Users/tdhopper/miniconda/envs/envname/lib/python2.7/site-packages/pandas/core/format.pyc in format_array(values, formatter, float_format, na_rep, digits, space, justify, decimal)
2004 space=space, justify=justify, decimal=decimal)
2005
-> 2006 return fmt_obj.get_result()
2007
2008
/Users/tdhopper/miniconda/envs/envname/lib/python2.7/site-packages/pandas/core/format.pyc in get_result(self)
2023
2024 def get_result(self):
-> 2025 fmt_values = self._format_strings()
2026 return _make_fixed_width(fmt_values, self.justify)
2027
/Users/tdhopper/miniconda/envs/envname/lib/python2.7/site-packages/pandas/core/format.pyc in _format_strings(self)
2064 fmt_values.append(' %s' % _format(v))
2065 elif is_float[i]:
-> 2066 fmt_values.append(float_format(v))
2067 else:
2068 fmt_values.append(' %s' % _format(v))
TypeError: 'str' object is not callable
Expected Output
output of pd.show_versions()
INSTALLED VERSIONS
------------------
commit: None
python: 2.7.11.final.0
python-bits: 64
OS: Darwin
OS-release: 15.3.0
machine: x86_64
processor: i386
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
pandas: 0.18.0
nose: None
pip: 8.1.1
setuptools: 20.3
Cython: None
numpy: 1.10.4
scipy: 0.17.0
statsmodels: None
xarray: None
IPython: 4.1.2
sphinx: None
patsy: None
dateutil: 2.5.0
pytz: 2016.1
blosc: None
bottleneck: None
tables: None
numexpr: None
matplotlib: 1.5.1
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: None
httplib2: None
apiclient: None
sqlalchemy: 1.0.12
pymysql: None
psycopg2: None
jinja2: 2.8
boto: None
In [89]:
Metadata
Metadata
Assignees
Labels
No labels