Kotlin / Kotlin/dataframe

Split by operation on "normal classes" could be clearer

Open
#488 1 comment 0 reactions 1 assignee Claimed by @Jolanrensen View on GitHub
API enhancement
Dominant language
Kotlin
Stars
1.1k
Forks
83
Avg merge
4d 12h
Merged PRs (30d)
30

Description

I was working with a `LocalDateTime` which I wanted to split up into a `LocalDate` and a `LocalTime` column. I found the `split` operation, but it wasn't immediately obvious how to work with this. For splitting a column up based on String delimiters, something like
```kotlin
df.split { stringCol }.by { it.split(",") }.into("first", "second")
```
is clear and works well. However, when trying to split up a `LocalDateTime`:
```kotlin
df.split { localDateTimeCol }.by { listOf(it.date, it.time) }.into("date", "time")
```
does not seem obvious.

Something like
```kotlin
df.split { localDateTimeCol }.by { it.date and it.time }.into("date", "time")
```
would improve it a bit, and

```kotlin
df.split { localDateTimeCol }.by {
it.date into "date"
it.time into "time"
}
```
even more.

(Btw, since `Split` is a `public data class`, you're able to call `df.split { myCol }.copy { }` which looks like it should be prohibited)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.