Loading tsb runtime…

← tsb playground

pdArray()

pdArray(data, dtype?) — create a typed array, mirroring pandas.array().

Basic usage — dtype inference

When no dtype is passed, pdArray infers the best dtype from the data: integers → "int64", floats → "float64", booleans → "bool", strings → "string", Dates → "datetime".

TypeScript
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent

Explicit dtype

Pass a dtype string to override inference.

TypeScript
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent

Null / NA values

null or undefined are treated as NA and preserved in the array.

TypeScript
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent

Iterating

PandasArray implements the iterator protocol — use for...of or spread.

TypeScript
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent