File tree Expand file tree Collapse file tree 3 files changed +5
-29
lines changed
core/generated-sources/src
main/kotlin/org/jetbrains/kotlinx/dataframe
test/kotlin/org/jetbrains/kotlinx/dataframe/samples/api Expand file tree Collapse file tree 3 files changed +5
-29
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ import org.jetbrains.kotlinx.dataframe.impl.columns.createComputedColumnReferenc
3232import org.jetbrains.kotlinx.dataframe.impl.columns.forceResolve
3333import org.jetbrains.kotlinx.dataframe.impl.columns.unbox
3434import org.jetbrains.kotlinx.dataframe.size
35+ import org.jetbrains.kotlinx.dataframe.util.DATAFRAME_OF_WITH_VALUES
3536import kotlin.random.Random
3637import kotlin.random.nextInt
3738import kotlin.reflect.KProperty
@@ -361,6 +362,7 @@ public fun dataFrameOf(header: Iterable<String>): DataFrameBuilder = DataFrameBu
361362public fun dataFrameOf (vararg columns : Pair <String , List <Any ?>>): DataFrame <* > =
362363 columns.map { it.second.toColumn(it.first, Infer .Type ) }.toDataFrame()
363364
365+ @Deprecated(DATAFRAME_OF_WITH_VALUES , ReplaceWith (" dataFrameOf(header).withValues(values)" ))
364366public fun dataFrameOf (header : Iterable <String >, values : Iterable <Any ?>): DataFrame <* > =
365367 dataFrameOf(header).withValues(values)
366368
Original file line number Diff line number Diff line change @@ -163,6 +163,9 @@ internal const val TO_CSV_REPLACE = "this.toCsvStr()"
163163internal const val SPLIT_STR =
164164 " Please explicitly specify how the String should be split. This shortcut will be removed in version 1.1.0"
165165
166+ internal const val DATAFRAME_OF_WITH_VALUES =
167+ " Deprecated in favor of dataFrameOf(names).withValues(values). Will be error in 1.1.0"
168+
166169// endregion
167170
168171// region keep across releases
Original file line number Diff line number Diff line change @@ -336,35 +336,6 @@ class Create : TestBase() {
336336 // SampleEnd
337337 }
338338
339- @Test
340- @TransformDataFrameExpressions
341- fun createDataFrameFromIterable () {
342- // SampleStart
343- val name by columnOf(" Alice" , " Bob" , " Charlie" )
344- val age by columnOf(15 , 20 , 22 )
345-
346- listOf (name, age).toDataFrame()
347- // SampleEnd
348- }
349-
350- @Test
351- @TransformDataFrameExpressions
352- fun createDataFrameFromNamesAndValues () {
353- // SampleStart
354- val names = listOf (" name" , " age" )
355- val values = listOf (
356- " Alice" , 15 ,
357- " Bob" , 20 ,
358- " Charlie" , 22 ,
359- )
360- val df = dataFrameOf(names, values)
361- // SampleEnd
362- df.columnNames() shouldBe listOf (" name" , " age" )
363- df.rowsCount() shouldBe 3
364- df[" name" ].type() shouldBe typeOf<String >()
365- df[" age" ].type() shouldBe typeOf<Int >()
366- }
367-
368339 @Test
369340 @TransformDataFrameExpressions
370341 fun readDataFrameFromValues () {
You can’t perform that action at this time.
0 commit comments