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

Datasets manipulations (tranformations/change) API. #430

Open
AndreiKingsley opened this issue Sep 2, 2024 · 2 comments
Open

Datasets manipulations (tranformations/change) API. #430

AndreiKingsley opened this issue Sep 2, 2024 · 2 comments
Assignees
Labels
api Common API for plotting dataframe An issue/PR related to dataframe enhancement New feature or request lets-plot API and implementation for lets-plot statistics An issue/PR related to statisctical

Comments

@AndreiKingsley
Copy link
Collaborator

Problem №1

We have a lot of data transformations methods inside the plot builder that modify dataset (such as groupBy(){ },statBin(){ }):

plot {
   line { ... }
   groupBy(..) { 
      line { ... }
   }
   statBin(..) {
      line { ... }
   }
}

There will also be others in the future (for example sortBy() { }).

The problem is that they are not isolated in any way, they “break” the context of plot builder, being on the same level as creating layers.

Problem №2

We have no API for dataset changing. Sometimes, we want to use different datasets for different layers:

dataset1.plot {
   line { 
       x("column_of_dataset_1")
    }
   `function that change dataset`(dataset2) {
       line {
          x("column_of_dataset_2")
       }
    }
}

Possible solution

Both of these problems are related to the design of the dataset manipulation inside plot builder. A possible solution is to put all such manipulations under one object inside the plot builder. It could go something like this:

df.plot {
    line {}
    Data.use(otherDF) {
        line {}
    }
    Data.groupBy() {
        line {}
    }
    Data.statBin() {
        line {}
    }
    
    Data.groupBy() {
        Data.statBin() {
            bars {}
        }
    }
    
}
@AndreiKingsley AndreiKingsley added enhancement New feature or request api Common API for plotting lets-plot API and implementation for lets-plot dataframe An issue/PR related to dataframe statistics An issue/PR related to statisctical labels Sep 2, 2024
@zaleslaw zaleslaw self-assigned this Sep 3, 2024
@zaleslaw
Copy link

zaleslaw commented Sep 3, 2024

For me it's a first time when I see an object as a namespace in KotlinDSL? Did you see any examples in Kotlin ecosystem in that approach?

@AndreiKingsley
Copy link
Collaborator Author

It's not really an object, it's a property. In fact it's just like enum.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Common API for plotting dataframe An issue/PR related to dataframe enhancement New feature or request lets-plot API and implementation for lets-plot statistics An issue/PR related to statisctical
Projects
None yet
Development

No branches or pull requests

2 participants