> ## Documentation Index
> Fetch the complete documentation index at: https://docs.wandb.ai/llms.txt
> Use this file to discover all available pages before exploring further.

> W&B Table のデータを pandas DataFrames と CSV ファイルにエクスポートして、オフラインで分析やデータ処理を行います。

# テーブル データのエクスポート

すべての W\&B Artifacts と同様に、Tables は pandas のデータフレームに変換できるため、データを簡単にエクスポートできます。

<div id="convert-table-to-artifact">
  ## `table` を `artifact` に変換する
</div>

まず、`table` を Artifacts に変換する必要があります。これを行う最も簡単な方法は、`artifact.get(table, "table_name")` を使うことです。

```python theme={null}
# 新しいテーブルを作成してログに記録する。
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)

# 作成した Artifacts を使用して、作成済みのテーブルを取得する。
with wandb.init() as r:
    artifact = r.use_artifact("my_dataset:latest")
    table = artifact.get("my_table")
```

<div id="convert-artifact-to-dataframe">
  ## `artifact` をデータフレームに変換する
</div>

次に、そのテーブルをデータフレームに変換します。

```python theme={null}
# 前のコード例からの続き:
df = table.get_dataframe()
```

<div id="export-data">
  ## データのエクスポート
</div>

これで、`データフレーム` がサポートしている任意のエクスポート方法を使用してエクスポートできます。

```python theme={null}
# テーブルデータを .csv に変換する
df.to_csv("example.csv", encoding="utf-8")
```

<div id="next-steps">
  # 次のステップ
</div>

* `artifacts` については、[リファレンスドキュメント](/ja/models/artifacts/construct-an-artifact/)を参照してください。
* [Tables Walkthrough](/ja/models/tables/tables-walkthrough/) ガイドをご覧ください。
* [データフレーム](https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.html) のリファレンスドキュメントを参照してください。
