Skip to content

Add a way to create hierarchical dataframes without variables #353

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

Closed
koperagen opened this issue Apr 12, 2023 · 5 comments
Closed

Add a way to create hierarchical dataframes without variables #353

koperagen opened this issue Apr 12, 2023 · 5 comments
Assignees
Labels
enhancement New feature or request

Comments

@koperagen
Copy link
Collaborator

So this is supported

// DataFrame with 2 columns and 3 rows
val df = dataFrameOf(
    "name" to listOf("Alice", "Bob", "Charlie"),
    "age" to listOf(15, 20, 100)
)

But if you want to create columnGroup, you'll have to completely rewrite your code:

val name by columnOf(...) or val name = listOf().toColumn()
val age = ...
val group by columnOf(name, age)
val df = dataFrameof(group)
@Jolanrensen Jolanrensen added the enhancement New feature or request label Apr 13, 2023
@zaleslaw zaleslaw added this to the Backlog milestone Apr 25, 2023
@zaleslaw
Copy link
Collaborator

We add you @AndreiKingsley to be a watcher here, not the implementer

@koperagen
Copy link
Collaborator Author

I have two options in mind

dataFrameOf {
  "name" from listOf("Alice", "Bob", "Charlie")
  "age" from listOf(15, 20, 100)
  "group" { 
     "name" from listOf("Alice", "Bob", "Charlie")
      "age" from listOf(15, 20, 100)
  }
}

Or

val df = dataFrameOf(
    "name" to listOf("Alice", "Bob", "Charlie"),
    "age" to listOf(15, 20, 100),
    "group" to columnGroupOf(
          "name" to listOf("Alice", "Bob", "Charlie"),
          "age" to listOf(15, 20, 100),
    )
)

But biggest disadvantage, columnGroupOf must return List (which contradicts its name). I like second option more because it's simple.

@AndreiKingsley
Copy link
Collaborator

@koperagen what's problem with

val df = dataFrameOf(
    "name" to columnOf("Alice", "Bob", "Charlie"),
    "age" to columnOf(15, 20, 100),
    "group" to columnGroupOf(
          "name" to listOf("Alice", "Bob", "Charlie"),
          "age" to listOf(15, 20, 100),
    )
)

@koperagen
Copy link
Collaborator Author

@koperagen what's problem with

val df = dataFrameOf(
    "name" to columnOf("Alice", "Bob", "Charlie"),
    "age" to columnOf(15, 20, 100),
    "group" to columnGroupOf(
          "name" to listOf("Alice", "Bob", "Charlie"),
          "age" to listOf(15, 20, 100),
    )
)

Nice idea

@koperagen koperagen self-assigned this Feb 24, 2025
@koperagen
Copy link
Collaborator Author

more consistent api:

val df = dataFrameOf(
    "name" to columnOf("Alice", "Bob", "Charlie"),
    "age" to columnOf(15, 20, 100),
    "group" to columnGroupOf(
          "name" to columnOf("Alice", "Bob", "Charlie"),
          "age" to columnOf(15, 20, 100),
    )
)

@koperagen
Copy link
Collaborator Author

fixed in #1144

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

No branches or pull requests

4 participants