def apply_conditional_styles ( self , cbfct ) : for ridx in range ( self . nrows ) : for cidx in range ( self . ncols ) : fmts = cbfct ( self . actual_values . iloc [ ridx , cidx ] ) fmts and self . iloc [ ridx , cidx ] . apply_styles ( fmts ) return self
apply styling on individual elements of a particular column in python
Ability to provide dynamic styling of the cell based on its value . : param cbfct : function ( cell_value ) should return a dict of format commands to apply to that cell : return : self
def apply_conditional_styles(self, cbfct):
        """
        Ability to provide dynamic styling of the cell based on its value.
        :param cbfct: function(cell_value) should return a dict of format commands to apply to that cell
        :return: self
        """
        for ridx in range(self.nrows):
            for cidx in range(self.ncols):
                fmts = cbfct(self.actual_values.iloc[ridx, cidx])
                fmts and self.iloc[ridx, cidx].apply_styles(fmts)
        return self