Styler.format(formatter, subset=None) Format the text display value of cells.
New in version 0.18.0.
| Parameters: |
formatter: str, callable, or dict subset: IndexSlice An argument to |
|---|---|
| Returns: |
self : Styler |
formatter is either an a or a dict {column name: a} where a is one of
a.format(x)
The default display value for numeric values is the “general” (g) format with pd.options.display.precision precision.
>>> df = pd.DataFrame(np.random.randn(4, 2), columns=['a', 'b'])
>>> df.style.format("{:.2%}")
>>> df['c'] = ['a', 'b', 'c', 'd']
>>> df.style.format({'C': str.upper})
© 2011–2012 Lambda Foundry, Inc. and PyData Development Team
© 2008–2011 AQR Capital Management, LLC
© 2008–2014 the pandas development team
Licensed under the 3-clause BSD License.
http://pandas.pydata.org/pandas-docs/version/0.18.1/generated/pandas.formats.style.Styler.format.html