Skip to content

Commit b76dacb

Browse files
add shortcut
1 parent 1b47bfd commit b76dacb

File tree

1 file changed

+24
-2
lines changed
  • core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api

1 file changed

+24
-2
lines changed

core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/move.kt

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ public fun <T, C> MoveClause<T, C>.to(columnIndex: Int): DataFrame<T> = moveTo(c
541541
/**
542542
* Moves columns, previously selected with [move] to a new position specified
543543
* by [columnIndex]. If [insideGroup] is true, selected columns will be moved remaining within their [ColumnGroup],
544-
* else they will be moved on top level.
544+
* else they will be moved to the top level.
545545
*
546546
* Returns a new [DataFrame] with updated columns structure.
547547
*
@@ -720,7 +720,7 @@ public fun <T, C> MoveClause<T, C>.toStart(): DataFrame<T> = to(0)
720720

721721
/**
722722
* If insideGroup is true, moves columns previously selected with [move] to the start of their [ColumnGroup].
723-
* Else, selected columns will be moved to the start of their [DataFrame] (on top-level).
723+
* Else, selected columns will be moved to the start of their [DataFrame] (to the top-level).
724724
*
725725
* Returns a new [DataFrame] with updated columns.
726726
*
@@ -761,6 +761,28 @@ public fun <T, C> MoveClause<T, C>.toRight(): DataFrame<T> = to(df.ncol)
761761
@Interpretable("MoveToEnd0")
762762
public fun <T, C> MoveClause<T, C>.toEnd(): DataFrame<T> = to(df.ncol)
763763

764+
/**
765+
* If insideGroup is true, moves columns previously selected with [move] to the end of their [ColumnGroup].
766+
* Else, selected columns will be moved to the end of their [DataFrame] (to the top-level).
767+
*
768+
* Returns a new [DataFrame] with updated columns.
769+
*
770+
* For more information: {@include [DocumentationUrls.Move]}
771+
*
772+
* ### Examples:
773+
* ```kotlin
774+
* df.move { age and weight }.toEnd(true)
775+
* df.move { colsOf<String>() }.toEnd(true)
776+
* df.move("age", "weight").toEnd(false)
777+
* ```
778+
*
779+
* @param [insideGroup] If true, selected columns will be moved to the end remaining inside their group,
780+
* else they will be moved to the end on top level.
781+
*/
782+
@Refine
783+
@Interpretable("MoveToEnd0")
784+
public fun <T, C> MoveClause<T, C>.toEnd(insideGroup: Boolean): DataFrame<T> = to(df.ncol, insideGroup)
785+
764786
/**
765787
* An intermediate class used in the [move] operation.
766788
*

0 commit comments

Comments
 (0)