Skip to content

Commit

Permalink
korro
Browse files Browse the repository at this point in the history
  • Loading branch information
koperagen committed May 19, 2022
1 parent f41e32e commit d8c6b2f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
6 changes: 3 additions & 3 deletions docs/StardustDocs/topics/ColumnSelectors.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ df.select { cols(1..4) }

```kotlin
// by condition
df.select { cols { it.name.startsWith("year") } }
df.select { cols { it.name().startsWith("year") } }
df.select { startsWith("year") }

// by type
Expand All @@ -177,7 +177,7 @@ df.select { allDfs() }
df.select { allDfs(includeGroups = true) }

// dfs traversal with condition
df.select { dfs { it.name.contains(":") } }
df.select { dfs { it.name().contains(":") } }

// dfs traversal of columns of given type
df.select { dfsOf<String>() }
Expand Down Expand Up @@ -205,7 +205,7 @@ df.select { allDfs().drop(3) }
df.select { allDfs().dropLast(3) }

// filter column set by condition
df.select { allDfs().filter { it.name.startsWith("year") } }
df.select { allDfs().filter { it.name().startsWith("year") } }

// exclude columns from column set
df.select { allDfs().except { age } }
Expand Down
1 change: 1 addition & 0 deletions docs/StardustDocs/topics/createDataFrame.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ map.toDataFrame()

```kotlin
data class Person(val name: String, val age: Int)

val persons = listOf(Person("Alice", 15), Person("Bob", 20), Person("Charlie", 22))

val df = persons.toDataFrame()
Expand Down
10 changes: 5 additions & 5 deletions docs/StardustDocs/topics/move.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,26 +24,26 @@ df.move { weight }.to(1)

// age -> info.age
// weight -> info.weight
df.move { age and weight }.into { pathOf("info", it.name) }
df.move { age and weight }.into { "info"[it.name] }
df.move { age and weight }.into { pathOf("info", it.name()) }
df.move { age and weight }.into { "info"[it.name()] }
df.move { age and weight }.under("info")

// name.firstName -> fullName.first
// name.lastName -> fullName.last
df.move { name.firstName and name.lastName }.into { pathOf("fullName", it.name.dropLast(4)) }
df.move { name.firstName and name.lastName }.into { pathOf("fullName", it.name().dropLast(4)) }

// a|b|c -> a.b.c
// a|d|e -> a.d.e
dataFrameOf("a|b|c", "a|d|e")(0, 0)
.move { all() }.into { it.name.split("|").toPath() }
.move { all() }.into { it.name().split("|").toPath() }

// name.firstName -> firstName
// name.lastName -> lastName
df.move { name.cols() }.toTop()

// a.b.e -> be
// c.d.e -> de
df.move { dfs { it.name == "e" } }.toTop { it.parent!!.name + it.name }
df.move { dfs { it.name() == "e" } }.toTop { it.parent!!.name() + it.name() }
```

<!---END-->
Expand Down

0 comments on commit d8c6b2f

Please sign in to comment.