tsb — DataFrame Playground
🗃️ DataFrame — Interactive Playground
DataFrame is the heart of tsb: a
two-dimensional, column-oriented table where every column is a typed
Series. It mirrors pandas.DataFrame with a fully
strict TypeScript API.
Edit any code block below and press ▶ Run
(or Ctrl+Enter) to execute it live in your browser.
Construction
Three factory methods cover the most common shapes of input data:
fromColumns, fromRecords, and from2D.
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent
Properties
Inspect the shape, dimensionality, size, and axes of a DataFrame.
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent
Column Access
Retrieve columns with col() (throws if missing),
get() (returns undefined), and check existence with has().
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent
Slicing
Select rows by position with head(), tail(),
iloc(), or by label with loc().
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent
Column Mutations
All mutation methods return a new
DataFrame — tsb is immutable. Use assign(), drop(),
select(), and rename().
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent
Missing Values
Detect, drop, and fill null values across the entire DataFrame.
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent
Aggregations
Column-wise aggregates: sum(), mean(),
min(), max(), count(), and the
all-in-one describe().
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent
Sorting
Sort rows by column values with sortValues() or by the
index with sortIndex().
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent
Apply & Iteration
Use apply() to run a function over columns (axis 0) or rows
(axis 1). Iterate with items() and iterrows().
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent
Conversion
Convert between DataFrames and plain JavaScript structures.
Use setIndex() and resetIndex() to manipulate
the row index.
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent
🧪 Try It Yourself
Write your own tsb code below. All exports from tsb are available:
DataFrame, Series, Index, Dtype, and more.
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent