wandb.Tableto log data to visualize and query with W&B. In this guide, learn how to:
wandb.Tableconstructor in one of two ways:
wandb.Table(columns=["a", "b", "c"], data=[["1a", "1b", "1c"], ["2a", "2b", "2c"]])generates a table with two rows and three columns.
wandb.Table(dataframe=my_df). Column names will be extracted from the DataFrame.
table.add_data("3a", "3b", "3c"). Note that the new row is not represented as a list. If your row is in list format, use star notation to expand the list to positional arguments:
table.add_data(*my_row_list). The row must contain the same number of entries as there are columns in the table.
table.add_column(name="col_name", data=col_data). Note that the length of
col_datamust be equal to the table's current number of rows. Here,
col_datacan be a list data, or a Numpy NDArray.
for ndx, row in table.iterrows(): ...to efficiently iterate over the data's rows.
table.get_column("col_name"). As a convenience, users can pass
convert_to="numpy"to convert the column to a Numpy NDArray of primitives. This is useful if your column contains media types such as wandb.Image so that you can access the underlying data directly.
wandb.log()to save your table to the run, like so:
artifact.add()to log tables to the Artifacts section of your run instead of the workspace. This could be useful if you have a dataset that you want to log once and then reference for future runs. Refer to this colab for a detailed example of artifact.add() →