Giter Site home page Giter Site logo

Comments (2)

cjackal avatar cjackal commented on July 20, 2024

IIRC this kind of locale-aware collate is pretty nontrivial and not many programming language (including rust, the engine of polars) support it battery-included. My best shot so far:

import locale
locale.setlocale(locale.LC_ALL, "en_GB.utf8")

import polars as pl
df = pl.DataFrame({"x": ["a", "b", "A", "B"]})
df.with_columns(pl.col("x").map_elements(locale.strxfrm, return_dtype=pl.Utf8()).alias("x_cmp")).sort("x_cmp")
# shape: (4, 2)
# ┌─────┬───────┐
# │ x   ┆ x_cmp │
# │ --- ┆ ---   │
# │ str ┆ str   │
# ╞═════╪═══════╡
# │ a   ┆ š悝   │
# │ A   ┆ š晙   │
# │ b   ┆ Ů惹   │
# │ B   ┆ Ů暙   │
# └─────┴───────┘

from polars.

stinodego avatar stinodego commented on July 20, 2024

It's a fair request, but I'm going to say this is out of scope for now.

If someone can come up with a good API design for this, and show an elegant/efficient implementation, I'd be happy to take a look. But we will not be working on this ourselves.

from polars.

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.