Chalk DataFrames
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.
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()| # | userstring | amountint64 |
|---|---|---|
| 1 | a | 8 |
| 2 | a | 12 |
| 3 | c | 18 |
| 4 | b | 30 |
| 5 | b | 30 |
The repeated transaction for b appears twice. A union keeps duplicates. Use union_all when you have several batches, or join to add columns by matching keys.