Skip to main content

ObjectColumn

Strongly-typed column. Use get and set to access elements by index.

Extends

Constructors

new ObjectColumn()

new ObjectColumn(dart): ObjectColumn

Parameters

ParameterType
dartany

Returns

ObjectColumn

Inherited from

Column . constructor

Source

src/dataframe.ts:640

Properties

PropertyModifierTypeInherited from
dartpublicanyColumn.dart
tagspublicanyColumn.tags
temppublicanyColumn.temp

Accessors

categories

get categories(): string[]

Returns all unique strings in a sorted order. Applicable to string column only.

Returns

string[]

Source

src/dataframe.ts:1031


colors

get colors(): ColumnColorHelper

Returns

ColumnColorHelper

Source

src/dataframe.ts:877


dataFrame

get dataFrame(): DataFrame

Parent table

Returns

DataFrame

Source

src/dataframe.ts:832


dialogs

get dialogs(): ColumnDialogHelper

Returns

ColumnDialogHelper

Source

src/dataframe.ts:872


isCategorical

get isCategorical(): boolean

Is the column categorical (string, boolean)

Returns

boolean

Source

src/dataframe.ts:808


isEmpty

get isEmpty(): boolean

Returns whether all values in the columns are empty.

Returns

boolean

Source

src/dataframe.ts:993


isNumerical

get isNumerical(): boolean

Is the column numerical (float, int, bigint, qnum)

Returns

boolean

Source

src/dataframe.ts:802


isVirtual

get isVirtual(): boolean

Is this column virtual

Returns

boolean

Source

src/dataframe.ts:820


layoutColumnId

get layoutColumnId(): string

Layout column ID

set layoutColumnId(s): void

Parameters

ParameterType
sstring

Returns

string

Source

src/dataframe.ts:848


length

get length(): number

Number of elements

Returns

number

Source

src/dataframe.ts:826


markers

get markers(): ColumnMarkerHelper

Returns

ColumnMarkerHelper

Source

src/dataframe.ts:882


max

get max(): number

Column's maximum value. The result is cached.

Returns

number

Source

src/dataframe.ts:1060


meta

get meta(): ColumnMetaHelper

Returns

ColumnMetaHelper

Source

src/dataframe.ts:646


min

get min(): number

Column's minimum value. The result is cached.

Returns

number

Source

src/dataframe.ts:1057


name

get name(): string

set name(s): void

Parameters

ParameterType
sstring

Returns

string

Source

src/dataframe.ts:857


semType

get semType(): string

Semantic type

set semType(s): void

Parameters

ParameterType
sstring

Returns

string

Source

src/dataframe.ts:838


stats

get stats(): Stats

Basic descriptive statistics. The result is cached.

Returns

Stats

Source

src/dataframe.ts:1070


type

get type(): "string" | "bigint" | "object" | "int" | "double" | "bool" | "byte_array" | "datetime" | "qnum" | "dataframe"

Column data type.

Returns

"string" | "bigint" | "object" | "int" | "double" | "bool" | "byte_array" | "datetime" | "qnum" | "dataframe"

Source

src/dataframe.ts:814


valueComparer

get valueComparer(): null | Comparer

Value comparison function to be used for sorting. Null means default sorting. Sample: https://public.datagrok.ai/js/samples/data-frame/sorting/custom-comparer

set valueComparer(cmp): void

Parameters

ParameterType
cmpnull | Comparer

Returns

null | Comparer

Source

src/dataframe.ts:1053


version

get version(): number

Version of the column. Increases each time the column was changed

Returns

number

Source

src/dataframe.ts:867

Methods

aggregate()

aggregate(type): any

Aggregates a column using the [type] function, which corresponds to

  • [DG.AGG] for int, bigint, float, qnum columns,
  • [DG.STR_AGG] and [DG.STAT_COUNTS] for string columns,
  • [DG.STAT_COUNTS], [DG.AGG.MIN], [DG.AGG.MAX], [DG.AGG.AVG] for datetime columns,
  • [DG.AGG.TOTAL_COUNT] and [DG.AGG.MISSING_VALUE_COUNT] for virtual columns.

Parameters

ParameterType
typestring

Returns

any

Inherited from

Column . aggregate

Source

src/dataframe.ts:1105


applyFormula()

applyFormula(formula, type, treatAsString): Promise<null | Column<any, any>>

Applies the specified formula to a calculated column. Returns a new column object, if applied successfully, and null otherwise.

Parameters

ParameterTypeDefault value
formulastringundefined
typenull | "string" | "bigint" | "object" | "int" | "double" | "bool" | "byte_array" | "datetime" | "qnum" | "dataframe"null
treatAsStringbooleanfalse

Returns

Promise<null | Column<any, any>>

Inherited from

Column . applyFormula

Source

src/dataframe.ts:1081


asDoubleList()

asDoubleList(): Float32Array

Returns

Float32Array

  • typed array of float values representing the column. Does not guarantee to perform a copy of the underlying data.

Inherited from

Column . asDoubleList

Source

src/dataframe.ts:1111


clone()

clone(mask?): Column<any, any>

Performs deep cloning, optionally taking mask of the rows to be included. Note that the cloned colum is not added to this column's dataframe.

Parameters

ParameterType
mask?BitSet

Returns

Column<any, any>

Inherited from

Column . clone

Source

src/dataframe.ts:907


compact()

compact(): any

Compacts the internal column representation. Currently, it only affects string columns where values were modified.

Returns

any

Inherited from

Column . compact

Source

src/dataframe.ts:1020


convertTo()

convertTo(newType, format): Column<any, any>

Creates and returns a new column by converting [column] to the specified [newType].

Parameters

ParameterTypeDefault value
newTypestringundefined
formatnull | stringnull

Returns

Column<any, any>

Inherited from

Column . convertTo

Source

src/dataframe.ts:1090


fireValuesChanged()

fireValuesChanged(): void

Call this method after setting elements without notifications via set

Returns

void

Inherited from

Column . fireValuesChanged

Source

src/dataframe.ts:977


get()

get(row): any

Gets [i]-th value.

Parameters

ParameterType
rownumber

Returns

any

Overrides

Column . get

Source

src/dataframe.ts:1202


getCategory()

getCategory(categoryIndex): string

Returns i-th category. Applicable to string column only.

Parameters

ParameterType
categoryIndexnumber

Returns

string

Inherited from

Column . getCategory

Source

src/dataframe.ts:1036


getCategoryOrder()

getCategoryOrder(): string[]

Gets order of categories

Returns

string[]

Inherited from

Column . getCategoryOrder

Source

src/dataframe.ts:1046


getNumber()

getNumber(i): number

Returns i-th value as number

Parameters

ParameterTypeDescription
inumber

Returns

number

Inherited from

Column . getNumber

Source

src/dataframe.ts:960


getRawData()

getRawData(): Int32Array | Uint32Array | Float32Array | Float64Array

FOR EXPERT USE ONLY!

Returns the raw buffer containing data. Sample: https://public.datagrok.ai/js/samples/data-frame/performance/access Return type depends on the column type: {Int32Array} for ints, INT_NULL represents null. {Float32Array} or {Float64Array} for floats depending on doublePrecision parameter, FLOAT_NULL represents null. {Float64Array} for qnums, FLOAT_NULL represents null. {Float64Array} for datetime, in microseconds since epoch, FLOAT_NULL represents null. {Int32Array} for strings indexes of categories. {Uint32Array} bit array.

Returns

Int32Array | Uint32Array | Float32Array | Float64Array

Inherited from

Column . getRawData

Source

src/dataframe.ts:921


getSortedOrder()

getSortedOrder(): Int32Array

Returns an array of indexes sorted using [valueComparer].

Returns

Int32Array

Inherited from

Column . getSortedOrder

Source

src/dataframe.ts:1049


getString()

getString(i): string

Returns i-th value as string, taking into account value format defined for the column. An empty string is returned if there is no value.

Parameters

ParameterTypeDescription
inumber

Returns

string

Inherited from

Column . getString

Source

src/dataframe.ts:953


getTag()

getTag(tag): string

Returns the value of the specified tag, or null if the tag is not present.

Parameters

ParameterType
tagstring

Returns

string

Inherited from

Column . getTag

Source

src/dataframe.ts:1005


init()

init(valueInitializer): Column<any, any>

Initializes all values in the column to [columnInitializer].

Parameters

ParameterTypeDescription
valueInitializernull | string | number | boolean | Date | Dayjs | (ind) => anyvalue, or a function that returns value by index

Returns

Column<any, any>

Inherited from

Column . init

Source

src/dataframe.ts:891


isNone()

isNone(i): boolean

Returns whether i-th value is missing.

Parameters

ParameterTypeDescription
inumberRow index.

Returns

boolean

Inherited from

Column . isNone

Source

src/dataframe.ts:1000


matches()

matches(filter): boolean

Checks whether the column passes the specified [filter]. [filter] can be either specific data [type] such as 'int' or 'string', more broadly - 'numerical', or 'categorical', or null for any columns.

Parameters

ParameterType
filternull | "string" | "bigint" | "object" | "int" | "double" | "bool" | "byte_array" | "datetime" | "qnum" | "dataframe" | "categorical" | "numerical"

Returns

boolean

Inherited from

Column . matches

Source

src/dataframe.ts:1065


scale()

scale(idx): number

Linearly maps idx-th value to the [0,1] interval, where 0 represents column minimum, and 1 represents maximum.

Parameters

ParameterType
idxnumber

Returns

number

Inherited from

Column . scale

Source

src/dataframe.ts:934


set()

set(i, value, notify): void

Sets [i]-th value to [x], and optionally notifies the dataframe about this change.

Parameters

ParameterTypeDefault valueDescription
inumberundefined
valueanyundefined
notifybooleantruewhether DataFrame's changed event should be fired. Call fireValuesChanged after you are done modifying the column.

Returns

void

Inherited from

Column . set

Source

src/dataframe.ts:988


setCategoryOrder()

setCategoryOrder(order): void

Sets order of categories

Parameters

ParameterType
orderstring[]

Returns

void

Inherited from

Column . setCategoryOrder

Source

src/dataframe.ts:1041


setRawData()

setRawData(rawData, notify): void

Parameters

ParameterTypeDefault value
rawDataInt32Array | Uint32Array | Float32Array | Float64Arrayundefined
notifybooleantrue

Returns

void

Inherited from

Column . setRawData

Source

src/dataframe.ts:938


setString()

setString(i, str, notify): boolean

Attempts to set i-th value by converting a provided string to the corresponding strongly-typed value. Returns true if text was successfully parsed and set, otherwise false. Examples: dateColumn.setString('April 1, 2020'); intColumn.setString('42');

Parameters

ParameterTypeDefault valueDescription
inumberundefined
strstringundefined
notifybooleantruewhether DataFrame's changed event should be fired

Returns

boolean

Inherited from

Column . setString

Source

src/dataframe.ts:972


setTag()

setTag(tag, value): Column<any, any>

Sets a tag to the specified value.

Parameters

ParameterTypeDescription
tagstringKey.
valuestringValue.

Returns

Column<any, any>

. *

Inherited from

Column . setTag

Source

src/dataframe.ts:1013


toList()

toList(): any[]

Copies column values to an array. Avoid using this method for performance-critical routines; consider using getRawData

Returns

any[]

Inherited from

Column . toList

Source

src/dataframe.ts:1026


toString()

toString(): string

Returns

string

  • string representation of this column

Inherited from

Column . toString

Source

src/dataframe.ts:1095


values()

values(): Generator<any, void, unknown>

An iterator over all values in this column.

Returns

Generator<any, void, unknown>

Inherited from

Column . values

Source

src/dataframe.ts:1073


bool()

static bool(name, length): Column<boolean, boolean>

Creates a boolean column with the specified name and length.

Parameters

ParameterTypeDefault valueDescription
namestringundefined
lengthnumber0

Returns

Column<boolean, boolean>

Inherited from

Column . bool

Source

src/dataframe.ts:758


dataFrame()

static dataFrame(name, length): Column <DataFrame, DataFrame>

Creates a column containing dataframes with the specified name and length.

Parameters

ParameterTypeDefault valueDescription
namestringundefined
lengthnumber0

Returns

Column <DataFrame, DataFrame>

Inherited from

Column . dataFrame

Source

src/dataframe.ts:774


dateTime()

static dateTime(name, length): Column<any, any>

Creates a datetime column with the specified name and length.

Parameters

ParameterTypeDefault valueDescription
namestringundefined
lengthnumber0

Returns

Column<any, any>

Inherited from

Column . dateTime

Source

src/dataframe.ts:766


float()

static float(name, length): Column<number, number>

Creates a floating point column with the specified name and length.

Parameters

ParameterTypeDefault valueDescription
namestringundefined
lengthnumber0

Returns

Column<number, number>

Inherited from

Column . float

Source

src/dataframe.ts:742


fromBigInt64Array()

static fromBigInt64Array(name, array): Column<any, any>

Creates BigIntColumn from BigInt64Array / BigUint64Array

Parameters

ParameterType
namestring
arrayBigInt64Array | BigUint64Array

Returns

Column<any, any>

Inherited from

Column . fromBigInt64Array

Source

src/dataframe.ts:695


fromBitSet()

static fromBitSet(name, bitset): Column<boolean, boolean>

Creates a Column from the bitset.

Parameters

ParameterTypeDescription
namestring
bitsetBitSet

Returns

Column<boolean, boolean>

Inherited from

Column . fromBitSet

Source

src/dataframe.ts:726


fromFloat32Array()

static fromFloat32Array(name, array, length): Column<number, number>

[array] will be not be copied and will be used as column's storage

Parameters

ParameterTypeDefault value
namestringundefined
arrayFloat32Arrayundefined
lengthnull | numbernull

Returns

Column<number, number>

Inherited from

Column . fromFloat32Array

Source

src/dataframe.ts:685


fromFloat64Array()

static fromFloat64Array(name, array, length): Column<number, number>

[array] will be not be copied and will be used as column's storage

Parameters

ParameterTypeDefault value
namestringundefined
arrayFloat64Arrayundefined
lengthnull | numbernull

Returns

Column<number, number>

Inherited from

Column . fromFloat64Array

Source

src/dataframe.ts:690


fromIndexes()

static fromIndexes(name, categories, indexes): Column<any, any>

Crates a Column of string type from categories and indexes

Parameters

ParameterTypeDescription
namestring
categoriesstring[]
indexesInt32Array

Returns

Column<any, any>

Inherited from

Column . fromIndexes

Source

src/dataframe.ts:718


fromInt32Array()

static fromInt32Array(name, array, length): Column<number, number>

[array] will be not be copied and will be used as column's storage

Parameters

ParameterTypeDefault value
namestringundefined
arrayInt32Arrayundefined
lengthnull | numbernull

Returns

Column<number, number>

Inherited from

Column . fromInt32Array

Source

src/dataframe.ts:680


fromList()

static fromList(type, name, list): Column<any, any>

Creates a Column from the list of values.

Parameters

ParameterTypeDescription
type"string" | "bigint" | "object" | "int" | "double" | "bool" | "byte_array" | "datetime" | "qnum" | "dataframe"
namestring
listany[]

Returns

Column<any, any>

Inherited from

Column . fromList

Source

src/dataframe.ts:706


fromStrings()

static fromStrings(name, list): Column<any, any>

Creates a Column from the list of string values Please note that method performs type promotion if all listed values are numeric

Parameters

ParameterTypeDescription
namestringColumn name
liststring[]

List of column values

https://dev.datagrok.ai/script/samples/javascript/data-frame/construction/create-from-columns

https://dev.datagrok.ai/script/samples/javascript/data-frame/construction/create-from-arrays

Returns

Column<any, any>

Inherited from

Column . fromStrings

Source

src/dataframe.ts:662


fromType()

static fromType(type, name?, length?): Column<any, any>

Creates a Column with explicitly specified type

Parameters

ParameterTypeDefault valueDescription
type"string" | "bigint" | "object" | "int" | "double" | "bool" | "byte_array" | "datetime" | "qnum" | "dataframe"undefinedcolumn type code COLUMN_TYPE
name?null | stringundefinedColumn name
length?number0

Column length (should match row count of the data frame )

DataFrame.create

Returns

Column<any, any>

Inherited from

Column . fromType

See

COLUMN_TYPE

Source

src/dataframe.ts:675


int()

static int(name, length): Column<number, number>

Creates an integer column with the specified name and length.

Parameters

ParameterTypeDefault valueDescription
namestringundefined
lengthnumber0

Returns

Column<number, number>

Inherited from

Column . int

Source

src/dataframe.ts:734


qnum()

static qnum(name, length, values, exact): Column<number, number>

Creates a qualified number column with the specified name and length. Initialized values with [values], if it is specified; strips out the qualifier part if [exact] is true.

Parameters

ParameterTypeDefault valueDescription
namestringundefined
lengthnumber0
valuesnumber[][]
exactbooleantrueif true, strips out qualifier from [values].

Returns

Column<number, number>

Inherited from

Column . qnum

Source

src/dataframe.ts:787


string()

static string(name, length): Column<string, string>

Creates a string column with the specified name and length.

Parameters

ParameterTypeDefault valueDescription
namestringundefined
lengthnumber0

Returns

Column<string, string>

Inherited from

Column . string

Source

src/dataframe.ts:750