Data
Creating, loading, querying, manipulating, joining tables.
Constructors
new Data()
new Data():
Data
Returns
Properties
Property | Modifier | Type | Default value |
---|---|---|---|
db | public | Db | ... |
demo | public | DemoDatasets | ... |
files | public | Files | ... |
Methods
callQuery()
callQuery(
queryName
,queryParameters
,adHoc
):Promise
<FuncCall
>
Parameters
Parameter | Type | Default value |
---|---|---|
queryName | string | undefined |
queryParameters | null | object | null |
adHoc | boolean | false |
Returns
Promise
<FuncCall
>
Source
compareTables()
compareTables(
t1
,t2
,keyColumns1
,keyColumns2
,valueColumns1
,valueColumns2
):object
Opens the visual table comparison tool. Sample: https://public.datagrok.ai/js/samples/data-frame/compare-tables
Parameters
Parameter | Type |
---|---|
t1 | DataFrame |
t2 | DataFrame |
keyColumns1 | string [] |
keyColumns2 | string [] |
valueColumns1 | string [] |
valueColumns2 | string [] |
Returns
object
Member | Type |
---|---|
changedColumns | number |
changedValues | number |
diffTable | DataFrame |
missingRows | number |
t1MissingRows | number |
t2MissingRows | number |
Source
detectSemanticTypes()
detectSemanticTypes(
t
):Promise
<void
>
Parameters
Parameter | Type |
---|---|
t | DataFrame |
Returns
Promise
<void
>
Source
getDemoTable()
getDemoTable(
path
):Promise
<DataFrame
>
Parameters
Parameter | Type |
---|---|
path | string |
Returns
Promise
<DataFrame
>
Source
joinTables()
joinTables(
t1
,t2
,keyColumns1
,keyColumns2
,valueColumns1
,valueColumns2
,joinType
,inPlace
):DataFrame
Merges two tables by the specified key columns.
Parameters
Parameter | Type | Default value | Description |
---|---|---|---|
t1 | DataFrame | undefined | a table to join |
t2 | DataFrame | undefined | a table to join |
keyColumns1 | string [] | undefined | key column names from the first table |
keyColumns2 | string [] | undefined | key column names from the second table |
valueColumns1 | null | string [] | null | column names to copy from the first table. Pass null to add all columns, an empty array [] to not add any columns, or an array with column names to add them specifically. |
valueColumns2 | null | string [] | null | column names to copy from the second table |
joinType | "left" | "right" | "inner" | "outer" | JOIN_TYPE.INNER | inner, outer, left, or right. See [DG.JOIN_TYPE] |
inPlace | boolean | false | merges content in-place into the source table |
Returns
Sample: https://public.datagrok.ai/js/samples/data-frame/join-link/join-tables
Source
linkTables()
linkTables(
t1
,t2
,keyColumns1
,keyColumns2
,linkTypes
,initialSync
):void
Links tables by the specified key columns using the specified link types (such as "current row to filter", see DG.SYNC_TYPE). Tables are synchronized on the first change, set the initialSync option to reflect the current table state according to the sync type.
Parameters
Parameter | Type | Default value |
---|---|---|
t1 | DataFrame | undefined |
t2 | DataFrame | undefined |
keyColumns1 | string [] | undefined |
keyColumns2 | string [] | undefined |
linkTypes | ("row to row" | "row to selection" | "row to filter" | "mouse-over to selection" | "mouse-over to filter" | "filter to filter" | "filter to selection" | "selection to filter" | "selection to selection" )[] | undefined |
initialSync | boolean | false |
Returns
void
Source
loadTable()
loadTable(
csvUrl
):Promise
<DataFrame
>
Loads table from the specified URL. Sample: https://public.datagrok.ai/js/samples/data-access/load-csv
Parameters
Parameter | Type | Description |
---|---|---|
csvUrl | string |
Returns
Promise
<DataFrame
>
Source
openTable()
openTable(
id
):Promise
<DataFrame
>
Opens a table by its id. Sample: https://public.datagrok.ai/js/samples/data-access/open-table-by-id
Parameters
Parameter | Type | Description |
---|---|---|
id | string | table GUID |
Returns
Promise
<DataFrame
>
Source
parseCsv()
parseCsv(
csv
,options
?):DataFrame
Parses the CSV string.
Parameters
Parameter | Type | Description |
---|---|---|
csv | string | The content of the comma-separated values file. |
options ? | CsvImportOptions |
Returns
Source
query()
query(
queryName
,queryParameters
,adHoc
):Promise
<any
>
Executes a parameterized query. Sample: https://public.datagrok.ai/js/samples/data-access/parameterized-query
Parameters
Parameter | Type | Default value |
---|---|---|
queryName | string | undefined |
queryParameters | null | object | null |
adHoc | boolean | false |
Returns
Promise
<any
>
Source
testData()
testData(
dataset
,rows
,columns
):DataFrame
Creates a generic dataset with the defined number of rows and columns. [dataset] allowed values: "wells" - experimental plate wells: barcode, row, col, pos, volume, concentration, role "demog" - clinical study demographics data: subj, study, site, sex, race, disease, start date "biosensor": wearable sensor data: time, x, y, z, temp, eda "random walk": random walk data for the specified number of dimensions "geo": geographic coordinates given as latitude/longitude pairs: lat, lng, value
Parameters
Parameter | Type | Default value |
---|---|---|
dataset | "wells" | "demog" | "biosensor" | "random walk" | "geo" | "molecules" | "dose-response" | undefined |
rows | number | 10000 |
columns | number | 3 |