DataRow
DataRow represents a single record, one piece of data within a DataFrame
Row functions
index(): Int— sequential row number inDataFrame, starts from 0prev(): DataRow?— previous row (nullfor the first row)next(): DataRow?— next row (nullfor the last row)diff(T) { rowExpression }: T / diffOrNull { rowExpression }: T?— difference between the results of a row expression calculated for current and previous rowsexplode(columns): DataFrame<T>— spread lists andDataFrameobjects vertically into new rowsvalues(): List<Any?>— list of all cell values from the current rowvaluesOf<T>(): List<T>— list of values of the given typecolumnsCount(): Int— number of columnscolumnNames(): List<String>— list of all column namescolumnTypes(): List<KType>— list of all column typesnamedValues(): List<NameValuePair<Any?>>— list of name-value pairs wherenameis a column name andvalueis cell valuenamedValuesOf<T>(): List<NameValuePair<T>>— list of name-value pairs where value has given typetranspose(): DataFrame<NameValuePair<*>>—DataFrameof two columns:name: Stringis column names andvalue: Any?is cell valuestransposeTo<T>(): DataFrame<NameValuePair<T>>—DataFrameof two columns:name: Stringis column names andvalue: Tis cell valuesgetRow(Int): DataRow— row fromDataFrameby row indexgetRows(Iterable<Int>): DataFrame—DataFramewith subset of rows selected by absolute row index.relative(Iterable<Int>): DataFrame—DataFramewith subset of rows selected by relative row index:relative(-1..1)will return previous, current and next row. Requested indices will be coerced to the valid range and invalid indices will be skippedgetValue<T>(columnName)— cell value of typeTby this row and givencolumnNamegetValueOrNull<T>(columnName)— cell value of typeT?by this row and givencolumnNameornullif there's no such columnget(column): T— cell value by this row and givencolumnString.invoke<T>(): T— cell value of typeTby this row and giventhiscolumn nameColumnPath.invoke<T>(): T— cell value of typeTby this row and giventhiscolumn pathColumnReference.invoke(): T— cell value of typeTby this row and giventhiscolumndf()—DataFramethat current row belongs to
Row expressions
Row expressions provide a value for every row of DataFrame and are used in add, filter, forEach, update and other operations.
Row expression signature: DataRow.(DataRow) -> T. Row values can be accessed with or without it keyword. Implicit and explicit argument represent the same DataRow object.
Row conditions
Row condition is a special case of row expression that returns Boolean.
Row condition signature: DataRow.(DataRow) -> Boolean
Row statistics
The following statistics are available for DataRow:
rowSumrowMeanrowStd
These statistics will be applied only to values of appropriate types, and incompatible values will be ignored. For example, if a dataframe has columns of types String and Int, rowSum() will compute the sum of the Int values in the row and ignore String values.
To apply statistics only to values of a particular type use -Of versions:
rowSumOf<T>rowMeanOf<T>rowStdOf<T>rowMinOf<T>rowMaxOf<T>rowMedianOf<T>rowPercentileOf<T>