DataFrameColumn
Column of type [DataFrame].
Extends
Constructors
new DataFrameColumn()
new DataFrameColumn(
dart):DataFrameColumn
Parameters
| Parameter | Type |
|---|---|
dart | any |
Returns
Inherited from
Source
Properties
| Property | Modifier | Type | Inherited from |
|---|---|---|---|
dart | public | any | Column.dart |
tags | public | any | Column.tags |
temp | public | any | Column.temp |
Accessors
categories
getcategories():string[]
Returns all unique strings in a sorted order. Applicable to string column only.
Returns
string[]
Source
colors
getcolors():ColumnColorHelper
Returns
Source
dataFrame
getdataFrame():DataFrame
Parent table
Returns
Source
dialogs
getdialogs():ColumnDialogHelper
Returns
Source
isCategorical
getisCategorical():boolean
Is the column categorical (string, boolean)
Returns
boolean
Source
isEmpty
getisEmpty():boolean
Returns whether all values in the columns are empty.
Returns
boolean
Source
isNumerical
getisNumerical():boolean
Is the column numerical (float, int, bigint, qnum)
Returns
boolean
Source
isVirtual
getisVirtual():boolean
Is this column virtual
Returns
boolean
Source
layoutColumnId
getlayoutColumnId():string
Layout column ID
setlayoutColumnId(s):void
Parameters
| Parameter | Type |
|---|---|
s | string |
Returns
string
Source
length
getlength():number
Number of elements
Returns
number
Source
markers
getmarkers():ColumnMarkerHelper
Returns
Source
max
getmax():number
Column's maximum value. The result is cached.
Returns
number
Source
meta
getmeta():ColumnMetaHelper
Returns
Source
min
getmin():number
Column's minimum value. The result is cached.
Returns
number
Source
name
getname():string
setname(s):void
Parameters
| Parameter | Type |
|---|---|
s | string |
Returns
string
Source
semType
getsemType():string
Semantic type
setsemType(s):void
Parameters
| Parameter | Type |
|---|---|
s | string |
Returns
string
Source
stats
getstats():Stats
Basic descriptive statistics. The result is cached.
Returns
Source
type
gettype():"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
valueComparer
getvalueComparer():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
setvalueComparer(cmp):void
Parameters
| Parameter | Type |
|---|---|
cmp | null | Comparer |
Returns
null | Comparer
Source
version
getversion():number
Version of the column. Increases each time the column was changed
Returns
number
Source
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
| Parameter | Type |
|---|---|
type | string |
Returns
any
Inherited from
Source
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
| Parameter | Type | Default value |
|---|---|---|
formula | string | undefined |
type | null | "string" | "bigint" | "object" | "int" | "double" | "bool" | "byte_array" | "datetime" | "qnum" | "dataframe" | null |
treatAsString | boolean | false |
Returns
Promise<null | Column<any, any>>
Inherited from
Source
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
Source
clone()
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
| Parameter | Type |
|---|---|
mask? | BitSet |
Returns
Inherited from
Source
compact()
compact():
any
Compacts the internal column representation. Currently, it only affects string columns where values were modified.
Returns
any
Inherited from
Source
convertTo()
convertTo(
newType,format):Column<any,any>
Creates and returns a new column by converting [column] to the specified [newType].
Parameters
| Parameter | Type | Default value |
|---|---|---|
newType | string | undefined |
format | null | string | null |
Returns
Column<any, any>
Inherited from
Source
fireValuesChanged()
fireValuesChanged():
void
Call this method after setting elements without notifications via set
Returns
void
Inherited from
Source
get()
get(
row):null|DataFrame
Gets [i]-th value.
Parameters
| Parameter | Type |
|---|---|
row | number |
Returns
null | DataFrame
Overrides
Source
getCategory()
getCategory(
categoryIndex):string
Returns i-th category. Applicable to string column only.
Parameters
| Parameter | Type |
|---|---|
categoryIndex | number |
Returns
string
Inherited from
Source
getCategoryOrder()
getCategoryOrder():
string[]
Gets order of categories
Returns
string[]
Inherited from
Source
getNumber()
getNumber(
i):number
Returns i-th value as number
Parameters
| Parameter | Type | Description |
|---|---|---|
i | number |
Returns
number
Inherited from
Source
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
Source
getSortedOrder()
getSortedOrder():
Int32Array
Returns an array of indexes sorted using [valueComparer].
Returns
Int32Array
Inherited from
Source
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
| Parameter | Type | Description |
|---|---|---|
i | number |
Returns
string
Inherited from
Source
getTag()
getTag(
tag):string
Returns the value of the specified tag, or null if the tag is not present.
Parameters
| Parameter | Type |
|---|---|
tag | string |
Returns
string
Inherited from
Source
init()
init(
valueInitializer):Column<any,any>
Initializes all values in the column to [columnInitializer].
Parameters
| Parameter | Type | Description |
|---|---|---|
valueInitializer | null | string | number | boolean | Date | Dayjs | (ind) => any | value, or a function that returns value by index |
Returns
Column<any, any>
Inherited from
Source
isNone()
isNone(
i):boolean
Returns whether i-th value is missing.
Parameters
| Parameter | Type | Description |
|---|---|---|
i | number | Row index. |
Returns
boolean
Inherited from
Source
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
| Parameter | Type |
|---|---|
filter | null | "string" | "bigint" | "object" | "int" | "double" | "bool" | "byte_array" | "datetime" | "qnum" | "dataframe" | "categorical" | "numerical" |
Returns
boolean
Inherited from
Source
scale()
scale(
idx):number
Linearly maps idx-th value to the [0,1] interval, where 0 represents column minimum, and 1 represents maximum.
Parameters
| Parameter | Type |
|---|---|
idx | number |
Returns
number
Inherited from
Source
set()
set(
i,value,notify):void
Sets [i]-th value to [x], and optionally notifies the dataframe about this change.
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
i | number | undefined | |
value | null | DataFrame | undefined | |
notify | boolean | true | whether DataFrame's changed event should be fired. Call fireValuesChanged after you are done modifying the column. |
Returns
void
Inherited from
Source
setCategoryOrder()
setCategoryOrder(
order):void
Sets order of categories
Parameters
| Parameter | Type |
|---|---|
order | string[] |
Returns
void
Inherited from
Source
setRawData()
setRawData(
rawData,notify):void
Parameters
| Parameter | Type | Default value |
|---|---|---|
rawData | Int32Array | Uint32Array | Float32Array | Float64Array | undefined |
notify | boolean | true |
Returns
void
Inherited from
Source
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
| Parameter | Type | Default value | Description |
|---|---|---|---|
i | number | undefined | |
str | string | undefined | |
notify | boolean | true | whether DataFrame's changed event should be fired |
Returns
boolean
Inherited from
Source
setTag()
setTag(
tag,value):Column<any,any>
Sets a tag to the specified value.
Parameters
| Parameter | Type | Description |
|---|---|---|
tag | string | Key. |
value | string | Value. |
Returns
Column<any, any>
. *
Inherited from
Source
toList()
toList():
DataFrame[]
Returns all values as an array.
Returns
Overrides
Source
toString()
toString():
string
Returns
string
- string representation of this column
Inherited from
Source
values()
values():
Generator<null|DataFrame,void,unknown>
An iterator over all values in this column.
Returns
Generator<null | DataFrame, void, unknown>
Inherited from
Source
bool()
staticbool(name,length):Column<boolean,boolean>
Creates a boolean column with the specified name and length.
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
name | string | undefined | |
length | number | 0 |
Returns
Column<boolean, boolean>
Inherited from
Source
dataFrame()
staticdataFrame(name,length):Column<DataFrame,DataFrame>
Creates a column containing dataframes with the specified name and length.
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
name | string | undefined | |
length | number | 0 |
Returns
Inherited from
Source
dateTime()
staticdateTime(name,length):Column<any,any>
Creates a datetime column with the specified name and length.
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
name | string | undefined | |
length | number | 0 |
Returns
Column<any, any>
Inherited from
Source
float()
staticfloat(name,length):Column<number,number>
Creates a floating point column with the specified name and length.
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
name | string | undefined | |
length | number | 0 |
Returns
Column<number, number>
Inherited from
Source
fromBigInt64Array()
staticfromBigInt64Array(name,array):Column<any,any>
Creates BigIntColumn from BigInt64Array / BigUint64Array
Parameters
| Parameter | Type |
|---|---|
name | string |
array | BigInt64Array | BigUint64Array |
Returns
Column<any, any>
Inherited from
Source
fromBitSet()
staticfromBitSet(name,bitset):Column<boolean,boolean>
Creates a Column from the bitset.
Parameters
| Parameter | Type | Description |
|---|---|---|
name | string | |
bitset | BitSet |
Returns
Column<boolean, boolean>
Inherited from
Source
fromFloat32Array()
staticfromFloat32Array(name,array,length):Column<number,number>
[array] will be not be copied and will be used as column's storage
Parameters
| Parameter | Type | Default value |
|---|---|---|
name | string | undefined |
array | Float32Array | undefined |
length | null | number | null |
Returns
Column<number, number>
Inherited from
Source
fromFloat64Array()
staticfromFloat64Array(name,array,length):Column<number,number>
[array] will be not be copied and will be used as column's storage
Parameters
| Parameter | Type | Default value |
|---|---|---|
name | string | undefined |
array | Float64Array | undefined |
length | null | number | null |
Returns
Column<number, number>
Inherited from
Source
fromIndexes()
staticfromIndexes(name,categories,indexes):Column<any,any>
Crates a Column of string type from categories and indexes
Parameters
| Parameter | Type | Description |
|---|---|---|
name | string | |
categories | string[] | |
indexes | Int32Array |
Returns
Column<any, any>
Inherited from
Source
fromInt32Array()
staticfromInt32Array(name,array,length):Column<number,number>
[array] will be not be copied and will be used as column's storage
Parameters
| Parameter | Type | Default value |
|---|---|---|
name | string | undefined |
array | Int32Array | undefined |
length | null | number | null |
Returns
Column<number, number>
Inherited from
Source
fromList()
staticfromList(type,name,list):Column<any,any>
Creates a Column from the list of values.
Parameters
| Parameter | Type | Description |
|---|---|---|
type | "string" | "bigint" | "object" | "int" | "double" | "bool" | "byte_array" | "datetime" | "qnum" | "dataframe" | |
name | string | |
list | any[] |
Returns
Column<any, any>
Inherited from
Source
fromStrings()
staticfromStrings(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
| Parameter | Type | Description |
|---|---|---|
name | string | Column name |
list | string[] | 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
Source
fromType()
staticfromType(type,name?,length?):Column<any,any>
Creates a Column with explicitly specified type
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
type | "string" | "bigint" | "object" | "int" | "double" | "bool" | "byte_array" | "datetime" | "qnum" | "dataframe" | undefined | column type code COLUMN_TYPE |
name? | null | string | undefined | Column name |
length? | number | 0 | Column length (should match row count of the data frame ) |
Returns
Column<any, any>
Inherited from
See
COLUMN_TYPE
Source
int()
staticint(name,length):Column<number,number>
Creates an integer column with the specified name and length.
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
name | string | undefined | |
length | number | 0 |
Returns
Column<number, number>
Inherited from
Source
qnum()
staticqnum(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
| Parameter | Type | Default value | Description |
|---|---|---|---|
name | string | undefined | |
length | number | 0 | |
values | number[] | [] | |
exact | boolean | true | if true, strips out qualifier from [values]. |
Returns
Column<number, number>
Inherited from
Source
string()
staticstring(name,length):Column<string,string>
Creates a string column with the specified name and length.
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
name | string | undefined | |
length | number | 0 |
Returns
Column<string, string>