Skip to content
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

Column Selection DSL improvements #318

Merged
merged 9 commits into from
Apr 6, 2023

Conversation

Jolanrensen
Copy link
Collaborator

Based on #317
I went over the Column Selection DSL and added support for KProperties everywhere.
Additionally, I saw there were some missing APIs for Strings as well, like
select { "myGroup".allAfter("someCol") }, select { "myCol".groups { true } } etc.

Finally, I renamed allUntil to allUpTo, as "until" means excluding the last one, while "up to" does not. And I renamed allSince to allFrom.

Docs are updated too.

@Jolanrensen Jolanrensen added the enhancement New feature or request label Mar 22, 2023
@Jolanrensen Jolanrensen added this to the 0.10.0 milestone Mar 22, 2023
@Jolanrensen Jolanrensen self-assigned this Mar 22, 2023
@Jolanrensen Jolanrensen linked an issue Mar 22, 2023 that may be closed by this pull request
df.select { Person::name and Person::age }

// range of columns
df.select { Person::name..Person::age }
Copy link
Collaborator

Choose a reason for hiding this comment

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

Very strange API:)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

not weirder than "name".."age" imo

Copy link
Collaborator

Choose a reason for hiding this comment

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

Of course not, I mean totally the range of columns based on name, I could imagine ranging the ordered things or alphabetically, but not the range of column names in the structure, is this order guaranteed by compiler or somehow?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Nope, that's impossible afaik. However, it's still very useful to select multiple columns quickly. But, as with all non-typesafe operations (resulting in Any? types), it works best in Jupyter or with the upcoming plugin, which generate accessors on the fly.

# Conflicts:
#	core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/ColumnsSelectionDsl.kt
#	core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/ColumnsSelectionDsl.kt
# Conflicts:
#	core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/ColumnsSelectionDsl.kt
#	core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/ColumnsSelectionDsl.kt
@Jolanrensen
Copy link
Collaborator Author

If we don't merge this PR, it will be joint with #331, since that builds on top of this PR adding docs and other missing functions

@Jolanrensen Jolanrensen merged commit 0719288 into master Apr 6, 2023
@Jolanrensen Jolanrensen deleted the kproperties-columnsSelectionDsl branch April 6, 2023 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ColumnSelectionDsl does not support KProperties API
2 participants