> ## Documentation Index
> Fetch the complete documentation index at: https://wb-21fd5541-style-guide-models-tables-20260604-114339.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> Export W&B Table data to pandas DataFrames and CSV files for offline analysis and data processing.

# Export table data

This page shows you how to export the data in a W\&B Table to a pandas DataFrame and then to a CSV file, so that you can analyze or process the data outside of W\&B.

## Convert a table to an artifact

To work with a logged table as a Table object, add the table to an artifact, log the artifact, then retrieve the table from the artifact:

1. Add the table to an artifact with `artifact.add(table, "my_table")`, then log the artifact:

   ```python theme={null}
   # Create and log a new table.
   with wandb.init() as r:
       artifact = wandb.Artifact("my_dataset", type="dataset")
       table = wandb.Table(
           columns=["a", "b", "c"], data=[(i, i * 2, 2**i) for i in range(10)]
       )
       artifact.add(table, "my_table")
       wandb.log_artifact(artifact)
   ```

2. Retrieve the table with `wandb.Artifact.get("my_table")`:

   ```python theme={null}
   # Retrieve the created table using the artifact you created.
   with wandb.init() as r:
       artifact = r.use_artifact("my_dataset:latest")
       table = artifact.get("my_table")
   ```

## Convert the artifact to a DataFrame

With the table retrieved from the artifact, convert it into a pandas DataFrame:

```python theme={null}
# Following from the last code example:
df = table.get_dataframe()
```

## Export data

With your data in a pandas DataFrame, you can export it using any method that pandas supports. For example, the following exports the data to a CSV file:

```python theme={null}
# Convert the table data to .csv
df.to_csv("example.csv", encoding="utf-8")
```

## Next steps

For more information, see the following resources:

* [Construct an artifact](/models/artifacts/construct-an-artifact/) for reference documentation on artifacts.
* [Tables walkthrough](/models/tables/tables-walkthrough/) for a guided tutorial.
* [pandas DataFrame reference](https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.html) for DataFrame API documentation.
