<jupyter_start><jupyter_text>[![AWS Data Wrangler](_static/logo.png "AWS Data Wrangler")](https://github.com/awslabs/aws-data-wrangler) 28 - Amazon DynamoDB  Writing Data<jupyter_code>import awswrangler as wr
import pandas as pd
from pathlib import Path<jupyter_output><empty_output><jupyter_text>Writing DataFrame<jupyter_code>df = pd.DataFrame({
    "key": [1, 2],
    "value": ["foo", "boo"]
})
wr.dynamodb.put_df(df=df, table_name="table")<jupyter_output><empty_output><jupyter_text>Writing CSV file<jupyter_code>filepath = Path("items.csv")
df.to_csv(filepath, index=False)
wr.dynamodb.put_csv(path=filepath, table_name="table")
filepath.unlink()<jupyter_output><empty_output><jupyter_text>Writing JSON files<jupyter_code>filepath = Path("items.json")
df.to_json(filepath, orient="records")
wr.dynamodb.put_json(path="items.json", table_name="table")
filepath.unlink()<jupyter_output><empty_output><jupyter_text>Writing list of items<jupyter_code>items = df.to_dict(orient="records")
wr.dynamodb.put_items(items=items, table_name="table")<jupyter_output><empty_output><jupyter_text>Deleting items<jupyter_code>wr.dynamodb.delete_items(items=items, table_name="table")<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1497504159733777, 'fraction_numerical': 0.0033277870216306157, 'mean_word_length': 11.03, 'pattern_counts': {'":': 2, '<': 25, '<?xml version=': 0, '>': 25, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '575434', 'license': 'Apache-2.0', 'n_tokens_mistral': 483, 'n_tokens_neox': 465, 'n_words': 56, 'path': 'tutorials/028 - DynamoDB.ipynb', 'repo_name': 'mateogianolio/aws-data-wrangler', 'size': '1202'}