dataFrameOf

inline fun <reified T : DataRowSchema> dataFrameOf(vararg rows: T): DataFrame<T>

Example:

@DataSchema
data class Person(val name: String, val age: Int)

fun main() {
val df = dataFrameOf(Person("Alice", 30), Person("Bob", 25))
val dfWithCarol = df.append(Person("Carol", 25))
}

Creates new DataFrame with given columns.

All named columns must have unique names. For columns with empty names unique column names are generated: "untitled", "untitled1", "untitled2" etc.

All columns must have equal sizes.

For more information: See dataFrameOf on the documentation website.

Parameters

columns

columns for DataFrame

Throws

if column names are not unique

if column sizes are not equal


@JvmName(name = "dataFrameOfColumns")
fun dataFrameOf(vararg columns: Pair<String, BaseColumn<*>>): DataFrame<*>

See dataFrameOf on the documentation website.

Example:

val df = dataFrameOf(
"a" to columnOf(1, 2),
"b" to columnOf(1.0, 2.0),
"group" to columnOf(
"nestedA" to columnOf("42", "abc"),
)
)

fun dataFrameOf(vararg columns: BaseColumn<*>): DataFrame<*>
fun dataFrameOf(vararg header: String): DataFrameBuilder
inline fun <reified C> dataFrameOf(vararg header: String, crossinline fill: (String) -> Iterable<C>): DataFrame<*>
fun dataFrameOf(vararg columns: Pair<String, List<Any?>>): DataFrame<*>
inline fun <T, reified C> dataFrameOf(header: Iterable<T>, fill: (T) -> Iterable<C>): DataFrame<*>


fun dataFrameOf(header: Iterable<String>, values: Iterable<Any?>): DataFrame<*>

Deprecated

Deprecated in favor of dataFrameOf(names).withValues(values). Will be ERROR in 1.1.

Replace with

dataFrameOf(header).withValues(values)