Skip to content

Conversation

CarloMariaProietti
Copy link
Contributor

About #1255
It comes with docs and a test case

@CarloMariaProietti CarloMariaProietti changed the title Move to(Start) by keeping inside group Move to(Start) keeping inside group Oct 11, 2025
@CarloMariaProietti CarloMariaProietti marked this pull request as draft October 11, 2025 12:57
@CarloMariaProietti CarloMariaProietti marked this pull request as ready for review October 12, 2025 08:11
@Jolanrensen Jolanrensen self-requested a review October 13, 2025 11:46

/**
* Moves columns, previously selected with [move] to a new position specified
* by [columnIndex] within the column group (remaining inside the group).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*if insideGroup == true that is

* ### Examples:
* ```kotlin
* df.move { age and weight }.to(0)
* df.move("age", "weight").to(2)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about an example with insideGroup = true?

* ```
*
* @param [columnIndex] The index specifying the position in the [ColumnGroup] columns
* * where the selected columns will be moved.
Copy link
Collaborator

@Jolanrensen Jolanrensen Oct 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

floating "*"

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no information about @param insideGroup

public fun <T, C> MoveClause<T, C>.toStart(): DataFrame<T> = to(0)

/**
* Moves columns, previously selected with [move] to the start of their [ColumnGroup] (remaining inside the group).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only if insideGroup = true

}
}

// move columns
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably easier to view the logic using a when

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and lift return out of the when-statement

* where the selected columns will be moved.
*
* @param [insideGroup] If true, selected columns will be moved remaining inside their group,
* else they will be moved on top level.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*to the top level


/**
* Moves columns, previously selected with [move] to a new position specified
* by [columnIndex]. If insideGroup is true, selected columns will be moved remaining within their [ColumnGroup],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"insideGroup" can have "[]"

@Jolanrensen
Copy link
Collaborator

Oh, I see we also have these shortcut functions:

  • public fun <T> DataFrame<T>.moveTo(newColumnIndex: Int, columns: ColumnsSelector<T, *>)
  • public fun <T> DataFrame<T>.moveTo(newColumnIndex: Int, vararg columns: String): DataFrame<T>
  • moveToStart(), moveToEnd()

Could you do the same there as with .to()? :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants