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

Allow custom Parsers to be defined for DataFrame.parser: GlobalParserOptions #962

Open
Jolanrensen opened this issue Nov 21, 2024 · 1 comment
Labels
enhancement New feature or request
Milestone

Comments

@Jolanrensen
Copy link
Collaborator

Allowing users to set custom parsers would be very helpful. It could allow them things like:

class User(val name: String, val age: Int) {
    override fun toString() = "user-$name-$age"
}

DataFrame.parser.addCustomParser<User> {
    if (it.startsWith("user")) {
        val (_, name, age) = it.split("-")
        User(name, age)
    } else null
}

DataFrame.readCsv(myCustomUserData)

or we could even add an enum-specific variant. This can only be done with convert at the moment. It could allow immediate parsing of CSV -> enum for instance.

@Jolanrensen Jolanrensen added the enhancement New feature or request label Nov 21, 2024
@Jolanrensen Jolanrensen added this to the 0.16.0 milestone Nov 21, 2024
@Jolanrensen
Copy link
Collaborator Author

Additionally we should keep supporting the same arguments in ParserOptions to also allow the DF API to remain functional

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

1 participant