# Unions
source: https://docs.chalk.ai/docs/chalkdf/transformations/unions

## Append batches of transactions with matching schemas.

Use a union to stack rows from batches that describe the same columns. Both inputs need matching column names and types.

```python
from chalkdf import DataFrame

tx = DataFrame({"user": ["a", "a", "b"], "amount": [12, 8, 30]})

later = DataFrame({"user": ["b", "c"], "amount": [30, 18]})
tx.union(later).order_by("amount").run()
```

| user · `string` | amount · `int64` |
| --------------- | ---------------- |
| a               | 8                |
| a               | 12               |
| c               | 18               |
| b               | 30               |
| b               | 30               |

The repeated transaction for b appears twice. A union keeps duplicates. Use [`union_all`](/dataframe-docs#DataFrame.union_all) when you have several batches, or [join](/docs/chalkdf/transformations/joins) to add columns by matching keys.

See [`DataFrame.union`](/dataframe-docs#DataFrame.union), [`DataFrame.union_all`](/dataframe-docs#DataFrame.union_all).





