Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ public fun <T> Iterable<DataRow<T>>.toDataFrame(): DataFrame<T> {
}
}

@JvmName("toDataFrameMapStringAnyNullable")
public fun Iterable<Map<String, *>>.toDataFrame(): DataFrame<*> = map { it.toDataRow() }.toDataFrame()

@JvmName("toDataFrameAnyColumn")
public fun Iterable<AnyBaseCol>.toDataFrame(): AnyFrame = dataFrameOf(this)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,16 @@ class CreateDataFrameTests {
df["value"].toList() shouldBe maps
}

@Test
fun `should convert iterables of maps representing rows to DataFrame with value column`() {
val maps: Iterable<Map<String, *>> = listOf(mapOf("a" to 1, "b" to true), mapOf("c" to 2, "d" to false),)
val df = maps.toDataFrame()
df["a"][0] shouldBe 1
df["b"][0] shouldBe true
df["c"][1] shouldBe 2
df["d"][1] shouldBe false
}

class NoPublicPropsClass(private val a: Int, private val b: String)

@Test
Expand Down
Loading