テーブル データをエクスポート
テーブルからデータをエクスポートする方法。
less than a minute
すべての W&B Artifacts 同様に、Tables は pandas データフレームに変換して、データのエクスポートを簡単に行うことができます。
table
を artifact
に変換する
まず、テーブルをアーティファクトに変換する必要があります。これを行う最も簡単な方法は artifact.get(table, "table_name")
を使用することです:
# 新しいテーブルを作成してログします。
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)
# 作成したアーティファクトを使用してテーブルを取得します。
with wandb.init() as r:
artifact = r.use_artifact("my_dataset:latest")
table = artifact.get("my_table")
artifact
をデータフレームに変換する
次に、テーブルをデータフレームに変換します:
# 前のコード例から続けて:
df = table.get_dataframe()
データをエクスポート
現在、データフレームがサポートする任意のメソッドを使用してエクスポートできます:
# テーブルデータを .csv に変換
df.to_csv("example.csv", encoding="utf-8")
次のステップ
artifacts
に関する リファレンスドキュメント をチェックしてください。- Tables Walkthrough ガイドを確認してください。
- データフレーム リファレンスドキュメントを参照してください。
フィードバック
このページは役に立ちましたか?
Glad to hear it! If you have more to say, please let us know.
Sorry to hear that. Please tell us how we can improve.