from keecas import symbols
from keecas.dataframe import create_dataframe
# Create empty structure
x, y = symbols(r"x, y")
df = create_dataframe(None, [x, y], width=3)
dfDataframe({x: [None, None, None], y: [None, None, None]}, shape=(2, 3))
Create a pre-sized Dataframe with specified shape and initial values.
Factory function for creating Dataframes with predetermined dimensions. Useful when you know the final structure upfront and want to initialize all cells with specific patterns or values.
| Name | Type | Description | Default |
|---|---|---|---|
| seed | Any |
Initial values to populate the Dataframe. Can be: - Scalar (Any): Same value repeated across all cells - list: Values applied to all rows, padded with default_value if shorter - dict: Per-row initialization (supports mixed list/scalar values per key) - Dataframe: Copy values from existing Dataframe - None: Fill all cells with default_value | required |
| keys | list[Hashable] |
List of keys (row labels) for the Dataframe. These become the symbol keys in LaTeX output when used with show_eqn(). | required |
| width | int |
Number of columns in the Dataframe (number of cells per row). | required |
| default_value | Any |
Value used to fill missing entries when seed doesn’t cover all cells. Defaults to None. | None |
| Name | Type | Description |
|---|---|---|
| Dataframe | New Dataframe with specified shape (len(keys), width) and initialized values. |
Dataframe({x: [None, None, None], y: [None, None, None]}, shape=(2, 3))
\(\displaystyle \left\{ x : \left[ 0, \ 0, \ 0\right], \ y : \left[ 0, \ 0, \ 0\right]\right\}\)
\(\displaystyle \left\{ x : \left[ 1, \ 2\right], \ y : \left[ 1, \ 2\right]\right\}\)