Skip to main content
Version: 0.1.1

sdvplot.reactable

reactable-py columns (pip install sdvplot[reactable]), ported from sdvplotR's reactable_sdv_* functions, plus reactablefmtr's cell formatters (data bars, color tiles and scales, pills, icons, merged columns, highlights, bubbles).

NameWhat it is
reactable_sdv_argsThe Reactable keyword arguments that make a table look like a registry or reactablefmtr theme.
reactable_sdv_bubble_gridA reactable column of circles (or squares) sized and colored by value, by a color column, or by team.
reactable_sdv_color_scalesA reactable column whose cell backgrounds are filled on a color scale, by a color column, or in team colors.
reactable_sdv_color_tilesA reactable column of rounded tiles filled on a color scale, by a color column, or in the row's team color.
reactable_sdv_cols_labelOne reactable column per team-named column of data (a KC column, a BUF column, ...), its header
reactable_sdv_data_barsA reactable column of horizontal bars sized by value, in a scale color, a color column or the team color.
reactable_sdv_frameA Reactable with a title and subtitle above it and a legend and source line under it, in a Google font.
reactable_sdv_gaugeA reactable column that draws each cell's number as a half-circle gauge (an inline SVG) with the value inside.
reactable_sdv_headshotsA reactable column that shows each cell's player id as the player's headshot.
reactable_sdv_highlightA reactable column whose highest (or lowest, or both) values are bold, in a color, optionally on a highlight.
reactable_sdv_icon_assignA reactable column that repeats an icon, filled up to the value: a rating in stars, a count in dots.
reactable_sdv_icon_legendAn icon legend: each icon, in its color, before its label, for reactable_sdv_frame(legend=...).
reactable_sdv_icon_setsA reactable column that puts an icon beside each number, chosen by the value's quantile bucket.
reactable_sdv_icon_trendA reactable column that marks each change with an up arrow, a down arrow or a dash, the value colored to match.
reactable_sdv_legendA color legend: a row of swatches with a label under each, for reactable_sdv_frame(legend=...).
reactable_sdv_logosA reactable column that shows each cell's team as its logo.
reactable_sdv_merge_columnA reactable column that shows a second column's value beside or below each value, after an optional mark.
reactable_sdv_pill_buttonsA reactable column whose values sit in rounded pills, in a scale color, a color column or the team color.
reactable_sdv_sparkbarA reactable column that draws each cell's list of numbers as a small bar chart (an inline SVG).
reactable_sdv_sparklineA reactable column that draws each cell's list of numbers as a sparkline (an inline SVG).
reactable_sdv_team_color_barA reactable column whose cells hold a bar in the row's team color, as long as the value's share of the maximum.
reactable_sdv_team_color_bgA reactable column whose cells are filled with the row's team color, mostly transparent.
reactable_sdv_themeOne of reactablefmtr's 27 table themes, or any of the 122 surveyed registry themes (sdv_table_themes()).
reactable_sdv_theme_teamA table theme in a team's colors: the header filled with the primary color over a rule in the secondary,
reactable_sdv_wordmarksA reactable column that shows each cell's team as its wordmark.

reactable_sdv_args​

reactable_sdv_args(
name: str,
*,
mode: str = 'light',
) -> dict[str, Any]

The Reactable keyword arguments that make a table look like a registry or reactablefmtr theme.

Arguments​

NameTypeDescription
namestrA reactablefmtr theme or a registry id, as in reactable_sdv_theme.
modestr"light" or "dark", as in reactable_sdv_theme.

Returns​

dict — theme (a reactable.Theme), striped, highlight (always True), bordered (the theme draws column rules) and compact (its cell padding is 4 pixels or less). A reactablefmtr theme returns its own Theme with the other keys at reactable's defaults.

Raises​

  • InputError: (a ValueError) As reactable_sdv_theme.

Example​

import pandas as pd
from reactable import Reactable
from sdvplot.reactable import reactable_sdv_args

df = pd.DataFrame({"team": ["KC", "BUF", "BAL"], "wins": [12, 10, 9]})
Reactable(df, **reactable_sdv_args("wikipedia"))
Reactable(df, **reactable_sdv_args("datagolf", mode="dark"))

See also​

  • reactable_sdv_theme: just the Theme

reactable_sdv_bubble_grid​

reactable_sdv_bubble_grid(
data: Any,
*,
shape: Literal['circles', 'squares'] = 'circles',
colors: collections.abc.Sequence[str] = ('#15607A', '#FFFFFF', '#FA8C00'),
color_ref: str | None = None,
team_col: str | None = None,
league: str | None = None,
which: Literal['primary', 'secondary'] = 'primary',
color_by: str | None = None,
min_value: float | None = None,
max_value: float | None = None,
opacity: float = 1,
bias: float = 1,
number_fmt: collections.abc.Callable[[Any], str] | str | None = None,
text_color: str | None = None,
brighten_text: bool = True,
show_text: bool = True,
bold_text: bool = False,
box_shadow: bool = False,
tooltip: bool = False,
season: Any = None,
id_system: Literal['auto', 'team_id', 'espn', 'espn_abbr', 'nhl', 'nflverse', 'mlbstats', 'nba_api', 'hockeytech', 'ncaa', 'pff', 'cricinfo', 'cfbd', 'bref', 'sportsipy', 'fangraphs', 'sdvplotr', 'name', 'nhl_id'] = 'auto',
strict: bool = False,
**column_kwargs: Any,
) -> reactable.models.Column

A reactable column of circles (or squares) sized and colored by value, by a color column, or by team.

A bubble is the value's share of the column's largest magnitude, up to 100 pixels across.

Arguments​

NameTypeDescription
dataAnyThe pandas or polars DataFrame passed to Reactable (ranges and per-row colors are read from it).
shapeLiteral['circles', 'squares']"circles" or "squares".
colorscollections.abc.Sequence[str]Hex colors forming the scale from the column's minimum to its maximum.
color_refstr | NoneA column of data holding each row's bubble color: hex, a CSS color name, or rgb()/hsl(); any other value is warned about once and that row keeps the scale color.
team_colstr | NoneA column of team values; each bubble takes that team's color (which). Teams that do not resolve keep the scale color.
leaguestr | NoneThe SDV league key, e.g. "nfl"; needed by team_col.
whichLiteral['primary', 'secondary']"primary" or "secondary" team color.
color_bystr | NoneAnother numeric column whose values set the colors and sizes.
min_valuefloat | NoneThe value of an empty bubble; None measures from zero.
max_valuefloat | NoneThe value of a 100-pixel bubble; None for the column's largest magnitude. Sizes are clamped to 0-100 pixels, as data bars are to their track.
opacityfloatThe bubble's opacity, 0 to 1.
biasfloatSpacing of the scale's colors; above 1 spreads the high end (grDevices::colorRamp).
number_fmtcollections.abc.Callable[[Any], str] | str | NoneA function of the value returning its text, or a format spec such as ",.1f".
text_colorstr | NoneThe text color; None for black, or white on a dark bubble.
brighten_textboolSwitch the text to black or white when text_color is unreadable on the bubble.
show_textboolShow the value inside the bubble.
bold_textboolBold text.
box_shadowboolA drop shadow under each bubble.
tooltipboolGive each cell a title (hover text) of its formatted value.
seasonAnyOne season whose team colors to use; None for today's.
id_systemLiteral['auto', 'team_id', 'espn', 'espn_abbr', 'nhl', 'nflverse', 'mlbstats', 'nba_api', 'hockeytech', 'ncaa', 'pff', 'cricinfo', 'cfbd', 'bref', 'sportsipy', 'fangraphs', 'sdvplotr', 'name', 'nhl_id']The id system of team_col, as in resolve.
strictboolRaise UnresolvedTeamError instead of warning when a team does not resolve.
**column_kwargsAnyPassed to reactable.Column; id names the column drawn.

Returns​

reactable.Column — The column, with html=True and a cell renderer.

Raises​

  • InputError: (a ValueError) If shape is not "circles"/"squares", opacity is outside [0, 1], bias is not positive, team_col comes without league, or color_ref and team_col are both given.
  • ValueError: If colors are not hex colors, or a named column is not in data.
  • UnresolvedTeamError: (a ValueError) If strict=True and a team does not resolve.

Example​

import pandas as pd
from reactable import Reactable
from sdvplot.reactable import reactable_sdv_bubble_grid

df = pd.DataFrame({"team": ["KC", "BUF", "BAL"], "wins": [15, 13, 12]})

Reactable(df, columns=[reactable_sdv_bubble_grid(df, team_col="team", league="nfl", id="wins")])

See also​

reactable_sdv_color_scales​

reactable_sdv_color_scales(
data: Any,
*,
colors: collections.abc.Sequence[str] = ('#15607A', '#FFFFFF', '#FA8C00'),
color_ref: str | None = None,
team_col: str | None = None,
league: str | None = None,
which: Literal['primary', 'secondary'] = 'primary',
color_by: str | None = None,
opacity: float = 1,
bias: float = 1,
min_value: float | None = None,
max_value: float | None = None,
even_breaks: bool = False,
number_fmt: collections.abc.Callable[[Any], str] | str | None = None,
text_color: str | None = None,
brighten_text: bool = True,
show_text: bool = True,
bold_text: bool = False,
span: bool | str | collections.abc.Sequence[str] = False,
tooltip: bool = False,
season: Any = None,
id_system: Literal['auto', 'team_id', 'espn', 'espn_abbr', 'nhl', 'nflverse', 'mlbstats', 'nba_api', 'hockeytech', 'ncaa', 'pff', 'cricinfo', 'cfbd', 'bref', 'sportsipy', 'fangraphs', 'sdvplotr', 'name', 'nhl_id'] = 'auto',
strict: bool = False,
**column_kwargs: Any,
) -> reactable.models.Column

A reactable column whose cell backgrounds are filled on a color scale, by a color column, or in team colors.

reactable_sdv_color_tiles without the tile; the text stays readable.

Arguments​

NameTypeDescription
dataAnyThe pandas or polars DataFrame passed to Reactable (ranges and per-row colors are read from it).
colorscollections.abc.Sequence[str]Hex colors forming the scale from the column's minimum to its maximum.
color_refstr | NoneA column of data holding each row's fill color: hex, a CSS color name, or rgb()/hsl(); any other value is warned about once and that row keeps the scale color.
team_colstr | NoneA column of team values; each cell takes that team's color (which). Teams that do not resolve keep the scale color.
leaguestr | NoneThe SDV league key, e.g. "nfl"; needed by team_col.
whichLiteral['primary', 'secondary']"primary" or "secondary" team color.
color_bystr | NoneAnother numeric column whose values set the colors.
opacityfloatThe fill's opacity, 0 to 1.
biasfloatSpacing of the scale's colors; above 1 spreads the high end (grDevices::colorRamp).
min_valuefloat | NoneThe value at the scale's first color; at most the column's minimum.
max_valuefloat | NoneThe value at the scale's last color; at least the column's maximum.
even_breaksboolColor by quantile bucket (as many as colors) instead of by value.
number_fmtcollections.abc.Callable[[Any], str] | str | NoneA function of the value returning its text, or a format spec such as ",.1f".
text_colorstr | NoneThe text color; None for black, or white on a dark fill.
brighten_textboolSwitch the text to black or white when text_color is unreadable on the fill.
show_textboolShow the value; False hides it.
bold_textboolBold text.
spanbool | str | collections.abc.Sequence[str]True scales every numeric column of data on one shared range; a column name or list of names scales those columns together (cells of other columns are left unfilled).
tooltipboolGive each cell a title (hover text) of its formatted value.
seasonAnyOne season whose team colors to use; None for today's.
id_systemLiteral['auto', 'team_id', 'espn', 'espn_abbr', 'nhl', 'nflverse', 'mlbstats', 'nba_api', 'hockeytech', 'ncaa', 'pff', 'cricinfo', 'cfbd', 'bref', 'sportsipy', 'fangraphs', 'sdvplotr', 'name', 'nhl_id']The id system of team_col, as in resolve.
strictboolRaise UnresolvedTeamError instead of warning when a team does not resolve.
**column_kwargsAnyPassed to reactable.Column; id names the column drawn.

Returns​

reactable.Column — The column, with a style function (and a cell renderer when number_fmt or tooltip is given).

Raises​

  • InputError: (a ValueError) If opacity is outside [0, 1], bias is not positive, min_value is above the column's minimum or max_value below its maximum (when the Reactable is built), span names a non-numeric column, team_col comes without league, or color_ref and team_col are both given.
  • ValueError: If colors are not hex colors, or a named column is not in data.
  • UnresolvedTeamError: (a ValueError) If strict=True and a team does not resolve.

Example​

import pandas as pd
from reactable import Reactable
from sdvplot.reactable import reactable_sdv_color_scales

df = pd.DataFrame({"team": ["KC", "BUF", "BAL"], "wins": [15, 13, 12]})

Reactable(df, columns=[reactable_sdv_color_scales(df, team_col="team", league="nfl", id="wins")])

See also​

reactable_sdv_color_tiles​

reactable_sdv_color_tiles(
data: Any,
*,
colors: collections.abc.Sequence[str] = ('#15607A', '#FFFFFF', '#FA8C00'),
color_ref: str | None = None,
team_col: str | None = None,
league: str | None = None,
which: Literal['primary', 'secondary'] = 'primary',
color_by: str | None = None,
opacity: float = 1,
bias: float = 1,
min_value: float | None = None,
max_value: float | None = None,
even_breaks: bool = False,
number_fmt: collections.abc.Callable[[Any], str] | str | None = None,
text_color: str | None = None,
brighten_text: bool = True,
show_text: bool = True,
bold_text: bool = False,
span: bool | str | collections.abc.Sequence[str] = False,
box_shadow: bool = False,
tooltip: bool = False,
season: Any = None,
id_system: Literal['auto', 'team_id', 'espn', 'espn_abbr', 'nhl', 'nflverse', 'mlbstats', 'nba_api', 'hockeytech', 'ncaa', 'pff', 'cricinfo', 'cfbd', 'bref', 'sportsipy', 'fangraphs', 'sdvplotr', 'name', 'nhl_id'] = 'auto',
strict: bool = False,
**column_kwargs: Any,
) -> reactable.models.Column

A reactable column of rounded tiles filled on a color scale, by a color column, or in the row's team color.

The text on each tile stays readable.

Arguments​

NameTypeDescription
dataAnyThe pandas or polars DataFrame passed to Reactable (ranges and per-row colors are read from it).
colorscollections.abc.Sequence[str]Hex colors forming the scale from the column's minimum to its maximum.
color_refstr | NoneA column of data holding each row's fill color: hex, a CSS color name, or rgb()/hsl(); any other value is warned about once and that row keeps the scale color.
team_colstr | NoneA column of team values; each tile takes that team's color (which). Teams that do not resolve keep the scale color.
leaguestr | NoneThe SDV league key, e.g. "nfl"; needed by team_col.
whichLiteral['primary', 'secondary']"primary" or "secondary" team color.
color_bystr | NoneAnother numeric column whose values set the colors.
opacityfloatThe fill's opacity, 0 to 1.
biasfloatSpacing of the scale's colors; above 1 spreads the high end (grDevices::colorRamp).
min_valuefloat | NoneThe value at the scale's first color; at most the column's minimum.
max_valuefloat | NoneThe value at the scale's last color; at least the column's maximum.
even_breaksboolColor by quantile bucket (as many as colors) instead of by value.
number_fmtcollections.abc.Callable[[Any], str] | str | NoneA function of the value returning its text, or a format spec such as ",.1f".
text_colorstr | NoneThe text color; None for black, or white on a dark tile.
brighten_textboolSwitch the text to black or white when text_color is unreadable on the tile.
show_textboolShow the value; False leaves a plain tile.
bold_textboolBold text.
spanbool | str | collections.abc.Sequence[str]True scales every numeric column of data on one shared range; a column name or list of names scales those columns together (cells of other columns are left unfilled).
box_shadowboolA drop shadow under each tile.
tooltipboolGive each cell a title (hover text) of its formatted value.
seasonAnyOne season whose team colors to use; None for today's.
id_systemLiteral['auto', 'team_id', 'espn', 'espn_abbr', 'nhl', 'nflverse', 'mlbstats', 'nba_api', 'hockeytech', 'ncaa', 'pff', 'cricinfo', 'cfbd', 'bref', 'sportsipy', 'fangraphs', 'sdvplotr', 'name', 'nhl_id']The id system of team_col, as in resolve.
strictboolRaise UnresolvedTeamError instead of warning when a team does not resolve.
**column_kwargsAnyPassed to reactable.Column; id names the column drawn.

Returns​

reactable.Column — The column, with html=True and a cell renderer.

Raises​

  • InputError: (a ValueError) If opacity is outside [0, 1], bias is not positive, min_value is above the column's minimum or max_value below its maximum (when the Reactable is built), span names a non-numeric column, team_col comes without league, or color_ref and team_col are both given.
  • ValueError: If colors are not hex colors, or a named column is not in data.
  • UnresolvedTeamError: (a ValueError) If strict=True and a team does not resolve.

Example​

import pandas as pd
from reactable import Reactable
from sdvplot.reactable import reactable_sdv_color_tiles

df = pd.DataFrame({"team": ["KC", "BUF", "BAL"], "epa": [0.12, 0.18, 0.21]})

Reactable(df, columns=[reactable_sdv_color_tiles(df, number_fmt=".2f", id="epa")])

See also​

reactable_sdv_cols_label​

reactable_sdv_cols_label(
data: Any,
*,
league: str,
variant: str = 'default',
height: Any = 30,
season: Any = None,
mark_type: str = 'logo',
id_system: Literal['auto', 'team_id', 'espn', 'espn_abbr', 'nhl', 'nflverse', 'mlbstats', 'nba_api', 'hockeytech', 'ncaa', 'pff', 'cricinfo', 'cfbd', 'bref', 'sportsipy', 'fangraphs', 'sdvplotr', 'name', 'nhl_id'] = 'auto',
strict: bool = False,
**column_kwargs: Any,
) -> list[reactable.models.Column]

One reactable column per team-named column of data (a KC column, a BUF column, ...), its header

the team's mark.

Arguments​

NameTypeDescription
dataAnyThe pandas or polars DataFrame passed to Reactable. Pass only the team-named columns (df[["KC", "BUF"]]) to avoid a warning for the others.
leaguestrThe SDV league key, e.g. "nfl".
variantstr"default", "dark", or a named variant from marks().
heightAnyThe image height in pixels.
seasonAnyOne season whose marks to show; None for today's.
mark_typestr"logo" or "wordmark".
id_systemLiteral['auto', 'team_id', 'espn', 'espn_abbr', 'nhl', 'nflverse', 'mlbstats', 'nba_api', 'hockeytech', 'ncaa', 'pff', 'cricinfo', 'cfbd', 'bref', 'sportsipy', 'fangraphs', 'sdvplotr', 'name', 'nhl_id']The id system of the column names, as in resolve: "auto" tries each in order; NHL stats ids need "nhl_id".
strictboolRaise UnresolvedTeamError instead of warning when a column name does not resolve.
**column_kwargsAnyPassed to every reactable.Column.

Returns​

list[reactable.Column] — A column (id = the column name, an empty name, the mark as header) for each column whose name resolves; the others are left out, with one SdvplotWarning.

Raises​

  • InputError: (a ValueError) If mark_type is not "logo"/"wordmark", height is not a number of pixels of at least 1, league, id_system or variant is unknown, or season is not one year or is outside the seasons sdvplot knows for the league.
  • UnresolvedTeamError: (a ValueError) If strict=True and a column name does not resolve.
  • OfflineError: If the logo manifest cannot be downloaded and no cached copy exists (a DownloadError, also an OSError, when the CDN answers with an error status).
  • UnsafeDownloadError: (an OSError) If the manifest download is refused: larger than the byte cap, past the deadline, or redirected away from https.

Example​

import pandas as pd
from reactable import Reactable
from sdvplot.reactable import reactable_sdv_cols_label

df = pd.DataFrame(
{
"team": ["KC", "BUF", "BAL"],
"espn_id": ["3139477", "3918298", "3916387"],
"wins": [12, 10, 9],
}
)

Reactable(df, columns=reactable_sdv_cols_label(df, league="nfl"))

See also​

reactable_sdv_data_bars​

reactable_sdv_data_bars(
data: Any,
*,
fill_color: str | collections.abc.Sequence[str] = '#15607A',
fill_color_ref: str | None = None,
team_col: str | None = None,
league: str | None = None,
which: Literal['primary', 'secondary'] = 'primary',
fill_by: str | None = None,
fill_opacity: float = 1,
bias: float = 1,
min_value: float | None = None,
max_value: float | None = None,
align: Literal['left', 'right'] = 'left',
text_position: Literal['inside-end', 'outside-end', 'inside-base', 'outside-base', 'center', 'above', 'none'] = 'inside-end',
text_color: str | None = None,
brighten_text: bool = True,
bold_text: bool = False,
number_fmt: collections.abc.Callable[[Any], str] | str | None = None,
mark: Literal['logo', 'headshot', 'wordmark'] | None = None,
mark_col: str | None = None,
mark_height: float = 20,
round_edges: bool = False,
bar_height: float | None = None,
background: str = '#EEEEEE',
gradient: bool = False,
pos_neg: bool = False,
box_shadow: bool = False,
tooltip: bool = False,
season: Any = None,
id_system: Literal['auto', 'team_id', 'espn', 'espn_abbr', 'nhl', 'nflverse', 'mlbstats', 'nba_api', 'hockeytech', 'ncaa', 'pff', 'cricinfo', 'cfbd', 'bref', 'sportsipy', 'fangraphs', 'sdvplotr', 'name', 'nhl_id'] = 'auto',
strict: bool = False,
**column_kwargs: Any,
) -> reactable.models.Column

A reactable column of horizontal bars sized by value, in a scale color, a color column or the team color.

Each bar is the value's share of the column's largest magnitude, optionally with a logo, headshot or wordmark on it.

Negative values (or pos_neg=True) split the cell at zero: negative bars grow left from a center line, positive bars right, colored by the first and last of two fill_color colors.

Arguments​

NameTypeDescription
dataAnyThe pandas or polars DataFrame passed to Reactable (ranges and per-row colors are read from it).
fill_colorstr | collections.abc.Sequence[str]One color, or several colors forming a scale from the column's minimum to its maximum.
fill_color_refstr | NoneA column of data holding each row's bar color: hex, a CSS color name, or rgb()/hsl(); any other value is warned about once and that row keeps the scale color.
team_colstr | NoneA column of team values; each bar takes that team's color (which). Teams that do not resolve keep the scale color.
leaguestr | NoneThe SDV league key, e.g. "nfl"; needed by team_col and mark.
whichLiteral['primary', 'secondary']"primary" or "secondary" team color.
fill_bystr | NoneAnother numeric column whose values set the bar lengths and colors (a text column is an error).
fill_opacityfloatThe bar's opacity, 0 to 1.
biasfloatSpacing of the scale's colors; above 1 spreads the high end (grDevices::colorRamp).
min_valuefloat | NoneThe value of an empty bar; None measures from zero.
max_valuefloat | NoneThe value of a full bar; None for the column's largest magnitude. Bars are clamped to 0-100% of the track, so a value beyond max_value draws a full bar.
alignLiteral['left', 'right']"left" or "right": the side bars grow from.
text_positionLiteral['inside-end', 'outside-end', 'inside-base', 'outside-base', 'center', 'above', 'none']"inside-end", "outside-end", "inside-base", "outside-base", "center", "above" or "none" ("none" keeps the value as visually hidden text for screen readers).
text_colorstr | NoneThe text color (hex, a CSS color name, or rgb()/hsl()); None for black, or white on a dark bar.
brighten_textboolSwitch text inside a bar to black or white when text_color is unreadable on it.
bold_textboolBold text.
number_fmtcollections.abc.Callable[[Any], str] | str | NoneA function of the value returning its text, or a format spec such as ",.1f".
markLiteral['logo', 'headshot', 'wordmark'] | None"logo", "headshot" or "wordmark": an image at the end of each bar.
mark_colstr | NoneThe column the mark is read from; defaults to team_col. Headshots need ESPN athlete ids.
mark_heightfloatThe mark's height in pixels.
round_edgesboolRound the bar's ends.
bar_heightfloat | NoneThe bar's height in pixels; None for 18 (5 with text_position="above").
backgroundstrThe color of the empty track behind each bar (hex, a CSS color name, or rgb()/hsl()).
gradientboolFill each bar with a left-to-right gradient of fill_color (two colors or more).
pos_negboolSplit every cell at zero even when no value is negative.
box_shadowboolA drop shadow under each bar.
tooltipboolGive each cell a title (hover text) of its formatted value.
seasonAnyOne season whose team colors and marks to use; None for today's.
id_systemLiteral['auto', 'team_id', 'espn', 'espn_abbr', 'nhl', 'nflverse', 'mlbstats', 'nba_api', 'hockeytech', 'ncaa', 'pff', 'cricinfo', 'cfbd', 'bref', 'sportsipy', 'fangraphs', 'sdvplotr', 'name', 'nhl_id']The id system of team_col/mark_col, as in resolve.
strictboolRaise UnresolvedTeamError instead of warning when a team does not resolve.
**column_kwargsAnyPassed to reactable.Column; id names the column drawn.

Returns​

reactable.Column — The column, with html=True and a cell renderer.

Raises​

  • InputError: (a ValueError) If an option is not one of its choices, an opacity is outside [0, 1], fill_color is not hex colors, gradient has fewer than two colors, team_col or mark comes without league, or fill_color_ref and team_col are both given.
  • ValueError: If a named column is not in data.
  • UnresolvedTeamError: (a ValueError) If strict=True and a team does not resolve.

Example​

import pandas as pd
from reactable import Reactable
from sdvplot.reactable import reactable_sdv_data_bars

df = pd.DataFrame({"team": ["KC", "BUF", "BAL"], "wins": [15, 13, 12]})

Reactable(df, columns=[reactable_sdv_data_bars(df, team_col="team", league="nfl", mark="logo", id="wins")])

See also​

reactable_sdv_frame​

reactable_sdv_frame(
table: Any,
*,
title: Any = None,
subtitle: Any = None,
source: Any = None,
legend: Any = None,
font: str | None = None,
align: str = 'left',
) -> htmltools._core.TagList

A Reactable with a title and subtitle above it and a legend and source line under it, in a Google font.

The result shows in a notebook just as a Reactable does (call reactable.embed_css() once first). Its sizes are reactablefmtr's: a 32 px bold title, a 24 px bold subtitle and a 16 px source line, no margins; the text color is inherited from the page rather than reactablefmtr's black, so a dark page keeps it readable.

Arguments​

NameTypeDescription
tableAnyThe reactable.Reactable.
titleAnyThe title text (or an htmltools tag).
subtitleAnyThe subtitle text (or tag).
sourceAnyThe source line under the table, e.g. "Data: sportsdataverse-py".
legendAnyA legend from reactable_sdv_legend or reactable_sdv_icon_legend (any htmltools tag), shown under the table.
fontstr | NoneA Google Fonts family name, e.g. "Poppins" or "Roboto Condensed", for the title, table and source; None keeps the page's font. The font is loaded from fonts.googleapis.com when the page is shown.
alignstr"left", "center" or "right", for the title, subtitle, legend and source.

Returns​

htmltools.TagList — The framed table.

Raises​

  • InputError: (a ValueError) If align is not "left", "center" or "right", or font is not a font name.

Example​

import pandas as pd
from reactable import Reactable
from sdvplot.reactable import reactable_sdv_frame, reactable_sdv_legend

df = pd.DataFrame({"team": ["KC", "BUF", "BAL"], "wins": [12, 10, 9]})
reactable_sdv_frame(
Reactable(df),
title="AFC leaders",
subtitle="2025 regular season",
source="Data: sportsdataverse-py",
legend=reactable_sdv_legend(colors=["#ffffff", "#1a9641"], labels=["fewer", "more"]),
font="Poppins",
)

See also​

reactable_sdv_gauge​

reactable_sdv_gauge(
data: Any,
*,
fill_color: str | collections.abc.Sequence[str] | None = None,
background: str = '#EEEEEE',
team_col: str | None = None,
league: str | None = None,
which: Literal['primary', 'secondary'] = 'primary',
id_system: Literal['auto', 'team_id', 'espn', 'espn_abbr', 'nhl', 'nflverse', 'mlbstats', 'nba_api', 'hockeytech', 'ncaa', 'pff', 'cricinfo', 'cfbd', 'bref', 'sportsipy', 'fangraphs', 'sdvplotr', 'name', 'nhl_id'] = 'auto',
strict: bool = False,
season: Any = None,
na_color: str = '#b3b3b3',
min_value: float | None = None,
max_value: float | None = None,
show_min_max: bool = False,
number_fmt: collections.abc.Callable[[float], str] | str | None = None,
size: float = 1,
text_color: str | None = None,
bold_text: bool = False,
text_size: str | None = None,
bias: float = 1,
opacity: float = 1,
**column_kwargs: Any,
) -> reactable.models.Column

A reactable column that draws each cell's number as a half-circle gauge (an inline SVG) with the value inside.

Arguments​

NameTypeDescription
dataAnyThe pandas or polars DataFrame passed to Reactable: the gauged column's range (for the default scale and the color ramp) and team_col are read from it.
fill_colorstr | collections.abc.Sequence[str] | NoneThe gauge's CSS color, or several hex colors to ramp through from the column's smallest value to its largest (as reactablefmtr); None for reactablefmtr's "#15607A" (or the row's team color).
backgroundstrThe color of the gauge's unfilled track.
team_colstr | NoneA column of data holding each row's team: the gauge takes that team's color.
leaguestr | NoneThe SDV league key of team_col's teams, e.g. "nhl"; required with team_col.
whichLiteral['primary', 'secondary']"primary" or "secondary" team color.
id_systemLiteral['auto', 'team_id', 'espn', 'espn_abbr', 'nhl', 'nflverse', 'mlbstats', 'nba_api', 'hockeytech', 'ncaa', 'pff', 'cricinfo', 'cfbd', 'bref', 'sportsipy', 'fangraphs', 'sdvplotr', 'name', 'nhl_id']The id system of team_col, as in resolve.
strictboolRaise UnresolvedTeamError instead of warning when a team does not resolve.
seasonAnyOne season for every row's team color, for teams whose colors changed; None for today's.
na_colorstrThe color for teams that do not resolve or have no color.
min_valuefloat | NoneThe value of an empty gauge; None for 0. As in reactablefmtr, a cell's absolute value is what fills the gauge (-5 fills as 5); the printed value and the aria-label keep the sign.
max_valuefloat | NoneThe value of a full gauge; None for the column's largest absolute value. Must be above min_value.
show_min_maxboolPrint the scale's two ends under the gauge.
number_fmtcollections.abc.Callable[[float], str] | str | NoneHow to print the value (and the ends): a function such as "{:.1%}".format, or a format spec such as ".3f"; None prints the number as is.
sizefloatThe gauge's scale: 1 is 50 pixels wide (reactablefmtr's size = 1), 2 is 100.
text_colorstr | NoneThe value's color; None for the cell's text color.
bold_textboolPrint the value in bold.
text_sizestr | NoneThe value's CSS font size; None for the cell's.
biasfloatThe ramp's spacing (grDevices::colorRamp's bias): above 1 spreads the colors toward the high end.
opacityfloatThe fill's opacity, 0 to 1.
**column_kwargsAnyPassed to reactable.Column (id is required by reactable).

Returns​

reactable.Column — The column, with html=True and a cell renderer; each gauge is an <svg role="img"> whose aria-label gives the value and the scale. A missing value is left blank; text passes through.

Raises​

  • InputError: (a ValueError) If size or bias is not a positive number, opacity is outside [0, 1], min_value/max_value is not a finite number or min_value is not below max_value, fill_color holds several colors that are not hex colors, or team_col is given without league; if league, id_system, which or season is unknown. When a cell is drawn: if min_value alone is above the column's largest absolute value, or (with team_col) the table has more rows than data.
  • ValueError: If team_col is not a column of data.
  • UnresolvedTeamError: (a ValueError) If strict=True and a team does not resolve.

Example​

import polars as pl
from reactable import Reactable
from sdvplot.reactable import reactable_sdv_gauge

df = pl.DataFrame({"team": ["BOS", "TOR", "FLA"], "save_pct": [0.915, 0.902, 0.908]})
Reactable(df, columns=[reactable_sdv_gauge(df, id="save_pct", team_col="team", league="nhl",
min_value=0.88, max_value=0.93, number_fmt=".3f")])

See also​

  • Equivalent of reactablefmtr::gauge_chart (an SVG arc rather than nested divs, so the value sits on the cell's own background in any theme
  • the "min" end reads the scale's real lower bound).

reactable_sdv_headshots​

reactable_sdv_headshots(
*,
league: str,
height: Any = 40,
default_img: str | None = None,
id_system: str = 'espn',
**column_kwargs: Any,
) -> reactable.models.Column

A reactable column that shows each cell's player id as the player's headshot.

Arguments​

NameTypeDescription
leaguestrThe SDV league key, e.g. "nfl".
heightAnyThe image height in pixels.
default_imgstr | NoneAn image URL for ids without a headshot; None keeps their text.
id_systemstr"espn" (ESPN athlete ids), "gsis" (NFL) or "league" (the league's own player id: nfl gsis, NBA and WNBA Stats ids, MLBAM, NHL), as in headshot_url.
**column_kwargsAnyPassed to reactable.Column (id is required by reactable).

Returns​

reactable.Column — The column, with html=True and a cell renderer.

Raises​

  • InputError: (a ValueError) If height is not a number of pixels of at least 1; when the Reactable is built, if league has no ESPN headshots or id_system is not valid for league.
  • OfflineError: When the Reactable is built, if id_system is "gsis" and the nflverse player table cannot be downloaded and no cached copy exists (a DownloadError, also an OSError, for an HTTP error status).
  • UnsafeDownloadError: (an OSError) When the Reactable is built, if id_system is "gsis" and the player table download is refused: larger than the byte cap, past the deadline, or redirected away from https.

Example​

import pandas as pd
from reactable import Reactable
from sdvplot.reactable import reactable_sdv_headshots

df = pd.DataFrame(
{
"team": ["KC", "BUF", "BAL"],
"espn_id": ["3139477", "3918298", "3916387"],
"wins": [12, 10, 9],
}
)

Reactable(df, columns=[reactable_sdv_headshots(league="nfl", id="espn_id", name="")])

See also​

reactable_sdv_highlight​

reactable_sdv_highlight(
data: Any,
*,
which: Literal['max', 'min', 'min_max'] = 'max',
font_color: str | tuple[str, str] | None = None,
highlighter: str | tuple[str | None, str | None] | None = None,
tooltip: bool = False,
**column_kwargs: Any,
) -> reactable.models.Column

A reactable column whose highest (or lowest, or both) values are bold, in a color, optionally on a highlight.

Arguments​

NameTypeDescription
dataAnyThe pandas or polars DataFrame passed to Reactable (the column's extremes are read from it).
whichLiteral['max', 'min', 'min_max']"max", "min", or "min_max" for both: which extreme to highlight. (Unlike the team-color which of the other formatters, "primary"/"secondary", this is reactablefmtr's highlight_max/_min/_min_max.)
font_colorstr | tuple[str, str] | NoneThe CSS text color; None for green on the maximum and red on the minimum. For "min_max", a (min, max) pair.
highlighterstr | tuple[str | None, str | None] | NoneA CSS background color, or a (min, max) pair for "min_max"; None for no background.
tooltipboolGive each cell a title (hover text) of its value.
**column_kwargsAnyPassed to reactable.Column; id names the column drawn.

Returns​

reactable.Column — The column, with a style function (and a cell renderer when tooltip is on).

Raises​

  • InputError: (a ValueError) If which is unknown, a pair is not two values, or a color is not a hex color, a CSS color name, or rgb()/hsl().

Example​

import pandas as pd
from reactable import Reactable
from sdvplot.reactable import reactable_sdv_highlight

df = pd.DataFrame({"team": ["KC", "BUF", "BAL"], "wins": [15, 13, 12]})

Reactable(df, columns=[reactable_sdv_highlight(df, which="min_max", id="wins")])

See also​

reactable_sdv_icon_assign​

reactable_sdv_icon_assign(
data: Any,
*,
icon: str = 'circle',
fill_color: str = '#15607A',
empty_color: str = '#EEEEEE',
fill_opacity: float = 1,
empty_opacity: float = 1,
align_icons: Literal['left', 'right', 'center'] = 'left',
icon_size: float = 16,
buckets: int | None = None,
number_fmt: collections.abc.Callable[[Any], str] | str | None = None,
seq_by: float = 1,
show_values: Literal['none', 'left', 'right', 'above', 'below'] = 'none',
**column_kwargs: Any,
) -> reactable.models.Column

A reactable column that repeats an icon, filled up to the value: a rating in stars, a count in dots.

A value of 3 in a column whose largest value is 5 shows three filled icons and two empty ones (or, with buckets, the value's quantile bucket out of buckets).

The icons are inline SVG; see reactable_sdv_icon_sets for the names.

Arguments​

NameTypeDescription
dataAnyThe pandas or polars DataFrame passed to Reactable (the column's maximum is read from it).
iconstrThe icon's name.
fill_colorstrThe hex color of a filled icon.
empty_colorstrThe hex color of an empty icon.
fill_opacityfloatThe filled icons' opacity, 0 to 1.
empty_opacityfloatThe empty icons' opacity, 0 to 1.
align_iconsLiteral['left', 'right', 'center']"left", "right" or "center".
icon_sizefloatThe icon's size in pixels.
bucketsint | NoneCut the column into this many quantile buckets and fill one icon per bucket reached.
number_fmtcollections.abc.Callable[[Any], str] | str | NoneA function of the value returning its text, or a format spec such as ",.1f".
seq_byfloatOne icon per this many units of value (values are rounded half up first). A cell draws at most 100 icons (with a warning); a column that would need more than 1,000 is an error.
show_valuesLiteral['none', 'left', 'right', 'above', 'below']"none", or where to show the value: "left", "right", "above" or "below".
**column_kwargsAnyPassed to reactable.Column; id names the column drawn.

Returns​

reactable.Column — The column, with html=True and a cell renderer.

Raises​

  • InputError: (a ValueError) If icon, align_icons or show_values is unknown, an opacity is outside [0, 1], buckets is not a positive whole number, or seq_by is not positive.
  • ValueError: If a color is not a hex color.

Example​

import pandas as pd
from reactable import Reactable
from sdvplot.reactable import reactable_sdv_icon_assign

df = pd.DataFrame({"team": ["KC", "BUF", "BAL"], "titles": [4, 0, 2]})

Reactable(df, columns=[reactable_sdv_icon_assign(df, icon="star", show_values="right", id="titles")])

See also​

reactable_sdv_icon_legend​

reactable_sdv_icon_legend(
*,
icons: Any,
colors: Any,
labels: Any,
title: Any = None,
footer: Any = None,
) -> htmltools._core.Tag

An icon legend: each icon, in its color, before its label, for reactable_sdv_frame(legend=...).

Arguments​

NameDescription
iconsOne shape per entry: "circle", "square", "triangle", "diamond" or "star" (drawn as inline SVG, no icon font), or a single shape for all.
colorsOne hex color per entry, or a single color for all.
labelsOne label per entry.
titleText above the icons.
footerSmall grey text under them.

Returns​

htmltools.Tag — The legend.

Raises​

  • InputError: (a ValueError) If a shape is unknown, a color is not a hex color, or icons/colors do not have one entry per label.

Example​

from sdvplot.reactable import reactable_sdv_icon_legend

reactable_sdv_icon_legend(icons="circle", colors=["#1a9641", "#d7191c"], labels=["won", "lost"])

See also​

reactable_sdv_icon_sets​

reactable_sdv_icon_sets(
data: Any,
*,
icons: str | collections.abc.Sequence[str] = ('circle',),
colors: collections.abc.Sequence[str] = ('#15607A', '#B0B0B0', '#FA8C00'),
opacity: float = 1,
icon_position: Literal['left', 'right', 'above', 'below', 'over'] = 'right',
icon_ref: str | None = None,
icon_size: float = 16,
icon_color_ref: str | None = None,
number_fmt: collections.abc.Callable[[Any], str] | str | None = None,
tooltip: bool = False,
**column_kwargs: Any,
) -> reactable.models.Column

A reactable column that puts an icon beside each number, chosen by the value's quantile bucket.

The column is cut into as many buckets as icons (and as colors); each value takes its bucket's icon and color.

The icons are inline SVG: circle, square, diamond, triangle (triangle-up), triangle-down, arrow (arrow-right), arrow-up, arrow-down, arrow-left, chevron-up, chevron-down, star, check, x, flag, minus, plus, heart and person.

Arguments​

NameTypeDescription
dataAnyThe pandas or polars DataFrame passed to Reactable (buckets are read from it).
iconsstr | collections.abc.Sequence[str]One icon name, or several from the lowest bucket to the highest.
colorscollections.abc.Sequence[str]Hex colors from the lowest bucket to the highest.
opacityfloatThe icons' opacity, 0 to 1.
icon_positionLiteral['left', 'right', 'above', 'below', 'over']"right", "left", "above", "below", or "over" (the icon replaces the value).
icon_refstr | NoneA column of data holding each row's icon name (overrides icons); a missing value draws no icon.
icon_sizefloatThe icon's size in pixels.
icon_color_refstr | NoneA column of data holding each row's icon color (overrides colors): hex, a CSS color name, or rgb()/hsl(); a missing value or any other value (warned about once) draws no icon.
number_fmtcollections.abc.Callable[[Any], str] | str | NoneA function of the value returning its text, or a format spec such as ",.1f".
tooltipboolGive each cell a title (hover text) of its formatted value.
**column_kwargsAnyPassed to reactable.Column; id names the column drawn.

Returns​

reactable.Column — The column, with html=True and a cell renderer.

Raises​

  • InputError: (a ValueError) If an icon or icon_position is unknown, or opacity is outside [0, 1].
  • ValueError: If colors are not hex colors, or a named column is not in data.

Example​

import pandas as pd
from reactable import Reactable
from sdvplot.reactable import reactable_sdv_icon_sets

df = pd.DataFrame({"team": ["KC", "BUF", "BAL"], "wins": [15, 13, 12]})

Reactable(df, columns=[reactable_sdv_icon_sets(df, icons=("arrow-down", "minus", "arrow-up"), id="wins")])

See also​

reactable_sdv_icon_trend​

reactable_sdv_icon_trend(
data: Any,
*,
icons: Literal['arrow', 'chevron', 'triangle'] = 'arrow',
colors: collections.abc.Sequence[str] = ('#15607A', '#767676', '#B35900'),
icon_position: Literal['left', 'right', 'above', 'below', 'over'] = 'right',
icon_size: float = 16,
show_zero_label: bool = False,
number_fmt: collections.abc.Callable[[Any], str] | str | None = None,
opacity: float = 1,
text_color: str | None = None,
bold_text: bool = False,
tooltip: bool = False,
**column_kwargs: Any,
) -> reactable.models.Column

A reactable column that marks each change with an up arrow, a down arrow or a dash, the value colored to match.

Arguments​

NameTypeDescription
dataAnyThe pandas or polars DataFrame passed to Reactable.
iconsLiteral['arrow', 'chevron', 'triangle']"arrow", "chevron" or "triangle".
colorscollections.abc.Sequence[str]Three hex colors: down, zero, up. The default is reactablefmtr's #15607A with #767676 and #B35900, both 4.5:1 or better on white, in place of reactablefmtr's #B2B2B2 and #FA8C00 (about 2.1:1 and 2.4:1, too faint for the text, which takes these colors).
icon_positionLiteral['left', 'right', 'above', 'below', 'over']"right", "left", "above", "below", or "over" (the icon replaces the value).
icon_sizefloatThe icon's size in pixels.
show_zero_labelboolShow the value when it is zero (otherwise only the dash is drawn, and the zero is kept as visually hidden text for screen readers).
number_fmtcollections.abc.Callable[[Any], str] | str | NoneA function of the value returning its text, or a format spec such as "+.1f".
opacityfloatThe icons' opacity, 0 to 1.
text_colorstr | NoneOne color for every value's text; None colors it like its icon.
bold_textboolBold text.
tooltipboolGive each cell a title (hover text) of its formatted value.
**column_kwargsAnyPassed to reactable.Column; id names the column drawn.

Returns​

reactable.Column — The column, with html=True and a cell renderer.

Raises​

  • InputError: (a ValueError) If icons or icon_position is unknown, colors is not three colors, or opacity is outside [0, 1].
  • ValueError: If colors are not hex colors.

Example​

import pandas as pd
from reactable import Reactable
from sdvplot.reactable import reactable_sdv_icon_trend

df = pd.DataFrame({"team": ["KC", "BUF", "BAL"], "win_change": [4, 0, -3]})

Reactable(df, columns=[reactable_sdv_icon_trend(df, number_fmt="+d", id="win_change")])

See also​

reactable_sdv_legend​

reactable_sdv_legend(
*,
colors: Any,
labels: Any = None,
bins: int | None = None,
title: Any = None,
footer: Any = None,
) -> htmltools._core.Tag

A color legend: a row of swatches with a label under each, for reactable_sdv_frame(legend=...).

Arguments​

NameTypeDescription
colorsAnyThe legend's colors, low to high, as hex strings.
labelsAnyOne label per swatch (numbers or text); None for swatches alone.
binsint | NoneThe number of swatches, spread evenly along colors as a ramp (reactablefmtr's bins); None for one swatch per color.
titleAnyText above the swatches.
footerAnySmall grey text under them.

Returns​

htmltools.Tag — The legend.

Raises​

  • InputError: (a ValueError) If colors is empty or not hex colors, bins is not a whole number of at least 2, or labels does not have one entry per swatch.

Example​

from sdvplot.reactable import reactable_sdv_legend

reactable_sdv_legend(colors=["#15607a", "#ffffff", "#fa8c00"], bins=5, labels=[-0.2, -0.1, 0, 0.1, 0.2],
title="EPA per play", footer="lower is better on defense")

See also​

reactable_sdv_logos​

reactable_sdv_logos(
*,
league: str,
variant: str = 'default',
height: Any = 30,
default_img: str | None = None,
season: Any = None,
include_name: bool = False,
id_system: Literal['auto', 'team_id', 'espn', 'espn_abbr', 'nhl', 'nflverse', 'mlbstats', 'nba_api', 'hockeytech', 'ncaa', 'pff', 'cricinfo', 'cfbd', 'bref', 'sportsipy', 'fangraphs', 'sdvplotr', 'name', 'nhl_id'] = 'auto',
strict: bool = False,
**column_kwargs: Any,
) -> reactable.models.Column

A reactable column that shows each cell's team as its logo.

Arguments​

NameTypeDescription
leaguestrThe SDV league key, e.g. "nfl".
variantstr"default", "dark", or a named variant from marks().
heightAnyThe image height in pixels.
default_imgstr | NoneAn image URL for values that do not resolve; None keeps their text.
seasonAnyOne season whose marks every cell shows; None for today's.
include_nameboolKeep the cell's text after the logo.
id_systemLiteral['auto', 'team_id', 'espn', 'espn_abbr', 'nhl', 'nflverse', 'mlbstats', 'nba_api', 'hockeytech', 'ncaa', 'pff', 'cricinfo', 'cfbd', 'bref', 'sportsipy', 'fangraphs', 'sdvplotr', 'name', 'nhl_id']The id system of the column's values, as in resolve: "auto" tries each in order; NHL stats ids need "nhl_id".
strictboolRaise UnresolvedTeamError (when the Reactable is built) instead of warning when a value does not resolve.
**column_kwargsAnyPassed to reactable.Column: id (the data column, required by reactable), name, width, ...

Returns​

reactable.Column — The column, with html=True and a cell renderer.

Raises​

  • InputError: (a ValueError) If height is not a number of pixels of at least 1, or season is not one year or is outside the seasons sdvplot knows for the league; when the Reactable is built, if league, id_system or variant is unknown.
  • UnresolvedTeamError: (a ValueError) If strict=True and a value does not resolve, when the Reactable is built.
  • OfflineError: When the Reactable is built, if the logo manifest cannot be downloaded and no cached copy exists (a DownloadError, also an OSError, when the CDN answers with an error status).
  • UnsafeDownloadError: (an OSError) When the Reactable is built, if the manifest download is refused: larger than the byte cap, past the deadline, or redirected away from https.

Example​

from reactable import Reactable
from sdvplot.reactable import reactable_sdv_logos
import pandas as pd

df = pd.DataFrame(
{
"team": ["KC", "BUF", "BAL"],
"espn_id": ["3139477", "3918298", "3916387"],
"wins": [12, 10, 9],
}
)

Reactable(df, columns=[reactable_sdv_logos(league="nfl", id="team", name="")])

See also​

reactable_sdv_merge_column​

reactable_sdv_merge_column(
data: Any,
*,
merged_name: str,
merged_position: Literal['right', 'left', 'above', 'below'] = 'right',
merged_size: float = 12,
merged_color: str = '#777',
merged_weight: Literal['normal', 'bold'] = 'normal',
size: float = 14,
color: str | None = None,
weight: Literal['normal', 'bold'] = 'bold',
spacing: float = 0,
mark: Literal['logo', 'headshot', 'wordmark'] | None = None,
mark_col: str | None = None,
team_col: str | None = None,
league: str | None = None,
mark_height: float = 30,
tooltip: bool = False,
season: Any = None,
id_system: Literal['auto', 'team_id', 'espn', 'espn_abbr', 'nhl', 'nflverse', 'mlbstats', 'nba_api', 'hockeytech', 'ncaa', 'pff', 'cricinfo', 'cfbd', 'bref', 'sportsipy', 'fangraphs', 'sdvplotr', 'name', 'nhl_id'] = 'auto',
strict: bool = False,
**column_kwargs: Any,
) -> reactable.models.Column

A reactable column that shows a second column's value beside or below each value, after an optional mark.

A player and his team, a team and its record; the mark is the row's logo, headshot or wordmark.

Arguments​

NameTypeDescription
dataAnyThe pandas or polars DataFrame passed to Reactable (the merged values are read from it).
merged_namestrThe column of data merged into this one (hide it with Column(show=False) if it is shown).
merged_positionLiteral['right', 'left', 'above', 'below']"right", "left", "above" or "below".
merged_sizefloatThe merged text's size in pixels.
merged_colorstrThe merged text's color (hex, a CSS color name, or rgb()/hsl()).
merged_weightLiteral['normal', 'bold']"normal" or "bold" for the merged text.
sizefloatThe main text's size in pixels.
colorstr | NoneThe main text's color (hex, a CSS color name, or rgb()/hsl()); None inherits the table's.
weightLiteral['normal', 'bold']"normal" or "bold" for the main text.
spacingfloatExtra pixels between the two values.
markLiteral['logo', 'headshot', 'wordmark'] | None"logo", "headshot" or "wordmark": an image before the text.
mark_colstr | NoneThe column the mark is read from; defaults to team_col, then this column. Headshots need ESPN athlete ids.
team_colstr | NoneA column of team values for the logo or wordmark.
leaguestr | NoneThe SDV league key, e.g. "nfl"; needed by mark.
mark_heightfloatThe mark's height in pixels.
tooltipboolGive each cell a title (hover text) of its value and the merged value.
seasonAnyOne season whose marks to use; None for today's.
id_systemLiteral['auto', 'team_id', 'espn', 'espn_abbr', 'nhl', 'nflverse', 'mlbstats', 'nba_api', 'hockeytech', 'ncaa', 'pff', 'cricinfo', 'cfbd', 'bref', 'sportsipy', 'fangraphs', 'sdvplotr', 'name', 'nhl_id']The id system of the mark's column, as in resolve.
strictboolRaise UnresolvedTeamError instead of warning when a team does not resolve.
**column_kwargsAnyPassed to reactable.Column; id names the column drawn.

Returns​

reactable.Column — The column, with html=True and a cell renderer.

Raises​

  • InputError: (a ValueError) If merged_position, a weight or mark is unknown, a color is not a color, or mark comes without league or a column to read it from.
  • ValueError: If a named column is not in data.
  • UnresolvedTeamError: (a ValueError) If strict=True and a team does not resolve.

Example​

import pandas as pd
from reactable import Column, Reactable
from sdvplot.reactable import reactable_sdv_merge_column

df = pd.DataFrame({"team": ["KC", "BUF", "BAL"], "record": ["15-2", "13-4", "12-5"]})

Reactable(
df,
columns=[
reactable_sdv_merge_column(df, merged_name="record", merged_position="below", mark="logo",
team_col="team", league="nfl", id="team"),
Column(id="record", show=False),
],
)

See also​

reactable_sdv_pill_buttons​

reactable_sdv_pill_buttons(
data: Any,
*,
colors: str | collections.abc.Sequence[str] = '#15607A',
color_ref: str | None = None,
team_col: str | None = None,
league: str | None = None,
which: Literal['primary', 'secondary'] = 'primary',
opacity: float = 1,
number_fmt: collections.abc.Callable[[Any], str] | str | None = None,
text_color: str | None = None,
brighten_text: bool = True,
show_text: bool = True,
bold_text: bool = False,
box_shadow: bool = False,
tooltip: bool = False,
season: Any = None,
id_system: Literal['auto', 'team_id', 'espn', 'espn_abbr', 'nhl', 'nflverse', 'mlbstats', 'nba_api', 'hockeytech', 'ncaa', 'pff', 'cricinfo', 'cfbd', 'bref', 'sportsipy', 'fangraphs', 'sdvplotr', 'name', 'nhl_id'] = 'auto',
strict: bool = False,
**column_kwargs: Any,
) -> reactable.models.Column

A reactable column whose values sit in rounded pills, in a scale color, a color column or the team color.

Numbers are colored on the scale, text takes the first color.

Arguments​

NameTypeDescription
dataAnyThe pandas or polars DataFrame passed to Reactable (ranges and per-row colors are read from it).
colorsstr | collections.abc.Sequence[str]One hex color, or several forming a scale from the column's minimum to its maximum (numbers only).
color_refstr | NoneA column of data holding each row's pill color: hex, a CSS color name, or rgb()/hsl(); any other value is warned about once and that row keeps the scale color.
team_colstr | NoneA column of team values; each pill takes that team's color (which).
leaguestr | NoneThe SDV league key, e.g. "nfl"; needed by team_col.
whichLiteral['primary', 'secondary']"primary" or "secondary" team color.
opacityfloatThe pill's opacity, 0 to 1.
number_fmtcollections.abc.Callable[[Any], str] | str | NoneA function of the value returning its text, or a format spec such as ",.1f".
text_colorstr | NoneThe text color; None for black, or white on a dark pill.
brighten_textboolSwitch the text to black or white when text_color is unreadable on the pill.
show_textboolShow the value; False leaves an empty pill.
bold_textboolBold text.
box_shadowboolA drop shadow under each pill.
tooltipboolGive each cell a title (hover text) of its formatted value.
seasonAnyOne season whose team colors to use; None for today's.
id_systemLiteral['auto', 'team_id', 'espn', 'espn_abbr', 'nhl', 'nflverse', 'mlbstats', 'nba_api', 'hockeytech', 'ncaa', 'pff', 'cricinfo', 'cfbd', 'bref', 'sportsipy', 'fangraphs', 'sdvplotr', 'name', 'nhl_id']The id system of team_col, as in resolve.
strictboolRaise UnresolvedTeamError instead of warning when a team does not resolve.
**column_kwargsAnyPassed to reactable.Column; id names the column drawn.

Returns​

reactable.Column — The column, with html=True and a cell renderer.

Raises​

  • InputError: (a ValueError) If opacity is outside [0, 1], team_col comes without league, or color_ref and team_col are both given.
  • ValueError: If colors are not hex colors, or a named column is not in data.
  • UnresolvedTeamError: (a ValueError) If strict=True and a team does not resolve.

Example​

import pandas as pd
from reactable import Reactable
from sdvplot.reactable import reactable_sdv_pill_buttons

df = pd.DataFrame({"team": ["KC", "BUF", "BAL"], "conf": ["AFC West", "AFC East", "AFC North"]})

Reactable(df, columns=[reactable_sdv_pill_buttons(df, team_col="team", league="nfl", id="conf")])

See also​

reactable_sdv_sparkbar​

reactable_sdv_sparkbar(
data: Any,
*,
fill_color: str | None = None,
team_col: str | None = None,
league: str | None = None,
which: Literal['primary', 'secondary'] = 'primary',
id_system: Literal['auto', 'team_id', 'espn', 'espn_abbr', 'nhl', 'nflverse', 'mlbstats', 'nba_api', 'hockeytech', 'ncaa', 'pff', 'cricinfo', 'cfbd', 'bref', 'sportsipy', 'fangraphs', 'sdvplotr', 'name', 'nhl_id'] = 'auto',
strict: bool = False,
season: Any = None,
na_color: str = '#b3b3b3',
fill_opacity: float = 1,
highlight_bars: collections.abc.Sequence[str] | collections.abc.Mapping[str, str] = (),
statline: str | None = None,
statline_color: str = 'red',
statline_label_size: str = '0.8em',
bandline: str | None = None,
bandline_color: str = 'red',
bandline_opacity: float = 0.2,
labels: collections.abc.Sequence[str] | str = (),
label_size: str = '0.8em',
decimals: int = 0,
min_value: float | None = None,
max_value: float | None = None,
height: float = 22,
width: float | None = None,
**column_kwargs: Any,
) -> reactable.models.Column

A reactable column that draws each cell's list of numbers as a small bar chart (an inline SVG).

Bars stand on zero: positive values rise from it, negative ones hang below it.

Arguments​

NameTypeDescription
dataAnyThe pandas or polars DataFrame passed to Reactable; read only for team_col. The column itself holds one list per row; a missing entry leaves a gap, an empty, missing or non-list cell is left blank.
fill_colorstr | NoneThe bars' CSS color; None for reactablefmtr's "slategray" (or the row's team color).
team_colstr | NoneA column of data holding each row's team: the bars take that team's color.
leaguestr | NoneThe SDV league key of team_col's teams, e.g. "wnba"; required with team_col.
whichLiteral['primary', 'secondary']"primary" or "secondary" team color.
id_systemLiteral['auto', 'team_id', 'espn', 'espn_abbr', 'nhl', 'nflverse', 'mlbstats', 'nba_api', 'hockeytech', 'ncaa', 'pff', 'cricinfo', 'cfbd', 'bref', 'sportsipy', 'fangraphs', 'sdvplotr', 'name', 'nhl_id']The id system of team_col, as in resolve.
strictboolRaise UnresolvedTeamError instead of warning when a team does not resolve.
seasonAnyOne season for every row's team color, for teams whose colors changed; None for today's.
na_colorstrThe color for teams that do not resolve or have no color.
fill_opacityfloatThe bars' opacity, 0 to 1.
highlight_barscollections.abc.Sequence[str] | collections.abc.Mapping[str, str]Bars to recolor: a mapping such as {"max": "gold"} (reactablefmtr's highlight_bars(max = "gold")), or a sequence of "first", "last", "min", "max" drawn in red.
statlinestr | NoneA dashed reference line at the series' "mean", "median", "min" or "max", labeled at its right.
statline_colorstrThe reference line's and its label's color.
statline_label_sizestrThe reference line label's CSS font size.
bandlinestr | NoneA shaded band across the series' "innerquartiles" or "range".
bandline_colorstrThe band's color.
bandline_opacityfloatThe band's opacity, 0 to 1.
labelscollections.abc.Sequence[str] | strValues to print above their bars: "first", "last", "min", "max" or "all".
label_sizestrThe labels' CSS font size.
decimalsintDecimal places of the labels and the statline label.
min_valuefloat | NoneThe value at the bottom of every cell's chart; None for the lower of 0 and the series' minimum.
max_valuefloat | NoneThe value at the top of every cell's chart; None for the higher of 0 and the series' maximum.
heightfloatThe chart's height in pixels.
widthfloat | NoneThe chart's width in pixels; None for 100.
**column_kwargsAnyPassed to reactable.Column (id is required by reactable).

Returns​

reactable.Column — The column, with html=True and a cell renderer; each chart is an <svg role="img"> whose aria-label gives the number of bars, the minimum, the maximum and the last value.

Raises​

  • InputError: (a ValueError) As reactable_sdv_sparkline: a bad pixel size, opacity, option name, decimals or bounds, or team_col without league; if league, id_system, which or season is unknown. When a cell is drawn: as reactable_sdv_sparkline.
  • ValueError: If team_col is not a column of data.
  • UnresolvedTeamError: (a ValueError) If strict=True and a team does not resolve.

Example​

import pandas as pd
from reactable import Reactable
from sdvplot.reactable import reactable_sdv_sparkbar

df = pd.DataFrame({"team": ["LV", "NY"], "pts": [[88, 95, 79, 101], [92, 85, 99, 90]]})
Reactable(df, columns=[reactable_sdv_sparkbar(df, id="pts", team_col="team", league="wnba",
highlight_bars={"max": "gold"})])

See also​

  • Equivalent of reactablefmtr::react_sparkbar (drawn without dataui: no hover tooltips per bar, bars rooted at zero so the smallest bar still shows).

reactable_sdv_sparkline​

reactable_sdv_sparkline(
data: Any,
*,
line_color: str | None = None,
team_col: str | None = None,
league: str | None = None,
which: Literal['primary', 'secondary'] = 'primary',
id_system: Literal['auto', 'team_id', 'espn', 'espn_abbr', 'nhl', 'nflverse', 'mlbstats', 'nba_api', 'hockeytech', 'ncaa', 'pff', 'cricinfo', 'cfbd', 'bref', 'sportsipy', 'fangraphs', 'sdvplotr', 'name', 'nhl_id'] = 'auto',
strict: bool = False,
season: Any = None,
na_color: str = '#b3b3b3',
line_width: float = 1.5,
show_area: bool = False,
area_color: str | None = None,
area_opacity: float = 0.1,
highlight_points: collections.abc.Sequence[str] | collections.abc.Mapping[str, str] = (),
point_size: float = 1.5,
statline: str | None = None,
statline_color: str = 'red',
statline_label_size: str = '0.8em',
bandline: str | None = None,
bandline_color: str = 'red',
bandline_opacity: float = 0.2,
labels: collections.abc.Sequence[str] | str = (),
label_size: str = '0.8em',
decimals: int = 0,
min_value: float | None = None,
max_value: float | None = None,
height: float = 22,
width: float | None = None,
**column_kwargs: Any,
) -> reactable.models.Column

A reactable column that draws each cell's list of numbers as a sparkline (an inline SVG).

Arguments​

NameTypeDescription
dataAnyThe pandas or polars DataFrame passed to Reactable; read only for team_col. The column itself holds one list per row (a polars List column, or a pandas column of lists); a missing entry breaks the line, an empty, missing or non-list cell is left blank.
line_colorstr | NoneThe line's CSS color; None for reactablefmtr's "slategray" (or the row's team color).
team_colstr | NoneA column of data holding each row's team: the line (and area) take that team's color.
leaguestr | NoneThe SDV league key of team_col's teams, e.g. "nba"; required with team_col.
whichLiteral['primary', 'secondary']"primary" or "secondary" team color.
id_systemLiteral['auto', 'team_id', 'espn', 'espn_abbr', 'nhl', 'nflverse', 'mlbstats', 'nba_api', 'hockeytech', 'ncaa', 'pff', 'cricinfo', 'cfbd', 'bref', 'sportsipy', 'fangraphs', 'sdvplotr', 'name', 'nhl_id']The id system of team_col, as in resolve.
strictboolRaise UnresolvedTeamError instead of warning when a team does not resolve.
seasonAnyOne season for every row's team color, for teams whose colors changed; None for today's.
na_colorstrThe color for teams that do not resolve or have no color.
line_widthfloatThe line's stroke width in pixels.
show_areaboolFill the area under the line.
area_colorstr | NoneThe area's color; None for the line's.
area_opacityfloatThe area's opacity, 0 to 1.
highlight_pointscollections.abc.Sequence[str] | collections.abc.Mapping[str, str]Points to mark: a mapping such as {"min": "red", "max": "blue"} (reactablefmtr's highlight_points(min = "red", max = "blue")), or a sequence of names drawn in red. Names are "first", "last", "min", "max" and "all".
point_sizefloatThe radius of a highlighted point, in pixels.
statlinestr | NoneA dashed reference line at the series' "mean", "median", "min" or "max", labeled at its right.
statline_colorstrThe reference line's and its label's color.
statline_label_sizestrThe reference line label's CSS font size.
bandlinestr | NoneA shaded band across the series' "innerquartiles" (25th to 75th percentile) or "range".
bandline_colorstrThe band's color.
bandline_opacityfloatThe band's opacity, 0 to 1.
labelscollections.abc.Sequence[str] | strValues to print by their point: names as for highlight_points ("all" labels every point).
label_sizestrThe labels' CSS font size.
decimalsintDecimal places of the labels and the statline label.
min_valuefloat | NoneThe value at the bottom of every cell's chart; None for each series' own minimum.
max_valuefloat | NoneThe value at the top of every cell's chart; None for each series' own maximum.
heightfloatThe chart's height in pixels; the default 22 grows to 28 or 30 to make room for labels above the points, as in reactablefmtr.
widthfloat | NoneThe chart's width in pixels; None for 100.
**column_kwargsAnyPassed to reactable.Column (id is required by reactable).

Returns​

reactable.Column — The column, with html=True and a cell renderer. Each chart is an <svg role="img"> whose aria-label (and <title> tooltip) gives the number of points, the minimum, the maximum and the last value.

Raises​

  • InputError: (a ValueError) If height/width is not a number of pixels of at least 1, an opacity is outside [0, 1], statline/bandline/labels/highlight_points names an unknown option, decimals is not a whole number, line_width/point_size is not a positive number, min_value/max_value is not a finite number or min_value is not below max_value, or team_col is given without league; if league, id_system, which or season is unknown. When a cell is drawn: if one bound crosses the row's data, or (with team_col) the table has more rows than data.
  • ValueError: If team_col is not a column of data.
  • UnresolvedTeamError: (a ValueError) If strict=True and a team does not resolve.

Example​

import polars as pl
from reactable import Reactable
from sdvplot.reactable import reactable_sdv_sparkline

df = pl.DataFrame({"team": ["BOS", "NY"], "margin": [[12, -4, 8, 21], [3, 7, -10, 5]]})
Reactable(
df,
columns=[
reactable_sdv_sparkline(df, id="margin", team_col="team", league="nba",
highlight_points={"min": "red", "max": "blue"}, statline="mean"),
],
)

See also​

  • Equivalent of reactablefmtr::react_sparkline (drawn without dataui: no hover tooltips per point, a solid rather than hatched band, straight rather than cardinal-curve segments).

reactable_sdv_team_color_bar​

reactable_sdv_team_color_bar(
data: Any,
team_col: str,
*,
league: str,
which: Literal['primary', 'secondary'] = 'primary',
max_value: float | None = None,
na_color: str = '#b3b3b3',
id_system: Literal['auto', 'team_id', 'espn', 'espn_abbr', 'nhl', 'nflverse', 'mlbstats', 'nba_api', 'hockeytech', 'ncaa', 'pff', 'cricinfo', 'cfbd', 'bref', 'sportsipy', 'fangraphs', 'sdvplotr', 'name', 'nhl_id'] = 'auto',
strict: bool = False,
**column_kwargs: Any,
) -> reactable.models.Column

A reactable column whose cells hold a bar in the row's team color, as long as the value's share of the maximum.

Arguments​

NameTypeDescription
dataAnyThe pandas or polars DataFrame passed to Reactable (each row's team is read from it).
team_colstrThe column of data holding the teams.
leaguestrThe SDV league key, e.g. "nfl".
whichLiteral['primary', 'secondary']"primary" or "secondary" team color.
max_valuefloat | NoneThe value that fills the whole cell; None for the column's maximum.
na_colorstrThe CSS color for teams that do not resolve or have no color.
id_systemLiteral['auto', 'team_id', 'espn', 'espn_abbr', 'nhl', 'nflverse', 'mlbstats', 'nba_api', 'hockeytech', 'ncaa', 'pff', 'cricinfo', 'cfbd', 'bref', 'sportsipy', 'fangraphs', 'sdvplotr', 'name', 'nhl_id']The id system of team_col, as in resolve: "auto" tries each in order; NHL stats ids need "nhl_id".
strictboolRaise UnresolvedTeamError instead of warning when a team does not resolve.
**column_kwargsAnyPassed to reactable.Column; id names the styled column.

Returns​

reactable.Column — The column, with a style function.

Raises​

  • InputError: (a ValueError) If league or id_system is unknown, or which is not "primary"/"secondary".
  • ValueError: If team_col is not a column of data.
  • UnresolvedTeamError: (a ValueError) If strict=True and a team does not resolve.

Example​

import pandas as pd
from reactable import Reactable
from sdvplot.reactable import reactable_sdv_team_color_bar

df = pd.DataFrame(
{
"team": ["KC", "BUF", "BAL"],
"espn_id": ["3139477", "3918298", "3916387"],
"wins": [12, 10, 9],
}
)

Reactable(df, columns=[reactable_sdv_team_color_bar(df, "team", league="nfl", id="wins")])

See also​

reactable_sdv_team_color_bg​

reactable_sdv_team_color_bg(
data: Any,
team_col: str,
*,
league: str,
which: Literal['primary', 'secondary'] = 'primary',
alpha: float = 0.15,
na_color: str = '#b3b3b3',
id_system: Literal['auto', 'team_id', 'espn', 'espn_abbr', 'nhl', 'nflverse', 'mlbstats', 'nba_api', 'hockeytech', 'ncaa', 'pff', 'cricinfo', 'cfbd', 'bref', 'sportsipy', 'fangraphs', 'sdvplotr', 'name', 'nhl_id'] = 'auto',
strict: bool = False,
**column_kwargs: Any,
) -> reactable.models.Column

A reactable column whose cells are filled with the row's team color, mostly transparent.

Arguments​

NameTypeDescription
dataAnyThe pandas or polars DataFrame passed to Reactable (each row's team is read from it).
team_colstrThe column of data holding the teams.
leaguestrThe SDV league key, e.g. "nfl".
whichLiteral['primary', 'secondary']"primary" or "secondary" team color.
alphafloatThe fill's opacity, 0 to 1.
na_colorstrThe hex color for teams that do not resolve or have no color.
id_systemLiteral['auto', 'team_id', 'espn', 'espn_abbr', 'nhl', 'nflverse', 'mlbstats', 'nba_api', 'hockeytech', 'ncaa', 'pff', 'cricinfo', 'cfbd', 'bref', 'sportsipy', 'fangraphs', 'sdvplotr', 'name', 'nhl_id']The id system of team_col, as in resolve: "auto" tries each in order; NHL stats ids need "nhl_id".
strictboolRaise UnresolvedTeamError instead of warning when a team does not resolve.
**column_kwargsAnyPassed to reactable.Column; id names the styled column.

Returns​

reactable.Column — The column, with a style function.

Raises​

  • InputError: (a ValueError) If alpha is outside [0, 1], league or id_system is unknown, or which is not "primary"/"secondary".
  • ValueError: If team_col is not a column of data, or na_color is not a hex color.
  • UnresolvedTeamError: (a ValueError) If strict=True and a team does not resolve.

Example​

import pandas as pd
from reactable import Reactable
from sdvplot.reactable import reactable_sdv_team_color_bg

df = pd.DataFrame(
{
"team": ["KC", "BUF", "BAL"],
"espn_id": ["3139477", "3918298", "3916387"],
"wins": [12, 10, 9],
}
)

Reactable(df, columns=[reactable_sdv_team_color_bg(df, "team", league="nfl", id="team")])

See also​

reactable_sdv_theme​

reactable_sdv_theme(
name: str,
*,
mode: str = 'light',
font_size: float | None = None,
font_color: str | None = None,
header_font_size: float | None = None,
header_font_color: str | None = None,
background_color: str | None = None,
cell_padding: float | str | None = None,
centered: bool = False,
**theme_args: Any,
) -> reactable.models.Theme

One of reactablefmtr's 27 table themes, or any of the 122 surveyed registry themes (sdv_table_themes()).

A reactablefmtr name wins over a registry id. "espn", "fivethirtyeight" and "pff" are the reactablefmtr ports; the surveyed look of those sites is "espn-site", "fivethirtyeight-site" and "pff-site". A registry theme is built from its palette, fonts and sizes: the text, background, hairline, stripe and hover colors, the header label style, the body font and the cell padding.

Pass the result to Reactable(theme=...). (reactable.options.theme would set it for every table in the session, so the theme is returned rather than set.) The themes do not load a font: give reactable_sdv_frame(font=...) a Google font for that.

Arguments​

NameTypeDescription
namestrThe theme: "cerulean", "clean", "cosmo", "cyborg", "dark", "darkly", "default", "espn", "fivethirtyeight", "flatly", "hoverdark", "hoverlight", "journal", "lux", "midnight", "midnightblue", "minty", "no_lines", "nytimes", "pff", "sandstone", "sanfran", "slate", "spacelab", "sunrise", "superhero" or "void"; or a registry id such as "wikipedia", "datagolf" or "nejm".
modestr"light" (default) or "dark". A reactablefmtr theme has no dark variant, so "dark" is accepted only for the themes that are dark already ("cyborg", "dark", "darkly", "hoverdark", "midnight", "midnightblue", "slate", "superhero") and raises for the rest. A registry theme raises when it is light-only.
font_sizefloat | NoneThe body font size in pixels; None for the theme's.
font_colorstr | NoneThe body text color; None for the theme's.
header_font_sizefloat | NoneThe header font size in pixels; None for the theme's.
header_font_colorstr | NoneThe header text color; None for the theme's. "hoverdark" and "hoverlight" have none.
background_colorstr | NoneThe table background; None for the theme's (most light themes have none: the page shows).
cell_paddingfloat | str | NoneThe cell padding, pixels or a CSS string; None for the theme's.
centeredboolCenter cell content vertically (useful with images).
**theme_argsAnyThe theme's own extra arguments, by their reactablefmtr names: "nytimes" border_color, border_width; "sanfran" cell_color, cell_border_width, cell_border_color, pagination_color; "void" border_color, border_width, header_border_color, header_border_width.

Returns​

reactable.Theme — The theme.

Raises​

  • InputError: (a ValueError) If name is neither a reactablefmtr theme nor a registry id (close matches are named), mode is not "light" or "dark", mode="dark" is asked of a light theme, centered is not a bool, or an argument is not one the theme takes.

Example​

import pandas as pd
from reactable import Reactable
from sdvplot.reactable import reactable_sdv_theme

df = pd.DataFrame({"team": ["KC", "BUF", "BAL"], "wins": [12, 10, 9]})
Reactable(df, theme=reactable_sdv_theme("espn"))
Reactable(df, theme=reactable_sdv_theme("midnight", font_size=13, centered=True))
Reactable(df, theme=reactable_sdv_theme("wikipedia"))

See also​

reactable_sdv_theme_team​

reactable_sdv_theme_team(
team: Any,
league: str,
*,
font_size: float | None = 15,
font_color: str | None = None,
header_font_size: float | None = 15,
header_font_color: str | None = None,
background_color: str | None = None,
cell_padding: float | str | None = 6,
centered: bool = False,
season: Any = None,
id_system: Literal['auto', 'team_id', 'espn', 'espn_abbr', 'nhl', 'nflverse', 'mlbstats', 'nba_api', 'hockeytech', 'ncaa', 'pff', 'cricinfo', 'cfbd', 'bref', 'sportsipy', 'fangraphs', 'sdvplotr', 'name', 'nhl_id'] = 'auto',
) -> reactable.models.Theme

A table theme in a team's colors: the header filled with the primary color over a rule in the secondary,

stripes, hover and the current page button tinted with the primary, and every text color readable on its fill.

Arguments​

NameTypeDescription
teamAnyThe team, any value resolve accepts (an abbreviation, a name, an id).
leaguestrThe SDV league key, e.g. "nfl".
font_sizefloat | NoneThe body font size in pixels.
font_colorstr | NoneThe body text color as a hex color; None for black or white, whichever reads better on the background.
header_font_sizefloat | NoneThe header font size in pixels.
header_font_colorstr | NoneThe header text color as a hex color; None for black or white, whichever reads better on the primary.
background_colorstr | NoneThe table background as a hex color; None for white (the page shows through).
cell_paddingfloat | str | NoneThe cell padding, pixels or a CSS string.
centeredboolCenter cell content vertically (useful with images).
seasonAnyThe season whose colors to use; None for today's.
id_systemLiteral['auto', 'team_id', 'espn', 'espn_abbr', 'nhl', 'nflverse', 'mlbstats', 'nba_api', 'hockeytech', 'ncaa', 'pff', 'cricinfo', 'cfbd', 'bref', 'sportsipy', 'fangraphs', 'sdvplotr', 'name', 'nhl_id']The id system of team, as in resolve.

Returns​

reactable.Theme — The theme.

Raises​

  • InputError: (a ValueError) If league or id_system is unknown, centered is not a bool, or background_color, font_color or header_font_color is not a hex color.
  • UnresolvedTeamError: (a ValueError) If team does not resolve.

Example​

import pandas as pd
from reactable import Reactable
from sdvplot.reactable import reactable_sdv_theme_team

df = pd.DataFrame({"team": ["KC", "BUF", "BAL"], "wins": [12, 10, 9]})
Reactable(df, theme=reactable_sdv_theme_team("KC", "nfl"))

See also​

reactable_sdv_wordmarks​

reactable_sdv_wordmarks(
*,
league: str,
variant: str = 'default',
height: Any = 30,
default_img: str | None = None,
season: Any = None,
include_name: bool = False,
id_system: Literal['auto', 'team_id', 'espn', 'espn_abbr', 'nhl', 'nflverse', 'mlbstats', 'nba_api', 'hockeytech', 'ncaa', 'pff', 'cricinfo', 'cfbd', 'bref', 'sportsipy', 'fangraphs', 'sdvplotr', 'name', 'nhl_id'] = 'auto',
strict: bool = False,
**column_kwargs: Any,
) -> reactable.models.Column

A reactable column that shows each cell's team as its wordmark.

Arguments​

NameTypeDescription
leaguestrThe SDV league key, e.g. "nfl".
variantstr"default", "dark", or a named variant from marks().
heightAnyThe image height in pixels.
default_imgstr | NoneAn image URL for values that do not resolve; None keeps their text.
seasonAnyOne season whose marks every cell shows; None for today's.
include_nameboolKeep the cell's text after the wordmark.
id_systemLiteral['auto', 'team_id', 'espn', 'espn_abbr', 'nhl', 'nflverse', 'mlbstats', 'nba_api', 'hockeytech', 'ncaa', 'pff', 'cricinfo', 'cfbd', 'bref', 'sportsipy', 'fangraphs', 'sdvplotr', 'name', 'nhl_id']The id system of the column's values, as in resolve: "auto" tries each in order; NHL stats ids need "nhl_id".
strictboolRaise UnresolvedTeamError (when the Reactable is built) instead of warning when a value does not resolve.
**column_kwargsAnyPassed to reactable.Column (id is required by reactable).

Returns​

reactable.Column — The column, with html=True and a cell renderer.

Raises​

  • InputError: (a ValueError) If height is not a number of pixels of at least 1, or season is not one year or is outside the seasons sdvplot knows for the league; when the Reactable is built, if league, id_system or variant is unknown.
  • UnresolvedTeamError: (a ValueError) If strict=True and a value does not resolve, when the Reactable is built.
  • OfflineError: When the Reactable is built, if the logo manifest cannot be downloaded and no cached copy exists (a DownloadError, also an OSError, when the CDN answers with an error status).
  • UnsafeDownloadError: (an OSError) When the Reactable is built, if the manifest download is refused: larger than the byte cap, past the deadline, or redirected away from https.

Example​

import pandas as pd
from reactable import Reactable
from sdvplot.reactable import reactable_sdv_wordmarks

df = pd.DataFrame(
{
"team": ["KC", "BUF", "BAL"],
"espn_id": ["3139477", "3918298", "3916387"],
"wins": [12, 10, 9],
}
)

Reactable(df, columns=[reactable_sdv_wordmarks(league="nfl", id="team")])

See also​