-
Notifications
You must be signed in to change notification settings - Fork 63
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
Conversation
df.select { Person::name and Person::age } | ||
|
||
// range of columns | ||
df.select { Person::name..Person::age } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very strange API:)
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
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 |
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
toallUpTo
, as "until" means excluding the last one, while "up to" does not. And I renamedallSince
toallFrom
.Docs are updated too.