Class: ColumnList
dg.ColumnList
Columns in a [DataFrame].
Constructors
constructor
• new ColumnList(dart
)
Parameters
Name | Type |
---|---|
dart | any |
Defined in
Properties
dart
• Private
Readonly
dart: any
Defined in
Accessors
categorical
• get
categorical(): Iterable
<Column
<any
>>
Finds categorical columns. Sample: https://public.datagrok.ai/js/samples/data-frame/find-columns
Returns
Iterable
<Column
<any
>>
Defined in
length
• get
length(): number
Number of columns.
Returns
number
Defined in
numerical
• get
numerical(): Iterable
<Column
<any
>>
Finds numerical columns. Sample: https://public.datagrok.ai/js/samples/data-frame/find-columns
Returns
Iterable
<Column
<any
>>
Defined in
Methods
[iterator]
▸ [iterator](): IterableIterator
<Column
<any
>>
Iterates over all columns.
Returns
IterableIterator
<Column
<any
>>
Defined in
_getNewCalculated
▸ _getNewCalculated(name
, expression
, type?
, treatAsString?
): Promise
<Column
<any
>>
Parameters
Name | Type | Default value |
---|---|---|
name | string | undefined |
expression | string | undefined |
type | "string" | "bigint" | "object" | "auto" | "int" | "double" | "bool" | "byte_array" | "datetime" | "qnum" | "dataframe" | 'auto' |
treatAsString | boolean | false |
Returns
Promise
<Column
<any
>>
Defined in
add
▸ add(column
, notify?
): Column
<any
>
Adds a column, and optionally notifies the parent dataframe.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
column | Column <any > | undefined | |
notify | boolean | true | whether DataFrame's changed event should be fired |
Returns
Column
<any
>
Defined in
addNew
▸ addNew(name
, type
): Column
<any
>
Adds an empty column of the specified type.
Parameters
Name | Type |
---|---|
name | string |
type | "string" | "bigint" | "object" | "int" | "double" | "bool" | "byte_array" | "datetime" | "qnum" | "dataframe" |
Returns
Column
<any
>
Defined in
addNewBool
▸ addNewBool(name
): Column
<boolean
>
Creates and adds a boolean column https://dev.datagrok.ai/script/samples/javascript/data-frame/modification/add-columns
Parameters
Name | Type |
---|---|
name | string |
Returns
Column
<boolean
>
Defined in
addNewBytes
▸ addNewBytes(name
): Column
<Uint8Array
>
Creates and adds a byte array column https://dev.datagrok.ai/script/samples/javascript/data-frame/modification/add-columns
Parameters
Name | Type |
---|---|
name | string |
Returns
Column
<Uint8Array
>
Defined in
addNewCalculated
▸ addNewCalculated(name
, expression
, type?
, treatAsString?
): Promise
<Column
<any
>>
Adds calculated column.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
name | string | undefined | |
expression | string | undefined | |
type | "string" | "bigint" | "object" | "auto" | "int" | "double" | "bool" | "byte_array" | "datetime" | "qnum" | "dataframe" | 'auto' | |
treatAsString | boolean | false | if true, [expression] is not evaluated as formula and is treated as a regular string value instead |
Returns
Promise
<Column
<any
>>
Defined in
addNewDateTime
▸ addNewDateTime(name
): Column
<any
>
Creates and adds a datetime column https://dev.datagrok.ai/script/samples/javascript/data-frame/modification/add-columns
Parameters
Name | Type |
---|---|
name | string |
Returns
Column
<any
>
Defined in
addNewFloat
▸ addNewFloat(name
): Column
<number
>
Creates and adds a float column
Parameters
Name | Type |
---|---|
name | string |
Returns
Column
<number
>
Defined in
addNewInt
▸ addNewInt(name
): Column
<number
>
Creates and adds an integer column https://dev.datagrok.ai/script/samples/javascript/data-frame/modification/add-columns
Parameters
Name | Type |
---|---|
name | string |
Returns
Column
<number
>
Defined in
addNewQnum
▸ addNewQnum(name
): Column
<number
>
Creates and adds a qualified number column https://dev.datagrok.ai/script/samples/javascript/data-frame/modification/add-columns
Parameters
Name | Type |
---|---|
name | string |
Returns
Column
<number
>
Defined in
addNewString
▸ addNewString(name
): Column
<string
>
Creates and adds a string column.
Parameters
Name | Type |
---|---|
name | string |
Returns
Column
<string
>
Defined in
addNewVirtual
▸ addNewVirtual(name
, getValue
, type?
, setValue?
): Column
<any
>
Creates and adds a virtual column.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
name | string | undefined | |
getValue | (ind : number ) => any | undefined | value constructor function that accepts int index and returns value |
type | TYPE | TYPE.OBJECT | column type |
setValue | null | IndexSetter | null | function that gets invoked when a column cell value is set |
Returns
Column
<any
>
https://dev.datagrok.ai/script/samples/javascript/data-frame/advanced/virtual-int-column https://dev.datagrok.ai/script/samples/javascript/data-frame/advanced/virtual-columns
Defined in
byIndex
▸ byIndex(index
): Column
<any
>
Column by index
Parameters
Name | Type |
---|---|
index | number |
Returns
Column
<any
>
Defined in
byName
▸ byName(name
): Column
<any
>
Column with the corresponding name (case-insensitive).
Parameters
Name | Type |
---|---|
name | string |
Returns
Column
<any
>
Defined in
byNames
▸ byNames(names
): Column
<any
>[]
Maps names to columns.
Parameters
Name | Type |
---|---|
names | string [] |
Returns
Column
<any
>[]
Defined in
bySemType
▸ bySemType(semType
): null
| Column
<any
>
First column of [semType], or null.
Parameters
Name | Type |
---|---|
semType | string |
Returns
null
| Column
<any
>
Defined in
bySemTypeAll
▸ bySemTypeAll(semType
): Column
<any
>[]
All columns of [semType], or empty list.
Parameters
Name | Type |
---|---|
semType | string |
Returns
Column
<any
>[]
Defined in
bySemTypesExact
▸ bySemTypesExact(semTypes
): null
| Column
<any
>[]
Finds columns by the corresponding semTypes, or null, if any of the sem types could not be found.
Parameters
Name | Type |
---|---|
semTypes | string [] |
Returns
null
| Column
<any
>[]
Defined in
byTags
▸ byTags(tags
): Iterable
<Column
<any
>>
Finds columns by specified tags and values: {'tag': 'value'}. Pass null or undefined to match any value of a tag. Sample: https://public.datagrok.ai/js/samples/data-frame/find-columns
Parameters
Name | Type |
---|---|
tags | object |
Returns
Iterable
<Column
<any
>>
Defined in
contains
▸ contains(columnName
): boolean
Checks whether this list contains a column with the specified name. The check is case-insensitive.
Parameters
Name | Type |
---|---|
columnName | string |
Returns
boolean
Defined in
getOrCreate
▸ getOrCreate(name
, type
, length
): Column
<any
>
Parameters
Name | Type |
---|---|
name | string |
type | "string" | "bigint" | "object" | "int" | "double" | "bool" | "byte_array" | "datetime" | "qnum" | "dataframe" |
length | number |
Returns
Column
<any
>
Defined in
getUnusedName
▸ getUnusedName(name
, choices?
): string
Returns a name that does not exist in column list. If column list does not contain column with [name], returns [name]. Otherwise, tries [choices], and if the names are taken already, returns a string in a form of 'name (i)'.
Parameters
Name | Type |
---|---|
name | string |
choices? | string [] |
Returns
string
Defined in
insert
▸ insert(column
, index?
, notify?
): Column
<any
>
Inserts a column, and optionally notifies the parent dataframe.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
column | Column <any > | undefined | |
index | null | number | null | |
notify | boolean | true | whether DataFrame's changed event should be fired |
Returns
Column
<any
>
Defined in
names
▸ names(): string
[]
Array containing column names.
Returns
string
[]
Defined in
remove
▸ remove(column
, notify?
): ColumnList
Removes column by name (case-insensitive).
Parameters
Name | Type | Default value |
---|---|---|
column | string | undefined |
notify | boolean | true |
Returns
Defined in
replace
▸ replace(columnToReplace
, newColumn
): Column
<any
>
Replaces the column with the new column.
Parameters
Name | Type |
---|---|
columnToReplace | string | Column <any > |
newColumn | Column <any > |
Returns
Column
<any
>
Defined in
toList
▸ toList(): Column
<any
>[]
Creates an array of columns.
Returns
Column
<any
>[]
Defined in
toString
▸ toString(): string
Returns
string