pandas.io.formats.style.Styler.bar¶
-
Styler.
bar
(subset=None, axis=0, color='#d65f5f', width=100, align='left')[source]¶ Color the background
color
proptional to the values in each column. Excludes non-numeric data by default.New in version 0.17.1.
Parameters: subset: IndexSlice, default None
a valid slice for
data
to limit the style application toaxis: int
color: str or 2-tuple/list
If a str is passed, the color is the same for both negative and positive numbers. If 2-tuple/list is used, the first element is the color_negative and the second is the color_positive (eg: [‘#d65f5f’, ‘#5fba7d’])
width: float
A number between 0 or 100. The largest value will cover
width
percent of the cell’s widthalign : {‘left’, ‘zero’,’ mid’}, default ‘left’
‘left’ : the min value starts at the left of the cell
‘zero’ : a value of zero is located at the center of the cell
‘mid’ : the center of the cell is at (max-min)/2, or if values are all negative (positive) the zero is aligned at the right (left) of the cell
New in version 0.20.0.
Returns: self : Styler