GithubHelp home page GithubHelp logo

Comments (4)

billylanchantin avatar billylanchantin commented on July 18, 2024

Hi @ryancurtin,

I would be ok supporting a version of the Polars approach:

(
    df["s"]
    .str.splitn(" ", 2)
    .struct.rename_fields(["first_part", "second_part"])
    .alias("fields")
    .to_frame()
    .unnest("fields")
)

A PR for splitn would be welcome :) Heads up: I think our lack of struct support may make that difficult.

As for other approaches, nothing comes to mind that would be vastly superior. Though that may just be my lack of imagination.

from explorer.

josevalim avatar josevalim commented on July 18, 2024

@billylanchantin we do support structs :D maybe the API we need here is something like: split_into(string, " ", [:first_name, :last_name]). And that returns a struct we can unnest later?

from explorer.

billylanchantin avatar billylanchantin commented on July 18, 2024

we do support structs :D

Sorry, I should've said "limited" support! I don't think we have rename_fields.

maybe the API we need here is something like: split_into(string, " ", [:first_name, :last_name]). And that returns a struct we can unnest later?

That's a good thought. Take their splitn and add the fields as an argument. Frankly, it seems odd that splitn forces you to name the fields afterward.

from explorer.

ryancurtin avatar ryancurtin commented on July 18, 2024

@josevalim @billylanchantin Thanks a lot for your guidance. I will take a crack at implementing split_into this weekend and see what I come up with!

from explorer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.