With loc.column_labels(), we can target the cells containing the column labels. This is useful for applying custom styling with the tab_style() method. That method has a locations= argument and this class should be used there to perform the targeting.
Parameters
columns:SelectExpr=None
The columns to target. Can either be a single column name or a series of column names provided in a list. If no columns are specified, all columns are targeted.
A LocColumnLabels object, which is used for a locations= argument if specifying the table’s column labels.
Examples
Let’s use a subset of the gtcars dataset in a new table. We will style all three of the column labels by using locations=loc.column_labels() within tab_style(). Note that no specification of columns= is needed here because we want to target all columns.