File tree 1 file changed +15
-1
lines changed
1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -520,17 +520,31 @@ def set_caption(self, caption):
520
520
521
521
def set_table_styles (self , table_styles ):
522
522
"""
523
- Set the table styles on a Styler
523
+ Set the table styles on a Styler. These are placed in a
524
+ ``<style>`` tag before the generated HTML table.
524
525
525
526
.. versionadded:: 0.17.1
526
527
527
528
Parameters
528
529
----------
529
530
table_styles: list
531
+ Each individual table_style should be a dictionary with
532
+ ``selector`` and ``props`` keys. ``selector`` should be a CSS
533
+ selector that the style will be applied to (automatically
534
+ prefixed by the table's UUID) and ``props`` should be a list of
535
+ tuples with ``(attribute, value)``.
530
536
531
537
Returns
532
538
-------
533
539
self
540
+
541
+ Examples
542
+ --------
543
+ >>> df = pd.DataFrame(np.random.randn(10, 4))
544
+ >>> df.style.set_table_styles(
545
+ ... [{'selector': 'tr:hover',
546
+ ... 'props': [('background-color', 'yellow')]}]
547
+ ... )
534
548
"""
535
549
self .table_styles = table_styles
536
550
return self
You can’t perform that action at this time.
0 commit comments