Skip to content

Adding links to column selectors in docs #1226

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 2, 2025
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
2 changes: 1 addition & 1 deletion docs/StardustDocs/topics/add.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<!---IMPORT org.jetbrains.kotlinx.dataframe.samples.api.Modify-->

Returns [`DataFrame`](DataFrame.md) which contains all columns from original [`DataFrame`](DataFrame.md) followed by newly added columns.
Returns [`DataFrame`](DataFrame.md) which contains all columns from the original [`DataFrame`](DataFrame.md) followed by newly added columns.
Original [`DataFrame`](DataFrame.md) is not modified.

`add` appends columns to the end of the dataframe by default.
Expand Down
3 changes: 2 additions & 1 deletion docs/StardustDocs/topics/convert.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ colExpression = DataFrame.(DataColumn) -> DataColumn
frameExpression: DataFrame.(DataFrame) -> DataFrame
```

See [column selectors](ColumnSelectors.md) and [row expressions](DataRow.md#row-expressions)
See [column selectors](ColumnSelectors.md) for how to select the columns for this operation and
[row expressions](DataRow.md#row-expressions) for how to provide new values.

<!---FUN convert-->

Expand Down
4 changes: 3 additions & 1 deletion docs/StardustDocs/topics/corr.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ corr { columns1 }
.with { columns2 } | .withItself()
```

See [column selectors](ColumnSelectors.md) for how to select the columns for this operation.

To compute pairwise correlation between all columns in the [`DataFrame`](DataFrame.md) use `corr` without arguments:

```kotlin
Expand All @@ -19,7 +21,7 @@ The function is available for numeric- and `Boolean` columns.
`Boolean` values are converted into `1` for `true` and `0` for `false`.
All other columns are ignored.

If a [`ColumnGroup`](DataColumn.md#columngroup) instance is passed as target column for correlation,
If a [`ColumnGroup`](DataColumn.md#columngroup) instance is passed as the target column for correlation,
it will be unpacked into suitable nested columns.

The resulting [`DataFrame`](DataFrame.md) will have `n1` rows and `n2+1` columns,
Expand Down
2 changes: 2 additions & 0 deletions docs/StardustDocs/topics/cumSum.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ cumSum(skipNA = true) [ { columns } ]

Returns a [`DataFrame`](DataFrame.md) or [`DataColumn`](DataColumn.md) containing the cumulative sum.

See [column selectors](ColumnSelectors.md) for how to select the columns for this operation.

**Parameters:**
* `skipNA` — when `true`, ignores [`NA` values](nanAndNa.md#na) (`null` or `NaN`).
When `false`, all values after first `NA` will be `NaN` (for `Double` and `Float` columns) or `null` (for integer columns).
Expand Down
4 changes: 4 additions & 0 deletions docs/StardustDocs/topics/distinct.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ df.distinct()

If columns are specified, resulting [`DataFrame`](DataFrame.md) will have only given columns with distinct values.

See [column selectors](ColumnSelectors.md) for how to select the columns for this operation.

<!---FUN distinctColumns-->
<tabs>
<tab title="Properties">
Expand Down Expand Up @@ -43,6 +45,8 @@ df.select("age", "name").distinct()

Keep only the first row for every group of rows grouped by some condition.

See [column selectors](ColumnSelectors.md) for how to select the columns for this operation.

<!---FUN distinctBy-->
<tabs>
<tab title="Properties">
Expand Down
6 changes: 6 additions & 0 deletions docs/StardustDocs/topics/drop.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ df.drop { it["weight"] == null || it["city"] == null }

Remove rows with `null` values

See [column selectors](ColumnSelectors.md) for how to select the columns for this operation.

<!---FUN dropNulls-->

```kotlin
Expand All @@ -44,6 +46,8 @@ df.dropNulls(whereAllNull = true) { city and weight } // remove rows with null v

Remove rows with [`NaN` values](nanAndNa.md#nan) (`Double.NaN` or `Float.NaN`).

See [column selectors](ColumnSelectors.md) for how to select the columns for this operation.

<!---FUN dropNaNs-->

```kotlin
Expand All @@ -61,6 +65,8 @@ df.dropNaNs(whereAllNaN = true) { age and weight } // remove rows where both 'ag

Remove rows with [`NA` values](nanAndNa.md#na) (`null`, `Double.NaN`, or `Float.NaN`).

See [column selectors](ColumnSelectors.md) for how to select the columns for this operation.

<!---FUN dropNA-->

```kotlin
Expand Down
2 changes: 2 additions & 0 deletions docs/StardustDocs/topics/explode.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ Splits list-like values in given columns and spreads them vertically. Values in
explode(dropEmpty = true) [ { columns } ]
```

See [column selectors](ColumnSelectors.md) for how to select the columns for this operation.

**Parameters:**
* `dropEmpty` — if `true`, removes rows with empty lists or [`DataFrame`](DataFrame.md) objects. Otherwise, they will be exploded into `null`.

Expand Down
6 changes: 6 additions & 0 deletions docs/StardustDocs/topics/fill.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ Replace missing values.

Replaces `null` values with given value or expression.

See [column selectors](ColumnSelectors.md) for how to select the columns for this operation.

<!---FUN fillNulls-->

```kotlin
Expand All @@ -23,6 +25,8 @@ df.update { colsOf<Int?>() }.where { it == null }.with { -1 }

Replaces [`NaN` values](nanAndNa.md#nan) (`Double.NaN` and `Float.NaN`) with given value or expression.

See [column selectors](ColumnSelectors.md) for how to select the columns for this operation.

<!---FUN fillNaNs-->

```kotlin
Expand All @@ -36,6 +40,8 @@ df.fillNaNs { colsOf<Double>() }.withZero()

Replaces [`NA` values](nanAndNa.md#na) (`null`, `Double.NaN`, and `Float.NaN`) with given value or expression.

See [column selectors](ColumnSelectors.md) for how to select the columns for this operation.

<!---FUN fillNA-->

```kotlin
Expand Down
4 changes: 3 additions & 1 deletion docs/StardustDocs/topics/filter.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ df.filter { "age"<Int>() > 18 && "name"["firstName"]<String>().startsWith("A") }

## filterBy

Returns [`DataFrame`](DataFrame.md) with rows that have value `true` in given column of type `Boolean`.
Returns [`DataFrame`](DataFrame.md) with rows that have value `true` in the given column of type `Boolean`.

See [column selectors](ColumnSelectors.md) for how to select the column for this operation.

<!---FUN filterBy-->
<tabs>
Expand Down
5 changes: 4 additions & 1 deletion docs/StardustDocs/topics/flatten.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ Returns [`DataFrame`](DataFrame.md) without column groupings under selected colu
flatten [ { columns } ]
```

Columns after flattening will keep their original names. Potential column name clashes are resolved by adding minimal possible name prefix from ancestor columns.
Columns will keep their original names after flattening.
Potential column name clashes are resolved by adding minimal possible name prefix from ancestor columns.

See [column selectors](ColumnSelectors.md) for how to select the columns for this operation.

<!---FUN flatten-->
<tabs>
Expand Down
4 changes: 2 additions & 2 deletions docs/StardustDocs/topics/gather.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Converts several columns into two columns `key` and `value`. `key` column will contain names of original columns, `value` column will contain values from original columns.

This operation is reverse to [pivot](pivot.md)
This operation is reverse to [](pivot.md)

```kotlin
gather { columns }
Expand All @@ -21,7 +21,7 @@ keyTransform: (columnName: String) -> K
valueTransform: (value) -> R
```

See [column selectors](ColumnSelectors.md)
See [column selectors](ColumnSelectors.md) for how to select the columns for this operation.

Configuration options:
* `explodeLists` — gathered values of type [`List`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/) will be exploded into their elements, so `where`, `cast`, `notNull` and `mapValues` will be applied to list elements instead of lists themselves
Expand Down
2 changes: 2 additions & 0 deletions docs/StardustDocs/topics/group.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ groupNameExpression = DataColumn.(DataColumn) -> String

It is a special case of [`move`](move.md) operation.

See [column selectors](ColumnSelectors.md) for how to select the columns for this operation.

<!---FUN group-->

```kotlin
Expand Down
3 changes: 2 additions & 1 deletion docs/StardustDocs/topics/groupBy.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ pivot = .pivot { columns }
pivotReducer | pivotAggregator
```

See [column selectors](ColumnSelectors.md), [groupBy transformations](#transformation), [groupBy aggregations](#aggregation), [pivot+groupBy](pivot.md#pivot-groupby)
See [column selectors](ColumnSelectors.md) for how to select the columns for this operation,
[groupBy transformations](#transformation), [groupBy aggregations](#aggregation), and [pivot+groupBy](pivot.md#pivot-groupby).

<!---FUN groupBy-->
<tabs>
Expand Down
2 changes: 2 additions & 0 deletions docs/StardustDocs/topics/implode.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ Returns [`DataFrame`](DataFrame.md) where values in given columns are merged int
implode(dropNA = false) [ { columns } ]
```

See [column selectors](ColumnSelectors.md) for how to select the columns for this operation.

**Parameters:**
* `dropNA` — if `true`, removes `NA` values from merged lists.

Expand Down
4 changes: 3 additions & 1 deletion docs/StardustDocs/topics/inferType.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

<!---IMPORT org.jetbrains.kotlinx.dataframe.samples.api.Modify-->

Changes type of the selected columns based on actual values stored in these columns. Resulting type of the column will be a nearest common supertype of all column values.
Changes the type of the selected columns based on the runtime values stored in these columns.
The resulting type of the column will be the nearest common supertype of all column values.

```text
inferType [ { columns } ]
```
See [column selectors](ColumnSelectors.md) for how to select the columns for this operation.
2 changes: 2 additions & 0 deletions docs/StardustDocs/topics/mean.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ df.pivot { city }.groupBy { name.lastName }.mean()

See [statistics](summaryStatistics.md#groupby-statistics) for details on complex data aggregations.

See [column selectors](ColumnSelectors.md) for how to select the columns for this operation.

### Type Conversion

The following automatic type conversions are performed for the `mean` operation:
Expand Down
2 changes: 2 additions & 0 deletions docs/StardustDocs/topics/median.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ df.pivot { city }.groupBy { name.lastName }.median()

See [statistics](summaryStatistics.md#groupby-statistics) for details on complex data aggregations.

See [column selectors](ColumnSelectors.md) for how to select the columns for this operation.

### Type Conversion

The following automatic type conversions are performed for the `median` operation.
Expand Down
2 changes: 2 additions & 0 deletions docs/StardustDocs/topics/merge.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ merge { columns }
merger: (DataRow).List<T> -> Any
```

See [column selectors](ColumnSelectors.md) for how to select the columns for this operation.

<!---FUN merge-->

```kotlin
Expand Down
2 changes: 2 additions & 0 deletions docs/StardustDocs/topics/minmax.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ df.pivot { city }.groupBy { name.lastName }.min()

See [statistics](summaryStatistics.md#groupby-statistics) for details on complex data aggregations.

See [column selectors](ColumnSelectors.md) for how to select the columns for this operation.

### Type Conversion

The following automatic type conversions are performed for the `min` and `max` operations.
Expand Down
4 changes: 2 additions & 2 deletions docs/StardustDocs/topics/move.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ move { columns }
pathSelector: DataFrame.(DataColumn) -> ColumnPath
```

See [Column Selectors](ColumnSelectors.md)
See [column selectors](ColumnSelectors.md) for how to select the columns for this operation.

Can be used to change columns hierarchy by providing `ColumnPath` for every moved column
Can be used to change column hierarchy by providing `ColumnPath` for every moved column.

<!---FUN move-->

Expand Down
2 changes: 2 additions & 0 deletions docs/StardustDocs/topics/percentile.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ df.pivot { city }.groupBy { name.lastName }.percentile(25.0)

See [statistics](summaryStatistics.md#groupby-statistics) for details on complex data aggregations.

See [column selectors](ColumnSelectors.md) for how to select the columns for this operation.

### Type Conversion

The following automatic type conversions are performed for the `percentile` operation.
Expand Down
13 changes: 8 additions & 5 deletions docs/StardustDocs/topics/pivot.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<!---IMPORT org.jetbrains.kotlinx.dataframe.samples.api.Analyze-->

Splits the rows of [`DataFrame`](DataFrame.md) and groups them horizontally into new columns based on values from one or several columns of original [`DataFrame`](DataFrame.md).
Splits the rows of a [`DataFrame`](DataFrame.md) and groups them horizontally into new columns based on values from one or several columns of the original [`DataFrame`](DataFrame.md).

```text
pivot (inward = true) { pivotColumns }
Expand All @@ -16,8 +16,10 @@ reducer = .minBy { column } | .maxBy { column } | .first [ { rowCondition } ] |
aggregator = .count() | .matches() | .frames() | .with { rowExpression } | .values { valueColumns } | .aggregate { aggregations } | .<stat> [ { columns } ]
```

See [column selectors](ColumnSelectors.md) for how to select the columns for this operation.

**Parameters:**
* `inward` — if `true` generated columns will be nested inside original column, otherwise they will be top-level
* `inward` — if `true` generated columns are nested inside the original column, otherwise they will be top-level
* `pivotColumns` — columns with values for horizontal data grouping and generation of new columns
* `indexColumns` — columns with values for vertical data grouping
* `defaultValue` — value to fill mismatched pivot-index column pairs
Expand All @@ -42,7 +44,7 @@ df.pivot("city")
<inline-frame src="resources/org.jetbrains.kotlinx.dataframe.samples.api.Analyze.pivot.html" width="100%"/>
<!---END-->

To pivot several columns at once you can combine them using `and` or `then` infix function:
To pivot several columns at once, you can combine them using `and` or `then` infix function:
* `and` will pivot columns independently
* `then` will create column hierarchy from combinations of values from pivoted columns

Expand All @@ -69,7 +71,8 @@ df.pivot { "city" then "name"["firstName"] }

## pivot + groupBy

To create matrix table that is expanded both horizontally and vertically, apply [`groupBy`](groupBy.md) transformation passing the columns for vertical grouping.
To create a matrix table that is expanded both horizontally and vertically,
apply [`groupBy`](groupBy.md) transformation passing the columns for vertical grouping.
Reversed order of `pivot` and [`groupBy`](groupBy.md) will produce the same result.

<!---FUN pivotGroupBy-->
Expand Down Expand Up @@ -264,7 +267,7 @@ df.pivot("city").groupBy("name").aggregate {
### Pivot inside aggregate

pivot transformation can be used inside [`aggregate`](groupBy.md#aggregation) function of [`groupBy`](groupBy.md).
This allows to combine column pivoting with other [`groupBy`](groupBy.md) aggregations:
This allows combining column pivoting with other [`groupBy`](groupBy.md) aggregations:

<!---FUN pivotInAggregate-->
<tabs>
Expand Down
2 changes: 1 addition & 1 deletion docs/StardustDocs/topics/remove.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Returns [`DataFrame`](DataFrame.md) without selected columns.
remove { columns }
```

See [Column Selectors](ColumnSelectors.md)
See [column selectors](ColumnSelectors.md) for how to select the columns for this operation.

<!---FUN remove-->
<tabs>
Expand Down
2 changes: 2 additions & 0 deletions docs/StardustDocs/topics/rename.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ df.rename { columns }.into { nameExpression }
nameExpression = (DataColumn) -> String
```

See [column selectors](ColumnSelectors.md) for how to select the columns for this operation.

<!---FUN rename-->
<tabs>
<tab title="Properties">
Expand Down
2 changes: 2 additions & 0 deletions docs/StardustDocs/topics/reorder.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ reorder { columns }
columnExpression: DataColumn.(DataColumn) -> Value
```

See [column selectors](ColumnSelectors.md) for how to select the columns for this operation.

<!---FUN reorder-->
<tabs>
<tab title="Properties">
Expand Down
2 changes: 1 addition & 1 deletion docs/StardustDocs/topics/replace.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ replace { columns }
columnExpression: DataFrame.(DataColumn) -> DataColumn
```

See [column selectors](ColumnSelectors.md)
See [column selectors](ColumnSelectors.md) for how to select the columns for this operation.

<!---FUN replace-->

Expand Down
3 changes: 0 additions & 3 deletions docs/StardustDocs/topics/reshape.md

This file was deleted.

4 changes: 4 additions & 0 deletions docs/StardustDocs/topics/sortBy.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ By default, columns are sorted in ascending order with `null` values going first
* `.desc` — changes column sort order from ascending to descending
* `.nullsLast` — forces `null` values to be placed at the end of the order

See [column selectors](ColumnSelectors.md) for how to select the columns for this operation.

<!---FUN sortBy-->
<tabs>
<tab title="Properties">
Expand Down Expand Up @@ -35,6 +37,8 @@ df.sortBy { "weight".nullsLast() }

Returns [`DataFrame`](DataFrame.md) sorted by one or several columns in descending order.

See [column selectors](ColumnSelectors.md) for how to select the columns for this operation.

<!---FUN sortByDesc-->
<tabs>
<tab title="Properties">
Expand Down
12 changes: 7 additions & 5 deletions docs/StardustDocs/topics/split.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<!---IMPORT org.jetbrains.kotlinx.dataframe.samples.api.Modify-->

This operation splits every value in the given columns into several values,
This operation splits every value in the given columns into several values
and optionally spreads them horizontally or vertically.

```text
Expand All @@ -15,10 +15,12 @@ df.split { columns }
splitter = DataRow.(T) -> Iterable<Any>
columnNamesGenerator = DataColumn.(columnIndex: Int) -> String
```
The following types of columns can be split without any _splitter_ configuration:
* `String`: split by `,` and trim
* `List`: split into elements
* [`DataFrame`](DataFrame.md): split into rows
The following types of columns can be split easily:
* `String`: for instance, by `","`
* `List`: splits into elements, no `by` required!
* [`DataFrame`](DataFrame.md): splits into rows, no `by` required!

See [column selectors](ColumnSelectors.md) for how to select the columns for this operation.

## Split in place

Expand Down
Loading
Loading