Comments (4)
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.
@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.
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.
@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)
- Pin is undefined inside of a cond...do block
- Update Polars to v0.36 HOT 22
- Support `Series.from_list([1, 2, 3], dtype: :null)` HOT 14
- Expose the Polars SQL API? HOT 8
- Support `Series.map/2` with lists HOT 6
- pivot_wider generated names not consistent HOT 11
- v0.8.0 summarise/count bug? HOT 8
- Invalid Struct contents with `{:list, {:struct, %{...}}` HOT 7
- NIF Panic with duplicated key in rename HOT 2
- Creating Lists / Records in `mutate` HOT 5
- Allow nils when creating a struct series
- Nested lists of lists can panic HOT 14
- `Nx.stack(..., axis: 1)` on a large dataframe can OOM HOT 10
- Add Series.drop_nil HOT 8
- Support single `on` option in `Dataframe.join` HOT 1
- [Feature request] Add support for Decimal type HOT 12
- Should we always raise when a column is missing? HOT 3
- Seeing `:nif_not_loaded` error for `Series.split/2` when mutating a dataframe HOT 1
- [Feature request] Add support for read_database in Polars backend. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from explorer.