Skip to main content
Use the W&B Python Library to log a CSV file and visualize it in a W&B Dashboard. W&B Dashboard are the central place to organize and visualize results from your machine learning models. This is particularly useful if you have a CSV file that contains information of previous machine learning experiments that are not logged in W&B or if you have CSV file that contains a dataset.

Import and log your dataset CSV file

We suggest you use W&B Artifacts to make the contents of the CSV file easier to re-use.
  1. To get started, first import your CSV file. In the following code snippet, replace the iris.csv filename with the name of your CSV filename:
  1. Convert the CSV file to a W&B Table to utilize W&B Dashboards.
  1. Next, create a W&B Artifact and add the table to the Artifact:
For more information about W&B Artifacts, see the Artifacts chapter.
  1. Lastly, start a new W&B Run to track and log to W&B with wandb.init():
The wandb.init() API spawns a new background process to log data to a Run, and it synchronizes data to wandb.ai (by default). View live visualizations on your W&B Workspace Dashboard. The following image demonstrates the output of the code snippet demonstration.
CSV file imported into W&B Dashboard
The full script with the preceding code snippets is found below:

Import and log your CSV of Experiments

In some cases, you might have your experiment details in a CSV file. Common details found in such CSV files include:
  • A name for the experiment run
  • Initial notes
  • Tags to differentiate the experiments
  • Configurations needed for your experiment (with the added benefit of being able to utilize our Sweeps Hyperparameter Tuning).
W&B can take CSV files of experiments and convert it into a W&B Experiment Run. The following code snippets and code script demonstrates how to import and log your CSV file of experiments:
  1. To get started, first read in your CSV file and convert it into a Pandas DataFrame. Replace "experiments.csv" with the name of your CSV file:
  1. Next, start a new W&B Run to track and log to W&B with wandb.init():
As an experiment runs, you might want to log every instance of your metrics so they are available to view, query, and analyze with W&B. Use the run.log() command to accomplish this:
You can optionally log a final summary metric to define the outcome of the run using the define_metric API. This example adds the summary metrics to our run with run.summary.update():
For more information about summary metrics, see Log Summary Metrics. Below is the full example script that converts the above sample table into a W&B Dashboard: