Giter VIP home page Giter VIP logo

Comments (5)

ritchie46 avatar ritchie46 commented on July 29, 2024

I don't understand this issue? Can you explain more elaborately?

from polars.

cmdlineluser avatar cmdlineluser commented on July 29, 2024

It seems the issue is that Polars will "iterate" a dict, so you get just the .keys()

So the the examples effectively become:

pl.DataFrame({"a": 1}).with_columns(["a"])

pl.DataFrame({"a": 1}).with_columns(["not_exist"])
# ColumnNotFoundError: not_exist

from polars.

gab23r avatar gab23r commented on July 29, 2024

The issue is the behavior of with_columns if you give a dictionary as input .
As @cmdlineluser explain, it only reads the keys of the dictionary and ignore the values. It is not really intuitive and error prone. I do not really see the purpose of the behavior. I would prefer that a dict is not a valid input of with_columns.

from polars.

mcrumiller avatar mcrumiller commented on July 29, 2024

This is just a side-effect of a dictionary being an Iterable, I don't believe using a dictionary is intended.

>>> list({1: 2, 3: 4})
[1, 3]

from polars.

mcrumiller avatar mcrumiller commented on July 29, 2024

I think we can just fix this by requiring a Sequence instead of an Iterable, no?

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.