pandasx / DataFrame
Class: DataFrame
Defined in: src/frame.ts:72
Two-dimensional labeled table with typed columns, the equivalent of pandas.DataFrame.
Constructors
Constructor
new DataFrame(
data?,options?):DataFrame
Defined in: src/frame.ts:78
Parameters
| Parameter | Type |
|---|---|
data | FrameInput |
options | FrameOptions |
Returns
DataFrame
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
index | Index | Row labels; may be reassigned (same length), like df.index = [...]. | src/frame.ts:76 |
Accessors
columnIndex
Get Signature
get columnIndex():
Index
Defined in: src/frame.ts:154
Column labels as an Index; tuples (with level names) for MultiIndex columns.
Returns
columns
Get Signature
get columns():
string[]
Defined in: src/frame.ts:207
Returns
string[]
Set Signature
set columns(
names):void
Defined in: src/frame.ts:212
Renames all columns at once, like df.columns = [...].
Parameters
| Parameter | Type |
|---|---|
names | string[] |
Returns
void
dtypes
Get Signature
get dtypes():
Series
Defined in: src/frame.ts:242
Returns
empty
Get Signature
get empty():
boolean
Defined in: src/frame.ts:238
Returns
boolean
length
Get Signature
get length():
number
Defined in: src/frame.ts:230
Returns
number
nColumnLevels
Get Signature
get nColumnLevels():
number
Defined in: src/frame.ts:147
Number of column levels (1 for flat columns).
Returns
number
plot
Get Signature
get plot():
PlotAccessor
Defined in: src/frame.ts:1124
SVG charts: plot({ kind }) or plot.line(), plot.bar(), plot.hist(), ...
Returns
shape
Get Signature
get shape(): [
number,number]
Defined in: src/frame.ts:226
Returns
[number, number]
size
Get Signature
get size():
number
Defined in: src/frame.ts:234
Returns
number
style
Get Signature
get style():
Styler
Defined in: src/frame.ts:1278
Conditional formatting (Styler), like df.style.
Returns
T
Get Signature
get T():
DataFrame
Defined in: src/frame.ts:253
Transpose (columns become rows).
Returns
DataFrame
values
Get Signature
get values():
unknown[][]
Defined in: src/frame.ts:247
Rows as arrays (like df.values / to_numpy()).
Returns
unknown[][]
Methods
_fromTupleColumns()
static_fromTupleColumns(cols,index,names?):DataFrame
Defined in: src/frame.ts:124
Frame whose columns are labelled by tuples (a column MultiIndex).
Parameters
| Parameter | Type |
|---|---|
cols | readonly [readonly Label[], Column][] |
index | Index |
names? | readonly (string | null)[] |
Returns
DataFrame
[iterator]()
[iterator]():
IterableIterator<string>
Defined in: src/frame.ts:275
Returns
IterableIterator<string>
abs()
abs():
DataFrame
Defined in: src/frame.ts:827
Returns
DataFrame
add()
add(
other,options?):DataFrame
Defined in: src/frame.ts:1108
Parameters
| Parameter | Type |
|---|---|
other | DataFrame | Operand |
options | ArithOptions |
Returns
DataFrame
agg()
Call Signature
agg(
func):Series
Defined in: src/frame.ts:741
Aggregates columns. func may be a name/function (→ Series), a list (→ DataFrame with one row per aggregation) or {column: func | func[]}.
Parameters
| Parameter | Type |
|---|---|
func | AggFunc |
Returns
Call Signature
agg(
func):DataFrame
Defined in: src/frame.ts:742
Aggregates columns. func may be a name/function (→ Series), a list (→ DataFrame with one row per aggregation) or {column: func | func[]}.
Parameters
| Parameter | Type |
|---|---|
func | readonly AggFunc[] | Record<string, AggFunc | readonly AggFunc[]> |
Returns
DataFrame
all()
all(
options?):Series
Defined in: src/frame.ts:713
Parameters
| Parameter | Type |
|---|---|
options? | AxisAggOptions |
Returns
any()
any(
options?):Series
Defined in: src/frame.ts:712
Parameters
| Parameter | Type |
|---|---|
options? | AxisAggOptions |
Returns
apply()
Call Signature
apply(
fn,options?):DataFrame|Series
Defined in: src/frame.ts:844
axis: 0 (default) calls fn(series, column) per column; axis: 1 calls fn(row, label) per row with a plain object. Scalar results become a Series; Series / object results become a DataFrame.
Parameters
| Parameter | Type |
|---|---|
fn | (s, column) => unknown |
options? | { axis?: 0 | "index"; } |
options.axis? | 0 | "index" |
Returns
DataFrame | Series
Call Signature
apply(
fn,options):DataFrame|Series
Defined in: src/frame.ts:845
axis: 0 (default) calls fn(series, column) per column; axis: 1 calls fn(row, label) per row with a plain object. Scalar results become a Series; Series / object results become a DataFrame.
Parameters
| Parameter | Type |
|---|---|
fn | (row, label) => unknown |
options | { axis: 1 | "columns"; } |
options.axis | 1 | "columns" |
Returns
DataFrame | Series
applymap()
applymap(
fn):DataFrame
Defined in: src/frame.ts:870
Parameters
| Parameter | Type |
|---|---|
fn | (value) => unknown |
Returns
DataFrame
asfreq()
asfreq(
freq,options?):DataFrame
Defined in: src/frame.ts:1176
Conforms a datetime index to freq, optionally filling ('ffill' / 'bfill').
Parameters
| Parameter | Type |
|---|---|
freq | string | DateOffset |
options | { fillValue?: unknown; method?: "pad" | "ffill" | "bfill" | "backfill"; } |
options.fillValue? | unknown |
options.method? | "pad" | "ffill" | "bfill" | "backfill" |
Returns
DataFrame
assign()
assign(
columns):DataFrame
Defined in: src/frame.ts:331
Returns a new frame with extra/replaced columns; values may be functions of the frame.
Parameters
| Parameter | Type |
|---|---|
columns | Record<string, ColumnValue | ((df) => ColumnValue)> |
Returns
DataFrame
astype()
astype(
dtype,options?):DataFrame
Defined in: src/frame.ts:875
Casts all columns, or per column with {column: dtype}.
Parameters
| Parameter | Type |
|---|---|
dtype | DType | Record<string, DType> |
options | { categories?: readonly unknown[]; freq?: string; ordered?: boolean; } |
options.categories? | readonly unknown[] |
options.freq? | string |
options.ordered? | boolean |
Returns
DataFrame
at()
at(
row,column):unknown
Defined in: src/frame.ts:400
Single value by row label and column.
Parameters
| Parameter | Type |
|---|---|
row | Label |
column | string |
Returns
unknown
atTime()
atTime(
time):DataFrame
Defined in: src/frame.ts:1191
Rows at a time of day, e.g. atTime('09:30').
Parameters
| Parameter | Type |
|---|---|
time | string |
Returns
DataFrame
betweenTime()
betweenTime(
start,end,options?):DataFrame
Defined in: src/frame.ts:1196
Rows between two times of day, e.g. betweenTime('09:00', '17:00').
Parameters
| Parameter | Type |
|---|---|
start | string |
end | string |
options | { inclusive?: "both" | "neither" | "left" | "right"; } |
options.inclusive? | "both" | "neither" | "left" | "right" |
Returns
DataFrame
bfill()
bfill(
limit?):DataFrame
Defined in: src/frame.ts:931
Parameters
| Parameter | Type |
|---|---|
limit? | number |
Returns
DataFrame
clip()
clip(
lower?,upper?):DataFrame
Defined in: src/frame.ts:829
Parameters
| Parameter | Type |
|---|---|
lower? | number | null |
upper? | number | null |
Returns
DataFrame
column()
column(
label):Series
Defined in: src/frame.ts:319
One column as a Series; a tuple addresses a MultiIndex column, e.g. column(['price', 'min']).
Parameters
| Parameter | Type |
|---|---|
label | string | readonly string[] |
Returns
combineFirst()
combineFirst(
other):DataFrame
Defined in: src/frame.ts:1069
Fills missing values (and missing labels) from other.
Parameters
| Parameter | Type |
|---|---|
other | DataFrame |
Returns
DataFrame
compare()
compare(
other,options?):DataFrame
Defined in: src/frame.ts:1080
Cell differences with other, as (column, 'self'/'other') columns.
Parameters
| Parameter | Type |
|---|---|
other | DataFrame |
options | { keepEqual?: boolean; keepShape?: boolean; resultNames?: [string, string]; } |
options.keepEqual? | boolean |
options.keepShape? | boolean |
options.resultNames? | [string, string] |
Returns
DataFrame
convertDtypes()
convertDtypes():
DataFrame
Defined in: src/frame.ts:885
Converts every column to the best nullable dtype (pandas convert_dtypes).
Returns
DataFrame
copy()
copy(
options?):DataFrame
Defined in: src/frame.ts:1227
Parameters
| Parameter | Type |
|---|---|
options | { deep?: boolean; } |
options.deep? | boolean |
Returns
DataFrame
corr()
corr(
options?):DataFrame
Defined in: src/frame.ts:779
Pairwise correlation of numeric columns: pearson (default), spearman or kendall.
Parameters
| Parameter | Type |
|---|---|
options | { method?: CorrMethod; minPeriods?: number; } |
options.method? | CorrMethod |
options.minPeriods? | number |
Returns
DataFrame
corrwith()
corrwith(
other,options?):Series
Defined in: src/frame.ts:789
Correlation of each column with the same-named column of other (or with a Series).
Parameters
| Parameter | Type |
|---|---|
other | DataFrame | Series |
options | { axis?: 0 | 1 | "columns" | "index"; method?: CorrMethod; } |
options.axis? | 0 | 1 | "columns" | "index" |
options.method? | CorrMethod |
Returns
count()
count(
options?):Series
Defined in: src/frame.ts:689
Parameters
| Parameter | Type |
|---|---|
options? | AxisAggOptions |
Returns
cov()
cov(
options?):DataFrame
Defined in: src/frame.ts:784
Pairwise sample covariance of numeric columns.
Parameters
| Parameter | Type |
|---|---|
options | { ddof?: number; minPeriods?: number; } |
options.ddof? | number |
options.minPeriods? | number |
Returns
DataFrame
cummax()
cummax():
DataFrame
Defined in: src/frame.ts:825
Returns
DataFrame
cummin()
cummin():
DataFrame
Defined in: src/frame.ts:826
Returns
DataFrame
cumprod()
cumprod():
DataFrame
Defined in: src/frame.ts:824
Returns
DataFrame
cumsum()
cumsum():
DataFrame
Defined in: src/frame.ts:823
Returns
DataFrame
describe()
describe(
options?):DataFrame
Defined in: src/frame.ts:767
Summary statistics of numeric columns (or all columns with include: 'all').
Parameters
| Parameter | Type |
|---|---|
options | { include?: "all"; } |
options.include? | "all" |
Returns
DataFrame
diff()
diff(
periods?):DataFrame
Defined in: src/frame.ts:835
Parameters
| Parameter | Type | Default value |
|---|---|---|
periods | number | 1 |
Returns
DataFrame
div()
div(
other,options?):DataFrame
Defined in: src/frame.ts:1111
Parameters
| Parameter | Type |
|---|---|
other | DataFrame | Operand |
options | ArithOptions |
Returns
DataFrame
drop()
Call Signature
drop(
columns):DataFrame
Defined in: src/frame.ts:586
Parameters
| Parameter | Type |
|---|---|
columns | string | readonly string[] |
Returns
DataFrame
Call Signature
drop(
options):DataFrame
Defined in: src/frame.ts:587
Parameters
| Parameter | Type |
|---|---|
options | { columns?: string | readonly string[]; index?: Label | readonly Label[]; } |
options.columns? | string | readonly string[] |
options.index? | Label | readonly Label[] |
Returns
DataFrame
dropDuplicates()
dropDuplicates(
options?):DataFrame
Defined in: src/frame.ts:992
Parameters
| Parameter | Type |
|---|---|
options | { ignoreIndex?: boolean; keep?: false | "first" | "last"; subset?: string | readonly string[]; } |
options.ignoreIndex? | boolean |
options.keep? | false | "first" | "last" |
options.subset? | string | readonly string[] |
Returns
DataFrame
droplevel()
droplevel(
level,options?):DataFrame
Defined in: src/frame.ts:1136
Removes index level(s) (or column levels with axis: 1).
Parameters
| Parameter | Type |
|---|---|
level | string | number | readonly (string | number)[] |
options | { axis?: 0 | 1 | "columns" | "index"; } |
options.axis? | 0 | 1 | "columns" | "index" |
Returns
DataFrame
dropna()
dropna(
options?):DataFrame
Defined in: src/frame.ts:938
Drops rows (axis 0) or columns (axis 1) with missing values. how: 'any' (default) or 'all'; thresh keeps rows with at least that many non-NA values.
Parameters
| Parameter | Type |
|---|---|
options | { axis?: 0 | 1 | "columns" | "index"; how?: "any" | "all"; subset?: readonly string[]; thresh?: number; } |
options.axis? | 0 | 1 | "columns" | "index" |
options.how? | "any" | "all" |
options.subset? | readonly string[] |
options.thresh? | number |
Returns
DataFrame
duplicated()
duplicated(
options?):Series
Defined in: src/frame.ts:986
Parameters
| Parameter | Type |
|---|---|
options | { keep?: false | "first" | "last"; subset?: string | readonly string[]; } |
options.keep? | false | "first" | "last" |
options.subset? | string | readonly string[] |
Returns
eq()
eq(
other):DataFrame
Defined in: src/frame.ts:1114
Parameters
| Parameter | Type |
|---|---|
other | DataFrame | Operand |
Returns
DataFrame
equals()
equals(
other):boolean
Defined in: src/frame.ts:1234
Parameters
| Parameter | Type |
|---|---|
other | DataFrame |
Returns
boolean
eval()
eval(
expr,options?):unknown
Defined in: src/frame.ts:561
Evaluates a pandas-style expression over the columns. Assignments ('c = a + b', several separated by newlines or ';') return a new frame (or modify this one with inplace); otherwise the expression's value is returned.
Parameters
| Parameter | Type |
|---|---|
expr | string |
options | { inplace?: boolean; locals?: Record<string, unknown>; } |
options.inplace? | boolean |
options.locals? | Record<string, unknown> |
Returns
unknown
ewm()
ewm(
options):EWM<DataFrame>
Defined in: src/frame.ts:709
Parameters
| Parameter | Type |
|---|---|
options | EwmOptions |
Returns
EWM<DataFrame>
expanding()
expanding(
options?):Expanding<DataFrame>
Defined in: src/frame.ts:705
Parameters
| Parameter | Type |
|---|---|
options | { minPeriods?: number; } |
options.minPeriods? | number |
Returns
Expanding<DataFrame>
explode()
explode(
columns,options?):DataFrame
Defined in: src/frame.ts:1064
Expands list-like cells of columns into one row per element.
Parameters
| Parameter | Type |
|---|---|
columns | string | readonly string[] |
options | { ignoreIndex?: boolean; } |
options.ignoreIndex? | boolean |
Returns
DataFrame
ffill()
ffill(
limit?):DataFrame
Defined in: src/frame.ts:930
Parameters
| Parameter | Type |
|---|---|
limit? | number |
Returns
DataFrame
fillna()
fillna(
value):DataFrame
Defined in: src/frame.ts:922
Fills NA with a scalar, or per column with {column: value}.
Parameters
| Parameter | Type |
|---|---|
value | unknown |
Returns
DataFrame
filter()
filter(
options):DataFrame
Defined in: src/frame.ts:567
Selects columns by name: exact items, substring like or regex.
Parameters
| Parameter | Type |
|---|---|
options | { items?: readonly string[]; like?: string; regex?: string | RegExp; } |
options.items? | readonly string[] |
options.like? | string |
options.regex? | string | RegExp |
Returns
DataFrame
firstValidIndex()
firstValidIndex():
Label
Defined in: src/frame.ts:1215
Returns
flattenColumns()
flattenColumns(
sep?):DataFrame
Defined in: src/frame.ts:174
Joins MultiIndex column labels into flat names, e.g. ('price', 'min') → 'price_min'.
Parameters
| Parameter | Type | Default value |
|---|---|---|
sep | string | '_' |
Returns
DataFrame
fromRecords()
staticfromRecords(records,options?):DataFrame
Defined in: src/frame.ts:130
Parameters
| Parameter | Type |
|---|---|
records | readonly Record<string, unknown>[] |
options | FrameOptions |
Returns
DataFrame
ge()
ge(
other):DataFrame
Defined in: src/frame.ts:1119
Parameters
| Parameter | Type |
|---|---|
other | DataFrame | Operand |
Returns
DataFrame
get()
Call Signature
get(
column):Series
Defined in: src/frame.ts:297
df.get('a') ≈ df['a']; a list selects columns; a boolean mask selects rows.
Parameters
| Parameter | Type |
|---|---|
column | string |
Returns
Call Signature
get(
columns):DataFrame
Defined in: src/frame.ts:298
df.get('a') ≈ df['a']; a list selects columns; a boolean mask selects rows.
Parameters
| Parameter | Type |
|---|---|
columns | readonly string[] |
Returns
DataFrame
Call Signature
get(
mask):DataFrame
Defined in: src/frame.ts:299
df.get('a') ≈ df['a']; a list selects columns; a boolean mask selects rows.
Parameters
| Parameter | Type |
|---|---|
mask | Mask |
Returns
DataFrame
groupby()
Call Signature
groupby(
by,options):DataFrameGroupBy<DataFrame>
Defined in: src/frame.ts:1012
Groups rows by column name(s), Series, arrays of keys, functions of the index label, and/or index levels ({ level }).
Parameters
| Parameter | Type |
|---|---|
by | GroupKey | readonly GroupKey[] | null |
options | GroupByOptions & object |
Returns
DataFrameGroupBy<DataFrame>
Call Signature
groupby(
by,options?):DataFrameGroupBy
Defined in: src/frame.ts:1013
Groups rows by column name(s), Series, arrays of keys, functions of the index label, and/or index levels ({ level }).
Parameters
| Parameter | Type |
|---|---|
by | GroupKey | readonly GroupKey[] | null |
options? | GroupByOptions |
Returns
gt()
gt(
other):DataFrame
Defined in: src/frame.ts:1118
Parameters
| Parameter | Type |
|---|---|
other | DataFrame | Operand |
Returns
DataFrame
has()
has(
column):boolean
Defined in: src/frame.ts:271
Parameters
| Parameter | Type |
|---|---|
column | string |
Returns
boolean
head()
head(
n?):DataFrame
Defined in: src/frame.ts:524
Parameters
| Parameter | Type | Default value |
|---|---|---|
n | number | 5 |
Returns
DataFrame
iat()
iat(
row,column):unknown
Defined in: src/frame.ts:406
Parameters
| Parameter | Type |
|---|---|
row | number |
column | number |
Returns
unknown
idxmax()
idxmax():
Series
Defined in: src/frame.ts:727
Returns
idxmin()
idxmin():
Series
Defined in: src/frame.ts:732
Returns
iloc()
Call Signature
iloc(
rows,cols):unknown
Defined in: src/frame.ts:371
Position-based selection. Row keys: integer, integers, mask, slice (exclusive), callable or null.
Parameters
| Parameter | Type |
|---|---|
rows | number |
cols | number |
Returns
unknown
Call Signature
iloc(
rows,cols?):Series
Defined in: src/frame.ts:372
Position-based selection. Row keys: integer, integers, mask, slice (exclusive), callable or null.
Parameters
| Parameter | Type |
|---|---|
rows | number |
cols? | Slice | readonly number[] | null |
Returns
Call Signature
iloc(
rows,cols):Series
Defined in: src/frame.ts:373
Position-based selection. Row keys: integer, integers, mask, slice (exclusive), callable or null.
Parameters
| Parameter | Type |
|---|---|
rows | Mask | Slice | readonly number[] | null |
cols | number |
Returns
Call Signature
iloc(
rows,cols?):DataFrame
Defined in: src/frame.ts:374
Position-based selection. Row keys: integer, integers, mask, slice (exclusive), callable or null.
Parameters
| Parameter | Type |
|---|---|
rows | Mask | Slice | readonly number[] | null |
cols? | Slice | readonly number[] | null |
Returns
DataFrame
info()
info():
string
Defined in: src/frame.ts:1355
Concise summary: dtypes and non-null counts per column.
Returns
string
insert()
insert(
loc,column,value):this
Defined in: src/frame.ts:341
Inserts a column at position loc in place.
Parameters
| Parameter | Type |
|---|---|
loc | number |
column | string |
value | ColumnValue |
Returns
this
interpolate()
interpolate(
options?):DataFrame
Defined in: src/frame.ts:932
Parameters
| Parameter | Type |
|---|---|
options | InterpolateOptions |
Returns
DataFrame
isin()
isin(
values):DataFrame
Defined in: src/frame.ts:894
Parameters
| Parameter | Type |
|---|---|
values | Iterable<unknown, any, any> | Record<string, Iterable<unknown, any, any>> |
Returns
DataFrame
isna()
isna():
DataFrame
Defined in: src/frame.ts:916
Returns
DataFrame
isnull()
isnull():
DataFrame
Defined in: src/frame.ts:918
Returns
DataFrame
items()
items():
IterableIterator<[string,Series]>
Defined in: src/frame.ts:280
[name, Series] pairs.
Returns
IterableIterator<[string, Series]>
iterrows()
iterrows():
IterableIterator<[Label,Record<string,unknown>]>
Defined in: src/frame.ts:285
[label, row] pairs; rows are plain objects.
Returns
IterableIterator<[Label, Record<string, unknown>]>
join()
join(
other,options?):DataFrame
Defined in: src/frame.ts:1025
Joins columns of other on the index.
Parameters
| Parameter | Type |
|---|---|
other | DataFrame | Series |
options | { how?: "left" | "right" | "inner" | "outer"; lsuffix?: string; rsuffix?: string; } |
options.how? | "left" | "right" | "inner" | "outer" |
options.lsuffix? | string |
options.rsuffix? | string |
Returns
DataFrame
kurt()
kurt():
Series
Defined in: src/frame.ts:692
Returns
kurtosis()
kurtosis():
Series
Defined in: src/frame.ts:693
Returns
lastValidIndex()
lastValidIndex():
Label
Defined in: src/frame.ts:1220
Returns
le()
le(
other):DataFrame
Defined in: src/frame.ts:1117
Parameters
| Parameter | Type |
|---|---|
other | DataFrame | Operand |
Returns
DataFrame
loc()
Call Signature
loc(
rows,cols):Series
Defined in: src/frame.ts:358
Label-based selection. Row keys: label, labels, mask, slice (inclusive), callable or null for all.
Parameters
| Parameter | Type |
|---|---|
rows | readonly Label[] | Mask | Slice | ((df) => Mask) | null |
cols | string |
Returns
Call Signature
loc(
rows,cols?):DataFrame
Defined in: src/frame.ts:359
Label-based selection. Row keys: label, labels, mask, slice (inclusive), callable or null for all.
Parameters
| Parameter | Type |
|---|---|
rows | readonly Label[] | Mask | Slice | ((df) => Mask) | null |
cols? | readonly string[] | readonly boolean[] | Slice | null |
Returns
DataFrame
Call Signature
loc(
rows,cols):unknown
Defined in: src/frame.ts:360
Label-based selection. Row keys: label, labels, mask, slice (inclusive), callable or null for all.
Parameters
| Parameter | Type |
|---|---|
rows | Label |
cols | string |
Returns
unknown
Call Signature
loc(
rows,cols?):Series
Defined in: src/frame.ts:361
Label-based selection. Row keys: label, labels, mask, slice (inclusive), callable or null for all.
Parameters
| Parameter | Type |
|---|---|
rows | Label |
cols? | readonly string[] | readonly boolean[] | Slice | null |
Returns
lt()
lt(
other):DataFrame
Defined in: src/frame.ts:1116
Parameters
| Parameter | Type |
|---|---|
other | DataFrame | Operand |
Returns
DataFrame
map()
map(
fn):DataFrame
Defined in: src/frame.ts:866
Element-wise function over every cell (pandas DataFrame.map, formerly applymap).
Parameters
| Parameter | Type |
|---|---|
fn | (value) => unknown |
Returns
DataFrame
mask()
mask(
cond,other?):DataFrame
Defined in: src/frame.ts:909
Parameters
| Parameter | Type | Default value |
|---|---|---|
cond | DataFrame | ((df) => DataFrame) | undefined |
other | unknown | null |
Returns
DataFrame
max()
max(
options?):Series
Defined in: src/frame.ts:688
Parameters
| Parameter | Type |
|---|---|
options? | AxisAggOptions |
Returns
mean()
mean(
options?):Series
Defined in: src/frame.ts:683
Parameters
| Parameter | Type |
|---|---|
options? | AxisAggOptions |
Returns
median()
median(
options?):Series
Defined in: src/frame.ts:684
Parameters
| Parameter | Type |
|---|---|
options? | AxisAggOptions |
Returns
melt()
melt(
options?):DataFrame
Defined in: src/frame.ts:1046
Unpivots wide → long (id_vars kept, other columns stacked into variable/value).
Parameters
| Parameter | Type |
|---|---|
options | { idVars?: readonly string[]; valueName?: string; valueVars?: readonly string[]; varName?: string; } |
options.idVars? | readonly string[] |
options.valueName? | string |
options.valueVars? | readonly string[] |
options.varName? | string |
Returns
DataFrame
memoryUsage()
memoryUsage(
options?):Series
Defined in: src/frame.ts:1270
Bytes used per column (and the index), like memory_usage; deep counts string contents.
Parameters
| Parameter | Type |
|---|---|
options | { deep?: boolean; index?: boolean; } |
options.deep? | boolean |
options.index? | boolean |
Returns
merge()
merge(
right,options?):DataFrame
Defined in: src/frame.ts:1020
Parameters
| Parameter | Type |
|---|---|
right | DataFrame |
options | MergeOptions |
Returns
DataFrame
min()
min(
options?):Series
Defined in: src/frame.ts:687
Parameters
| Parameter | Type |
|---|---|
options? | AxisAggOptions |
Returns
mod()
mod(
other,options?):DataFrame
Defined in: src/frame.ts:1112
Parameters
| Parameter | Type |
|---|---|
other | DataFrame | Operand |
options | ArithOptions |
Returns
DataFrame
mul()
mul(
other,options?):DataFrame
Defined in: src/frame.ts:1110
Parameters
| Parameter | Type |
|---|---|
other | DataFrame | Operand |
options | ArithOptions |
Returns
DataFrame
ne()
ne(
other):DataFrame
Defined in: src/frame.ts:1115
Parameters
| Parameter | Type |
|---|---|
other | DataFrame | Operand |
Returns
DataFrame
nlargest()
nlargest(
n,columns):DataFrame
Defined in: src/frame.ts:976
Parameters
| Parameter | Type |
|---|---|
n | number |
columns | string | readonly string[] |
Returns
DataFrame
notna()
notna():
DataFrame
Defined in: src/frame.ts:917
Returns
DataFrame
notnull()
notnull():
DataFrame
Defined in: src/frame.ts:919
Returns
DataFrame
nsmallest()
nsmallest(
n,columns):DataFrame
Defined in: src/frame.ts:980
Parameters
| Parameter | Type |
|---|---|
n | number |
columns | string | readonly string[] |
Returns
DataFrame
nunique()
nunique(
options?):Series
Defined in: src/frame.ts:714
Parameters
| Parameter | Type |
|---|---|
options? | AxisAggOptions |
Returns
pctChange()
pctChange(
periods?):DataFrame
Defined in: src/frame.ts:836
Parameters
| Parameter | Type | Default value |
|---|---|---|
periods | number | 1 |
Returns
DataFrame
pipe()
pipe<
T,A>(fn, ...args):T
Defined in: src/frame.ts:723
Calls fn(this, ...args), for chaining custom steps: df.pipe(clean).pipe(addTotals, 'revenue').
Type Parameters
| Type Parameter |
|---|
T |
A extends unknown[] |
Parameters
| Parameter | Type |
|---|---|
fn | (df, ...args) => T |
...args | A |
Returns
T
pivot()
pivot(
options):DataFrame
Defined in: src/frame.ts:1159
Reshapes without aggregation, like df.pivot(index, columns, values).
Parameters
| Parameter | Type |
|---|---|
options | { columns: string | readonly string[]; index?: string | readonly string[]; values?: string | readonly string[]; } |
options.columns | string | readonly string[] |
options.index? | string | readonly string[] |
options.values? | string | readonly string[] |
Returns
DataFrame
pivotTable()
pivotTable(
options):DataFrame
Defined in: src/frame.ts:1059
Spreadsheet-style pivot table with aggregation, margins and multiple keys.
Parameters
| Parameter | Type |
|---|---|
options | PivotTableOptions |
Returns
DataFrame
pop()
pop(
column):Series
Defined in: src/frame.ts:351
Removes a column in place and returns it.
Parameters
| Parameter | Type |
|---|---|
column | string |
Returns
pow()
pow(
other,options?):DataFrame
Defined in: src/frame.ts:1113
Parameters
| Parameter | Type |
|---|---|
other | DataFrame | Operand |
options | ArithOptions |
Returns
DataFrame
prod()
prod(
options?):Series
Defined in: src/frame.ts:682
Parameters
| Parameter | Type |
|---|---|
options? | AxisAggOptions |
Returns
quantile()
quantile(
q?,options?):Series
Defined in: src/frame.ts:717
Quantile of each numeric column; interpolation as in pandas (default 'linear').
Parameters
| Parameter | Type | Default value |
|---|---|---|
q | number | 0.5 |
options | { interpolation?: QuantileInterpolation; } | {} |
options.interpolation? | QuantileInterpolation | undefined |
Returns
query()
query(
expr,options?):DataFrame
Defined in: src/frame.ts:541
Filters rows with a pandas-style expression ('age > 30 and city == "SP"', @var for locals) or a predicate (row, label) => boolean.
Parameters
| Parameter | Type |
|---|---|
expr | string | ((row, label) => boolean) |
options | { locals?: Record<string, unknown>; } |
options.locals? | Record<string, unknown> |
Returns
DataFrame
rank()
rank(
options?):DataFrame
Defined in: src/frame.ts:837
Parameters
| Parameter | Type |
|---|---|
options | RankOptions & object |
Returns
DataFrame
reindex()
reindex(
options):DataFrame
Defined in: src/frame.ts:622
Conforms to new row labels and/or columns, filling holes with NA (or fillValue).
Parameters
| Parameter | Type |
|---|---|
options | { columns?: readonly string[]; fillValue?: unknown; index?: Index | readonly Label[]; } |
options.columns? | readonly string[] |
options.fillValue? | unknown |
options.index? | Index | readonly Label[] |
Returns
DataFrame
rename()
rename(
options):DataFrame
Defined in: src/frame.ts:604
Parameters
| Parameter | Type |
|---|---|
options | { columns?: Record<string, string> | ((c) => string); index?: Record<string, Label> | ((l) => Label); } |
options.columns? | Record<string, string> | ((c) => string) |
options.index? | Record<string, Label> | ((l) => Label) |
Returns
DataFrame
reorderLevels()
reorderLevels(
order,options?):DataFrame
Defined in: src/frame.ts:1144
Parameters
| Parameter | Type |
|---|---|
order | readonly (string | number)[] |
options | { axis?: 0 | 1 | "columns" | "index"; } |
options.axis? | 0 | 1 | "columns" | "index" |
Returns
DataFrame
replace()
replace(
from,to?):DataFrame
Defined in: src/frame.ts:890
Parameters
| Parameter | Type |
|---|---|
from | unknown |
to? | unknown |
Returns
DataFrame
resample()
resample(
rule,options?):Resampler<DataFrame>
Defined in: src/frame.ts:1171
Groups by time bins, like resample('ME') / resample('15min').
Parameters
| Parameter | Type |
|---|---|
rule | string | DateOffset |
options | ResampleOptions |
Returns
Resampler<DataFrame>
resetIndex()
resetIndex(
options?):DataFrame
Defined in: src/frame.ts:650
Moves the index into column(s) and restores a default 0..n-1 index.
Parameters
| Parameter | Type |
|---|---|
options | { drop?: boolean; } |
options.drop? | boolean |
Returns
DataFrame
rolling()
rolling(
window,options?):Rolling<DataFrame>
Defined in: src/frame.ts:701
Rolling window of window rows, or a time span ('3D') over a datetime index / on column.
Parameters
| Parameter | Type |
|---|---|
window | string | number | Timedelta |
options | RollingOptions |
Returns
Rolling<DataFrame>
round()
round(
decimals?):DataFrame
Defined in: src/frame.ts:828
Parameters
| Parameter | Type | Default value |
|---|---|---|
decimals | number | 0 |
Returns
DataFrame
sample()
sample(
n?,options?):DataFrame
Defined in: src/frame.ts:532
Parameters
| Parameter | Type | Default value |
|---|---|---|
n | number | 1 |
options | { frac?: number; seed?: number; } | {} |
options.frac? | number | undefined |
options.seed? | number | undefined |
Returns
DataFrame
selectDtypes()
selectDtypes(
options):DataFrame
Defined in: src/frame.ts:578
Parameters
| Parameter | Type |
|---|---|
options | { exclude?: readonly ("number" | DType)[]; include?: readonly ("number" | DType)[]; } |
options.exclude? | readonly ("number" | DType)[] |
options.include? | readonly ("number" | DType)[] |
Returns
DataFrame
sem()
sem(
options?):Series
Defined in: src/frame.ts:690
Parameters
| Parameter | Type |
|---|---|
options? | AxisAggOptions |
Returns
set()
set(
column,value):this
Defined in: src/frame.ts:325
Sets (or replaces) a column in place, like df['c'] = value. Returns this.
Parameters
| Parameter | Type |
|---|---|
column | string |
value | ColumnValue |
Returns
this
setAt()
setAt(
row,column,value):this
Defined in: src/frame.ts:456
Parameters
| Parameter | Type |
|---|---|
row | Label |
column | string |
value | unknown |
Returns
this
setAxis()
setAxis(
labels):this
Defined in: src/frame.ts:221
Replaces the index in place, like df.index = labels.
Parameters
| Parameter | Type |
|---|---|
labels | Index | readonly Label[] |
Returns
this
setColumns()
setColumns(
labels):this
Defined in: src/frame.ts:161
Replaces the column labels with an Index (tuples → MultiIndex columns) or names.
Parameters
| Parameter | Type |
|---|---|
labels | Index | readonly (string | readonly string[])[] |
Returns
this
setIat()
setIat(
row,column,value):this
Defined in: src/frame.ts:460
Parameters
| Parameter | Type |
|---|---|
row | number |
column | number |
value | unknown |
Returns
this
setIloc()
setIloc(
rows,cols,value):this
Defined in: src/frame.ts:449
In-place assignment by positions, like df.iloc[rows, cols] = value.
Parameters
| Parameter | Type |
|---|---|
rows | number | Mask | Slice | readonly number[] | null |
cols | number | Slice | readonly number[] | null |
value | unknown |
Returns
this
setIndex()
setIndex(
keys,options?):DataFrame
Defined in: src/frame.ts:639
Uses one or more columns as the index.
Parameters
| Parameter | Type |
|---|---|
keys | string | readonly string[] |
options | { drop?: boolean; } |
options.drop? | boolean |
Returns
DataFrame
setLoc()
setLoc(
rows,cols,value):this
Defined in: src/frame.ts:420
In-place assignment by labels, like df.loc[rows, cols] = value. null selects everything on that axis. A new scalar row label appends a row and a new column name adds a column. value may be a scalar, an array (one value per selected row, per selected column when a single row is selected, or a 2-D rows × columns array), a Series (aligned by row labels, or by column labels for a single row) or a DataFrame (aligned on both axes).
Parameters
| Parameter | Type |
|---|---|
rows | RowSelector | ((df) => Mask) |
cols | ColSelector | null |
value | unknown |
Returns
this
shift()
shift(
periods?,options?):DataFrame
Defined in: src/frame.ts:831
Shifts rows by periods (or the datetime index with { freq }).
Parameters
| Parameter | Type | Default value |
|---|---|---|
periods | number | 1 |
options | { fillValue?: unknown; freq?: string | DateOffset; } | {} |
options.fillValue? | unknown | undefined |
options.freq? | string | DateOffset | undefined |
Returns
DataFrame
skew()
skew():
Series
Defined in: src/frame.ts:691
Returns
sortIndex()
sortIndex(
options?):DataFrame
Defined in: src/frame.ts:971
Parameters
| Parameter | Type |
|---|---|
options | { ascending?: boolean; } |
options.ascending? | boolean |
Returns
DataFrame
sortValues()
sortValues(
by,options?):DataFrame
Defined in: src/frame.ts:964
Sorts by column(s); a MultiIndex column is a tuple, e.g. sortValues([['preco', 'min']]).
Parameters
| Parameter | Type |
|---|---|
by | string | readonly (string | readonly string[])[] |
options | { ascending?: boolean | readonly boolean[]; naPosition?: NaPosition; } |
options.ascending? | boolean | readonly boolean[] |
options.naPosition? | NaPosition |
Returns
DataFrame
stack()
stack(
options?):DataFrame|Series
Defined in: src/frame.ts:1149
Moves a column level into the row index (flat columns → Series).
Parameters
| Parameter | Type |
|---|---|
options | { dropna?: boolean; level?: string | number; } |
options.dropna? | boolean |
options.level? | string | number |
Returns
DataFrame | Series
std()
std(
options?):Series
Defined in: src/frame.ts:685
Parameters
| Parameter | Type |
|---|---|
options? | AxisAggOptions |
Returns
sub()
sub(
other,options?):DataFrame
Defined in: src/frame.ts:1109
Parameters
| Parameter | Type |
|---|---|
other | DataFrame | Operand |
options | ArithOptions |
Returns
DataFrame
sum()
sum(
options?):Series
Defined in: src/frame.ts:681
Parameters
| Parameter | Type |
|---|---|
options? | AxisAggOptions |
Returns
swaplevel()
swaplevel(
i?,j?,options?):DataFrame
Defined in: src/frame.ts:1140
Parameters
| Parameter | Type | Default value |
|---|---|---|
i | string | number | -2 |
j | string | number | -1 |
options | { axis?: 0 | 1 | "columns" | "index"; } | {} |
options.axis? | 0 | 1 | "columns" | "index" | undefined |
Returns
DataFrame
tail()
tail(
n?):DataFrame
Defined in: src/frame.ts:528
Parameters
| Parameter | Type | Default value |
|---|---|---|
n | number | 5 |
Returns
DataFrame
toCsv()
toCsv(
path?,options?):string
Defined in: src/frame.ts:1260
Parameters
| Parameter | Type |
|---|---|
path? | string |
options? | ToCsvOptions |
Returns
string
toDict()
toDict(
orient?):unknown
Defined in: src/frame.ts:1246
Parameters
| Parameter | Type | Default value |
|---|---|---|
orient | "records" | "index" | "dict" | "list" | "series" | 'dict' |
Returns
unknown
toExcel()
toExcel(
path?,options?):Promise<Buffer<ArrayBufferLike>>
Defined in: src/frame.ts:1330
Writes an .xlsx workbook (requires the optional exceljs); resolves to the file bytes.
Parameters
| Parameter | Type |
|---|---|
path? | string |
options? | ToExcelOptions |
Returns
Promise<Buffer<ArrayBufferLike>>
toFeather()
toFeather(
path?,options?):Promise<Buffer<ArrayBufferLike>>
Defined in: src/frame.ts:1340
Writes Feather / Arrow IPC (requires the optional apache-arrow); resolves to the bytes.
Parameters
| Parameter | Type |
|---|---|
path? | string |
options? | { index?: boolean; } |
options.index? | boolean |
Returns
Promise<Buffer<ArrayBufferLike>>
toHdf()
toHdf(
path,key,options?):Promise<void>
Defined in: src/frame.ts:1345
Writes HDF5 in pandas' 'table' format (requires the optional h5wasm).
Parameters
| Parameter | Type |
|---|---|
path | string |
key | string |
options | ToHdfOptions |
Returns
Promise<void>
toHtml()
toHtml(
path?,options?):string
Defined in: src/frame.ts:1320
HTML table markup (pandas-compatible); writes to path when given.
Parameters
| Parameter | Type |
|---|---|
path? | string |
options? | ToHtmlOptions |
Returns
string
toJson()
toJson(
path?,options?):string
Defined in: src/frame.ts:1264
Parameters
| Parameter | Type |
|---|---|
path? | string |
options? | { compression?: Compression; dateFormat?: "iso" | "epoch"; indent?: number; lines?: boolean; orient?: JsonOrient; } | undefined |
Returns
string
toJSON()
toJSON():
Record<string,unknown>[]
Defined in: src/frame.ts:1256
Returns
Record<string, unknown>[]
toLatex()
toLatex(
options?):string
Defined in: src/frame.ts:1283
LaTeX tabular (booktabs), like to_latex.
Parameters
| Parameter | Type |
|---|---|
options | { caption?: string; columnFormat?: string; floatFormat?: string | ((v) => string); header?: boolean; index?: boolean; label?: string; naRep?: string; position?: string; } |
options.caption? | string |
options.columnFormat? | string |
options.floatFormat? | string | ((v) => string) |
options.header? | boolean |
options.index? | boolean |
options.label? | string |
options.naRep? | string |
options.position? | string |
Returns
string
toMarkdown()
toMarkdown(
options?):string
Defined in: src/frame.ts:1297
Markdown pipe table (tabulate style), like to_markdown.
Parameters
| Parameter | Type |
|---|---|
options | { index?: boolean; } |
options.index? | boolean |
Returns
string
toParquet()
toParquet(
path?,options?):Promise<Buffer<ArrayBufferLike>>
Defined in: src/frame.ts:1335
Writes Parquet (requires the optional hyparquet-writer); resolves to the bytes.
Parameters
| Parameter | Type |
|---|---|
path? | string |
options? | ToParquetOptions |
Returns
Promise<Buffer<ArrayBufferLike>>
toPeriod()
toPeriod(
freq?):DataFrame
Defined in: src/frame.ts:1206
Converts a datetime index to a period index.
Parameters
| Parameter | Type | Default value |
|---|---|---|
freq | string | 'D' |
Returns
DataFrame
toRecords()
toRecords():
Record<string,unknown>[]
Defined in: src/frame.ts:1242
Row records [{col: value}, ...] (pandas to_dict('records')).
Returns
Record<string, unknown>[]
toSql()
toSql(
table,conn,options?):Promise<number>
Defined in: src/frame.ts:1325
Writes rows to a SQL table (sqlite path, node:sqlite / better-sqlite3 / pg / mysql2 connection).
Parameters
| Parameter | Type |
|---|---|
table | string |
conn | SqlConnection |
options | ToSqlOptions |
Returns
Promise<number>
toString()
toString(
opts?):string
Defined in: src/frame.ts:1376
Text rendering (what console.log(df) shows). Options override the global display options for this call.
Parameters
| Parameter | Type |
|---|---|
opts? | { columns?: readonly string[]; header?: boolean; index?: boolean; lineWidth?: number; maxCols?: number; maxRows?: number; naRep?: string; showDimensions?: boolean | "truncate"; } |
opts.columns? | readonly string[] |
opts.header? | boolean |
opts.index? | boolean |
opts.lineWidth? | number |
opts.maxCols? | number |
opts.maxRows? | number |
opts.naRep? | string |
opts.showDimensions? | boolean | "truncate" |
Returns
string
toTimestamp()
toTimestamp(
how?):DataFrame
Defined in: src/frame.ts:1211
Converts a period index to datetimes at the start (or end) of each period.
Parameters
| Parameter | Type | Default value |
|---|---|---|
how | "start" | "end" | 'start' |
Returns
DataFrame
toXml()
toXml(
path?,options?):string
Defined in: src/frame.ts:1350
XML document (pandas layout); writes to path when given.
Parameters
| Parameter | Type |
|---|---|
path? | string |
options? | ToXmlOptions |
Returns
string
transpose()
transpose():
DataFrame
Defined in: src/frame.ts:257
Returns
DataFrame
truncate()
truncate(
options?):DataFrame
Defined in: src/frame.ts:1201
Rows with index labels between before and after (inclusive).
Parameters
| Parameter | Type |
|---|---|
options | { after?: Label; before?: Label; } |
options.after? | Label |
options.before? | Label |
Returns
DataFrame
tzConvert()
tzConvert(
tz):DataFrame
Defined in: src/frame.ts:1186
Converts a tz-aware datetime index to another zone.
Parameters
| Parameter | Type |
|---|---|
tz | string | null |
Returns
DataFrame
tzLocalize()
tzLocalize(
tz,options?):DataFrame
Defined in: src/frame.ts:1181
Localizes a naive datetime index to tz (or removes the zone with null).
Parameters
| Parameter | Type |
|---|---|
tz | string | null |
options | { ambiguous?: Ambiguous; nonexistent?: Nonexistent; } |
options.ambiguous? | Ambiguous |
options.nonexistent? | Nonexistent |
Returns
DataFrame
unstack()
unstack(
options?):DataFrame|Series
Defined in: src/frame.ts:1154
Moves row index level(s) into the columns.
Parameters
| Parameter | Type |
|---|---|
options | { fillValue?: unknown; level?: string | number | readonly (string | number)[]; } |
options.fillValue? | unknown |
options.level? | string | number | readonly (string | number)[] |
Returns
DataFrame | Series
update()
update(
other,options?):this
Defined in: src/frame.ts:1074
In-place update with the non-missing values of other.
Parameters
| Parameter | Type |
|---|---|
other | DataFrame | Series |
options | { filterFunc?: (v) => boolean; overwrite?: boolean; } |
options.filterFunc? | (v) => boolean |
options.overwrite? | boolean |
Returns
this
valueCounts()
valueCounts(
options?):Series
Defined in: src/frame.ts:998
Counts of unique rows (over subset columns), most frequent first.
Parameters
| Parameter | Type |
|---|---|
options | { ascending?: boolean; normalize?: boolean; subset?: readonly string[]; } |
options.ascending? | boolean |
options.normalize? | boolean |
options.subset? | readonly string[] |
Returns
var()
var(
options?):Series
Defined in: src/frame.ts:686
Parameters
| Parameter | Type |
|---|---|
options? | AxisAggOptions |
Returns
where()
where(
cond,other?):DataFrame
Defined in: src/frame.ts:904
Keeps cells where cond holds; the rest become other.
Parameters
| Parameter | Type | Default value |
|---|---|---|
cond | DataFrame | ((df) => DataFrame) | undefined |
other | unknown | null |
Returns
DataFrame
xs()
xs(
key,options?):unknown
Defined in: src/frame.ts:1131
Cross-section at key of an index level (or of the columns with axis: 1).
Parameters
| Parameter | Type |
|---|---|
key | Label |
options | { axis?: 0 | 1 | "columns" | "index"; dropLevel?: boolean; level?: string | number | readonly (string | number)[]; } |
options.axis? | 0 | 1 | "columns" | "index" |
options.dropLevel? | boolean |
options.level? | string | number | readonly (string | number)[] |
Returns
unknown