class Table
The Table class used to display and analyze tabular data.
Unlike traditional spreadsheets, Tables support numerous types of data: scalar values, strings, numpy arrays, and most subclasses of wandb.data_types.Media
. This means you can embed Images
, Video
, Audio
, and other sorts of rich, annotated media directly in Tables, alongside other traditional scalar values.
This class is the primary class used to generate W&B Tables https://docs.wandb.ai/models/tables/.
method Table.__init__
columns
: (List[str]) Names of the columns in the table. Defaults to [“Input”, “Output”, “Expected”].data
: (List[List[any]]) 2D row-oriented array of values.dataframe
: (pandas.DataFrame) DataFrame object used to create the table. When set,data
andcolumns
arguments are ignored.rows
: (List[List[any]]) 2D row-oriented array of values.optional
: (Union[bool,List[bool]]) Determines ifNone
values are allowed. Default to True- If a singular bool value, then the optionality is enforced for all columns specified at construction time
- If a list of bool values, then the optionality is applied to each column - should be the same length as
columns
applies to all columns. A list of bool values applies to each respective column.
allow_mixed_types
: (bool) Determines if columns are allowed to have mixed types (disables type validation). Defaults to Falselog_mode
: Optional[str] Controls how the Table is logged when mutations occur. Options:- “IMMUTABLE” (default): Table can only be logged once; subsequent logging attempts after the table has been mutated will be no-ops.
- “MUTABLE”: Table can be re-logged after mutations, creating a new artifact version each time it’s logged.
- “INCREMENTAL”: Table data is logged incrementally, with each log creating a new artifact entry containing the new data since the last log.
method Table.add_column
name
: (str) - the unique name of the columndata
: (list | np.array) - a column of homogeneous dataoptional
: (bool) - if null-like values are permitted
method Table.add_computed_columns
fn
: A function which accepts one or two parameters, ndx (int) and row (dict), which is expected to return a dict representing new columns for that row, keyed by the new column names.ndx
is an integer representing the index of the row. Only included ifinclude_ndx
is set toTrue
.row
is a dictionary keyed by existing columns
method Table.add_data
wandb.Table.MAX_ARTIFACT_ROWS
.
The length of the data should match the length of the table column.
method Table.add_row
Table.add_data
method instead.
method Table.cast
col_name
(str): The name of the column to cast.dtype
(class, wandb.wandb_sdk.interface._dtypes.Type, any): The target dtype.optional
(bool): If the column should allow Nones.
method Table.get_column
name
: (str) - the name of the columnconvert_to
: (str, optional)- “numpy”: will convert the underlying data to numpy object
method Table.get_dataframe
pandas.DataFrame
of the table.