diff --git a/docs/guides/tables/tables-create.md b/docs/guides/tables/tables-create.md new file mode 100644 index 000000000..c3e13624f --- /dev/null +++ b/docs/guides/tables/tables-create.md @@ -0,0 +1,87 @@ +--- +description: Create tables with W&B. +displayed_sidebar: default +--- + +# Create a table + +Unlike traditional spreadsheets, Tables support numerous types of data. This includes +scalar values, strings, NumPy arrays, and most subclasses of `wandb.data_types.Media`. +You can embed `Images`, `Video`, `Audio`, and other sorts of rich, annotated media +directly in Tables, alongside other traditional scalar values. + +Construct tables with initial data by creating a dataframe: + + +```python +import pandas as pd +import wandb + +#Intialize the data +data = {"users": ["geoff", "juergen", "ada"], "feature_01": [1, 117, 42]} +#Turn the data into a dataframe. +df = pd.DataFrame(data) + +tbl = wandb.Table(data=df) +assert all(tbl.get_column("users") == df["users"]) +assert all(tbl.get_column("feature_01") == df["feature_01"]) +``` +## Add data + +Add data to Tables incrementally by using the +`add_data`, `add_column`, and `add_computed_column` functions for +adding rows, columns, and columns computed from data in other columns, respectively: + + +```python +import wandb + +tbl = wandb.Table(columns=["user"]) + +users = ["geoff", "juergen", "ada"] + +[tbl.add_data(user) for user in users] +assert tbl.get_column("user") == users + + +def get_user_name_length(index, row): + return {"feature_01": len(row["user"])} + + +tbl.add_computed_columns(get_user_name_length) +assert tbl.get_column("feature_01") == [5, 7, 3] +``` + +## Log data + +Log tables directly to runs with `run.log({"my_table": table})` +or add them to artifacts using `artifact.add(table, "my_table")`: + + +```python +import numpy as np +import wandb + +wandb.init() + +tbl = wandb.Table(columns=["image", "label"]) + +images = np.random.randint(0, 255, [2, 100, 100, 3], dtype=np.uint8) +labels = ["panda", "gibbon"] +[tbl.add_data(wandb.Image(image), label) for image, label in zip(images, labels)] + +wandb.log({"classifier_out": tbl}) +``` + +Tables added directly to runs produces a corresponding Table Visualizer in the +Workspace which can further analyze data and export it to reports. + +Tables added to artifacts appear in the Artifact tab and render +an equivalent Table Visualizer directly in the artifact browser. + +## Best practices +Tables expect each value for a column to be of the same type. By default, a column supports optional values, but not mixed values. If you absolutely need to mix types, you can enable the `allow_mixed_types` flag which turns off type checking on the data. This results in some table analytics features turning off due to lack of consistent typing. + +## Next steps +- For more information about visualizing tables, see the [table visualization guide](./visualize-tables.md). +- For a more in-depth walkthrough of how to use tables, see the [walkthrough](tables-walkthrough.md). \ No newline at end of file diff --git a/docs/guides/tables/tables-download.md b/docs/guides/tables/tables-download.md index 8a4114ed4..242ee0c5e 100644 --- a/docs/guides/tables/tables-download.md +++ b/docs/guides/tables/tables-download.md @@ -1,5 +1,5 @@ --- -description: How to export data from tables. +description: Export data from tables. displayed_sidebar: default title: Export table data --- @@ -7,7 +7,7 @@ title: Export table data Like all W&B Artifacts, Tables can be converted into pandas dataframes for easy data exporting. ## Convert `table` to `artifact` -First, you'll need to convert the table to an artifact. The easiest way to do this using `artifact.get(table, "table_name")`: +First, convert the table to an artifact. The easiest way to do this using `artifact.get(table, "table_name")`: ```python # Create and log a new table. @@ -34,7 +34,7 @@ df = table.get_dataframe() ``` ## Export Data -Now you can export using any method dataframe supports: +Next, export using any method dataframe supports: ```python # Converting the table data to .csv diff --git a/docs/guides/tables/tables-navigate.md b/docs/guides/tables/tables-navigate.md new file mode 100644 index 000000000..4c22e252b --- /dev/null +++ b/docs/guides/tables/tables-navigate.md @@ -0,0 +1,37 @@ +--- +description: How to use the W&B platform to manage tables. +displayed_sidebar: default +--- + +# Manage Tables + +Once you've [created a table](./tables-create.md), you can use the W&B platform to analyze, customize, and manage your data. + +## The W&B Platform +When you first open your workspace, you will be presented with a simple visualization of your tables. Each table you create appears in a `panel` where you can further customize your data. + +You'll also notice a statement at the top of your panel. If you're following one of our example guides, it will look something like `runs.summary["Table Name"]`. You can edit this statement, which will be discussed later. + +In a default scenario, your table will display all of your runs, with each run having its own color so you can easily differentiate them. + +### Format Tables + + +## Run Commands +Clicking on the funnel icon will bring up the filter menu. This will allow you to run various commands to filter your data. For example, if you wanted to only show columns that were alphanumeric, you could write something like `row["a"].isAlnum`. + +Currently, you can filter by: +- index +- project +- row +- range + +For more information on visualizing tables, see our [full guide](./visualize-tables.md). + +## Export Data +You can easily export your table data to a .csv file by clicking the `Export to CSV` button, usually located at the bottom of a table's panel. Clicking this button automatically downloads a .csv file of your current table, with any formats or editing you have made. + +For more methods of exporting data, see our [full guide](./tables-download.md). + +## Next Steps +For a more in-depth walkthrough of how to use tables, see our [walkthrough](tables-walkthrough.md). \ No newline at end of file diff --git a/i18n/ja/docusaurus-plugin-content-docs/current/guides/tables/tables-create.md b/i18n/ja/docusaurus-plugin-content-docs/current/guides/tables/tables-create.md new file mode 100644 index 000000000..edc8c0f1d --- /dev/null +++ b/i18n/ja/docusaurus-plugin-content-docs/current/guides/tables/tables-create.md @@ -0,0 +1,86 @@ +--- +description: How to create tables. +displayed_sidebar: ja +--- + +# Create a Table + +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. + +Tables can be constructed with initial data using the `data` or +`dataframe` parameters: + + +```python +import pandas as pd +import wandb + +data = {"users": ["geoff", "juergen", "ada"], "feature_01": [1, 117, 42]} +df = pd.DataFrame(data) + +tbl = wandb.Table(data=df) +assert all(tbl.get_column("users") == df["users"]) +assert all(tbl.get_column("feature_01") == df["feature_01"]) +``` +## Add Data + +You can add data to Tables incrementally by using the +`add_data`, `add_column`, and `add_computed_column` functions for +adding rows, columns, and columns computed from data in other columns, respectively: + + +```python +import wandb + +tbl = wandb.Table(columns=["user"]) + +users = ["geoff", "juergen", "ada"] + +[tbl.add_data(user) for user in users] +assert tbl.get_column("user") == users + + +def get_user_name_length(index, row): + return {"feature_01": len(row["user"])} + + +tbl.add_computed_columns(get_user_name_length) +assert tbl.get_column("feature_01") == [5, 7, 3] +``` + +## Log Data + +Tables can be logged directly to runs using `run.log({"my_table": table})` +or added to artifacts using `artifact.add(table, "my_table")`: + + +```python +import numpy as np +import wandb + +wandb.init() + +tbl = wandb.Table(columns=["image", "label"]) + +images = np.random.randint(0, 255, [2, 100, 100, 3], dtype=np.uint8) +labels = ["panda", "gibbon"] +[tbl.add_data(wandb.Image(image), label) for image, label in zip(images, labels)] + +wandb.log({"classifier_out": tbl}) +``` + +Tables added directly to runs as above will produce a corresponding Table Visualizer in the +Workspace which can be used for further analysis and exporting to reports. + +Tables added to artifacts can be viewed in the Artifact Tab and will render +an equivalent Table Visualizer directly in the artifact browser. + +## Best Practices +Tables expect each value for a column to be of the same type. By default, a column supports optional values, but not mixed values. If you absolutely need to mix types, you can enable the `allow_mixed_types` flag which will disable type checking on the data. This will result in some table analytics features being disabled due to lack of consistent typing. + +## Next Steps +- For more information about visualizing tables, see our [table visualization guide](./visualize-tables.md). +- For a more in-depth walkthrough of how to use tables, see our [walkthrough](tables-walkthrough.md). \ No newline at end of file diff --git a/i18n/ja/docusaurus-plugin-content-docs/current/guides/tables/tables-navigate.md b/i18n/ja/docusaurus-plugin-content-docs/current/guides/tables/tables-navigate.md new file mode 100644 index 000000000..4960b5943 --- /dev/null +++ b/i18n/ja/docusaurus-plugin-content-docs/current/guides/tables/tables-navigate.md @@ -0,0 +1,34 @@ +--- +description: How to use the W&B platform to manage tables. +displayed_sidebar: ja +--- + +# Manage Tables + +Once you've [created a table](./tables-create.md), you can use the W&B platform to analyze, customize, and manage you data. + +## The W&B Platform +When you first open your workspace, you will be presented with a simple visualization of your tables. Each table you create appears in a `panel` where you can further customize your data. + +You'll also notice a statement on the top of your panel. If you're following one of our example guides, it will look something like `runs.summary["Table Name"]`. You can edit this statement, which will be discussed later. + +In a default scenario, your table will display all of your runs, with each run having its own color so you can easily differentiate them. + +## Run Commands +Clicking on the funnel icon will bring up the filter menu. This will allow you to run various commands to filter your data. For example, if you wanted to only show columns that were alphanumeric, you could write something like `row["a"].isAlnum`. + +Currently, you can filter by: +- index +- project +- row +- range + +For more information on visualizing tables, see our [full guide](./visualize-tables.md) + +## Export Data +You can easily export your table data to a .csv file by clicking the `Export to CSV` button, usually located at the bottom of a table's panel. Clicking this button automatically downloads a .csv file of your current table, with any formats or editing you have made. + +For more methods of exporting data, see our [full guide](./tables-download.md). + +## Next Steps +For a more in-depth walkthrough of how to use tables, see our [walkthrough](tables-walkthrough.md). \ No newline at end of file diff --git a/sidebars.js b/sidebars.js index 1da11a8d1..b4ef8945e 100644 --- a/sidebars.js +++ b/sidebars.js @@ -290,6 +290,8 @@ export default { label: 'Tables', link: {type: 'doc', id: 'guides/tables/intro'}, items: [ + 'guides/tables/tables-create', + 'guides/tables/tables-navigate', 'guides/tables/tables-walkthrough', 'guides/tables/visualize-tables', 'guides/tables/tables-gallery',