Giter VIP home page Giter VIP logo

Comments (4)

eitsupi avatar eitsupi commented on June 23, 2024 1

Thank you for the explanation. I think that explanation makes sense.

from polars.

mcrumiller avatar mcrumiller commented on June 23, 2024

There is only one key. The key may be a tuple (i.e. a collection of columns), but a collection is still a singular item.

from polars.

eitsupi avatar eitsupi commented on June 23, 2024

There is only one key.

However, elsewhere it is written in the plurals as keys.

as_dict
Return a dictionary instead of a list. The dictionary keys are tuples of
the distinct group values that identify each group. If a single string
was passed to `by`, the keys are a single value instead of a tuple.

from polars.

mcrumiller avatar mcrumiller commented on June 23, 2024

This is a difference in usage. Imagine that the "key" to entering a secret club is a passcode, and each week that passcode changes. There is one key--the passcode--but the collection of passcodes form multiple key values, which one might refer to as "the keys."

In other words, there are two usages of the word "key" here: one is the key definition, the other is the key values. For the partition_by parameter, it makes sense to say "include the key associated with each element," because each element has only one key. It would also make sense to say "include the keys associated with the various values".

The second usage (the key values) would require us to determine how many unique keys there are. For example, the following dictionaries both have one key value

{
    "key1": "a",
}
{
    ("key1a", "key1b"): "a",
}

whereas the following has multiple keys:

{
    "key1": "a",
    "key2": "b",
}

Would you expect in the second case to use include_keys but include_key in the first case? It's more consistent and universally applicable to use the singular.

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.