krangl / krangl / dataFrameOf

dataFrameOf

fun dataFrameOf(vararg header: String): InplaceDataFrameBuilder
fun dataFrameOf(header: Iterable<String>): InplaceDataFrameBuilder

Create a new data frame in place.

// data-frames can be a  mix of atomic (int, double, boolean, string) and object columns
val birthdays = DataFrame.builder("name", "height", "sex", "birthday")(
        "Tom", 1.89, Sex.MALE, LocalDate.of(1980, 5, 22),
        "Jane", 1.73, Sex.FEMALE, LocalDate.of(1973, 2, 13)
)
fun dataFrameOf(vararg columns: DataCol): DataFrame

Create a new data-frame from a list of DataCol instances

// data-frames can be a  mix of atomic (int, double, boolean, string) and object columns
val birthdays = DataFrame.builder("name", "height", "sex", "birthday")(
        "Tom", 1.89, Sex.MALE, LocalDate.of(1980, 5, 22),
        "Jane", 1.73, Sex.FEMALE, LocalDate.of(1973, 2, 13)
)
fun dataFrameOf(rows: Iterable<DataFrameRow>): DataFrame

Create a new data-frame from a records encoded as key-value maps.

Column types will be inferred from the value types.

// data-frames can be a  mix of atomic (int, double, boolean, string) and object columns
val birthdays = DataFrame.builder("name", "height", "sex", "birthday")(
        "Tom", 1.89, Sex.MALE, LocalDate.of(1980, 5, 22),
        "Jane", 1.73, Sex.FEMALE, LocalDate.of(1973, 2, 13)
)