I can't get the code below to work.how should i solve it?
import polars as pl
from natsort import index_natsorted, natsorted
data = pl.DataFrame([["a1","a10","a2"], [4,5,6]],)
data.slice(index_natsorted(data[["column_0"]]))
I can't get the code below to work.how should i solve it?
import polars as pl
from natsort import index_natsorted, natsorted
data = pl.DataFrame([["a1","a10","a2"], [4,5,6]],)
data.slice(index_natsorted(data[["column_0"]]))
Copyright © 2021 Jogjafile Inc.
It looks like the basic form of https://pypi.org/project/natsort/ is equivalent to something along the lines of:
Example usage:
What's happening is you split up the sequences of digits/non-digits:
And replace the "stringified" numbers with the integer values:
Which you can then
.sort()by.