Skip to content
Merged
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 @@ -539,11 +539,12 @@ class Analyze : TestBase() {
@TransformDataFrameExpressions
fun dataFrameToGroupBy() {
// SampleStart
val key by columnOf(1, 2) // create int column with name "key"
val data by columnOf(df[0..3], df[4..6]) // create frame column with name "data"
val df = dataFrameOf(key, data) // create dataframe with two columns
val df = dataFrameOf(
"key" to columnOf(1, 2),
"data" to columnOf(df[0..3], df[4..6]),
) // create dataframe with two columns

df.asGroupBy { data } // convert dataframe to GroupBy by interpreting 'data' column as groups
df.asGroupBy("data") // convert dataframe to GroupBy by interpreting 'data' column as groups
// SampleEnd
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -648,11 +648,11 @@ class Modify : TestBase() {
@TransformDataFrameExpressions
fun explodeSeveral() {
// SampleStart
val a by columnOf(listOf(1, 2), listOf(3, 4, 5))
val b by columnOf(listOf(1, 2, 3), listOf(4, 5))

val df = dataFrameOf(a, b)
df.explode { a and b }
val df = dataFrameOf(
"a" to columnOf(listOf(1, 2), listOf(3, 4, 5)),
"b" to columnOf(listOf(1, 2, 3), listOf(4, 5)),
)
df.explode("a", "b")
// SampleEnd
}

Expand Down
10 changes: 5 additions & 5 deletions docs/StardustDocs/topics/explode.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ When several columns are exploded in one operation, lists in different columns w
<!---FUN explodeSeveral-->

```kotlin
val a by columnOf(listOf(1, 2), listOf(3, 4, 5))
val b by columnOf(listOf(1, 2, 3), listOf(4, 5))

val df = dataFrameOf(a, b)
df.explode { a and b }
val df = dataFrameOf(
"a" to columnOf(listOf(1, 2), listOf(3, 4, 5)),
"b" to columnOf(listOf(1, 2, 3), listOf(4, 5)),
)
df.explode("a", "b")
```

<!---END-->
Expand Down
9 changes: 5 additions & 4 deletions docs/StardustDocs/topics/groupBy.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,12 @@ Any [`DataFrame`](DataFrame.md) with `FrameColumn` can be reinterpreted as `Grou
<!---FUN dataFrameToGroupBy-->

```kotlin
val key by columnOf(1, 2) // create int column with name "key"
val data by columnOf(df[0..3], df[4..6]) // create frame column with name "data"
val df = dataFrameOf(key, data) // create dataframe with two columns
val df = dataFrameOf(
"key" to columnOf(1, 2),
"data" to columnOf(df[0..3], df[4..6]),
) // create dataframe with two columns

df.asGroupBy { data } // convert dataframe to GroupBy by interpreting 'data' column as groups
df.asGroupBy("data") // convert dataframe to GroupBy by interpreting 'data' column as groups
```

<!---END-->
Expand Down
Loading