Skip to content

Commit 2680b5c

Browse files
committed
Remove unused API example from Access.kt and Create.kt
1 parent 6e9f176 commit 2680b5c

File tree

3 files changed

+2
-69
lines changed

3 files changed

+2
-69
lines changed

core/src/test/kotlin/org/jetbrains/kotlinx/dataframe/samples/api/Access.kt

Lines changed: 1 addition & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@ import org.jetbrains.kotlinx.dataframe.api.add
66
import org.jetbrains.kotlinx.dataframe.api.after
77
import org.jetbrains.kotlinx.dataframe.api.chunked
88
import org.jetbrains.kotlinx.dataframe.api.colsOf
9-
import org.jetbrains.kotlinx.dataframe.api.column
10-
import org.jetbrains.kotlinx.dataframe.api.columnOf
119
import org.jetbrains.kotlinx.dataframe.api.countDistinct
12-
import org.jetbrains.kotlinx.dataframe.api.dataFrameOf
1310
import org.jetbrains.kotlinx.dataframe.api.distinct
1411
import org.jetbrains.kotlinx.dataframe.api.distinctBy
1512
import org.jetbrains.kotlinx.dataframe.api.drop
@@ -37,13 +34,11 @@ import org.jetbrains.kotlinx.dataframe.api.maxByOrNull
3734
import org.jetbrains.kotlinx.dataframe.api.minBy
3835
import org.jetbrains.kotlinx.dataframe.api.minus
3936
import org.jetbrains.kotlinx.dataframe.api.move
40-
import org.jetbrains.kotlinx.dataframe.api.named
4137
import org.jetbrains.kotlinx.dataframe.api.notNull
4238
import org.jetbrains.kotlinx.dataframe.api.remove
4339
import org.jetbrains.kotlinx.dataframe.api.rows
4440
import org.jetbrains.kotlinx.dataframe.api.select
4541
import org.jetbrains.kotlinx.dataframe.api.single
46-
import org.jetbrains.kotlinx.dataframe.api.sortBy
4742
import org.jetbrains.kotlinx.dataframe.api.take
4843
import org.jetbrains.kotlinx.dataframe.api.takeLast
4944
import org.jetbrains.kotlinx.dataframe.api.takeWhile
@@ -407,37 +402,6 @@ class Access : TestBase() {
407402
// SampleEnd
408403
}
409404

410-
@Test
411-
@TransformDataFrameExpressions
412-
fun namedAndRenameCol() {
413-
// SampleStart
414-
val unnamedCol = columnOf("Alice", "Bob")
415-
val colRename = unnamedCol.rename("name")
416-
val colNamed = columnOf("Alice", "Bob") named "name"
417-
// SampleEnd
418-
}
419-
420-
@Test
421-
@TransformDataFrameExpressions
422-
fun namedColumnWithoutValues() {
423-
// SampleStart
424-
val name by column<String>()
425-
val col = column<String>("name")
426-
// SampleEnd
427-
}
428-
429-
@Test
430-
@TransformDataFrameExpressions
431-
fun colRefForTypedAccess() {
432-
val df = dataFrameOf("name")("Alice", "Bob")
433-
val name by column<String>()
434-
val col = column<String>("name")
435-
// SampleStart
436-
df.filter { it[name].startsWith("A") }
437-
df.sortBy { col }
438-
// SampleEnd
439-
}
440-
441405
@Test
442406
@TransformDataFrameExpressions
443407
fun iterableApi() {
@@ -653,19 +617,14 @@ class Access : TestBase() {
653617
colGroup("name").lastCol { it.name().endsWith("Name") }
654618
}
655619

656-
// find the single column inside a column group satisfying the condition
657-
df.select {
658-
Person::name.singleCol { it.name().startsWith("first") }
659-
}
660-
661620
// traversal of columns at any depth from here excluding ColumnGroups
662621
df.select { colsAtAnyDepth().filter { !it.isColumnGroup() } }
663622

664623
// traversal of columns at any depth from here including ColumnGroups
665624
df.select { colsAtAnyDepth() }
666625

667626
// traversal of columns at any depth with condition
668-
df.select { colsAtAnyDepth().filter() { it.name().contains(":") } }
627+
df.select { colsAtAnyDepth().filter { it.name().contains(":") } }
669628

670629
// traversal of columns at any depth to find columns of given type
671630
df.select { colsAtAnyDepth().colsOf<String>() }

core/src/test/kotlin/org/jetbrains/kotlinx/dataframe/samples/api/Create.kt

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -51,32 +51,6 @@ class Create : TestBase() {
5151
// SampleEnd
5252
}
5353

54-
@Test
55-
@TransformDataFrameExpressions
56-
fun columnAccessorsUsage() {
57-
// SampleStart
58-
val age by column<Int>()
59-
60-
// Access fourth cell in the "age" column of dataframe `df`.
61-
// This expression returns `Int` because variable `age` has `ColumnAccessor<Int>` type.
62-
// If dataframe `df` has no column "age" or column "age" has type which is incompatible with `Int`,
63-
// runtime exception will be thrown.
64-
df[age][3] + 5
65-
66-
// Access first cell in the "age" column of dataframe `df`.
67-
df[0][age] * 2
68-
69-
// Returns new dataframe sorted by age column (ascending)
70-
df.sortBy(age)
71-
72-
// Returns new dataframe with the column "year of birth" added
73-
df.add("year of birth") { 2021 - age }
74-
75-
// Returns new dataframe containing only rows with age > 30
76-
df.filter { age > 30 }
77-
// SampleEnd
78-
}
79-
8054
@Test
8155
@TransformDataFrameExpressions
8256
fun columnAccessorMap() {

core/src/test/kotlin/org/jetbrains/kotlinx/dataframe/samples/api/JoinWith.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ class JoinWith : TestBase() {
144144
cellRenderer = renderer,
145145
configuration = SamplesDisplayConfiguration.copy(
146146
cellFormatter = { row, col ->
147-
val value = row[col]
147+
val value = col[row]
148148
if (value is ColoredValue<*>) {
149149
background(value.backgroundColor) and textColor(value.textColor)
150150
} else {

0 commit comments

Comments
 (0)