Giter VIP home page Giter VIP logo

Comments (5)

alexander-beedie avatar alexander-beedie commented on June 17, 2024

@stinodego: linked to the constructor refactor?

from polars.

stinodego avatar stinodego commented on June 17, 2024

Probably. I'm not sure this ever used to work though. The problem seems to be in arrlen where it infers length 2 for the struct 'scalar'.

from polars.

alexander-beedie avatar alexander-beedie commented on June 17, 2024

Probably. I'm not sure this ever used to work though. The problem seems to be in arrlen where it infers length 2 for the struct 'scalar'.

@stinodego: Ahh, I think you're right - I assumed this was a regression, but installing some earlier versions of Polars to check further makes me think it is not ;)

@linusheinz: Did this ever work for you in a different version of Polars?
(And, if so, which version?)

from polars.

linusheinz avatar linusheinz commented on June 17, 2024

I just checked back to 20.9, and it did not work. It seems to be present in many versions.

from polars.

alexander-beedie avatar alexander-beedie commented on June 17, 2024

I just checked back to 20.9, and it did not work. It seems to be present in many versions.

Note that the easiest way to address this is to provide sequence data in the dict, which is the expected form (as each value in the dict represents a column).

pl.DataFrame({"test": [0], "nest": [{"test": 0, "test2": 0}]})
# shape: (1, 2)
# ┌─────┬───────────┐
# │ x   ┆ nest      │
# │ --- ┆ ---       │
# │ i64 ┆ struct[2] │
# ╞═════╪═══════════╡
# │ 0   ┆ {0,0}     │
# └─────┴───────────┘

Passing non-sequence data here is a little hit and miss, as we typically expand it in a fast-path for quick generation of large frames with repetitive data, like so:

pl.DataFrame({"n": range(1000), "y": -1})
# shape: (1_000, 2)
# ┌─────┬─────┐
# │ n   ┆ y   │
# │ --- ┆ --- │
# │ i64 ┆ i32 │
# ╞═════╪═════╡
# │ 0   ┆ -1  │
# │ 1   ┆ -1  │
# │ …   ┆ …   │
# │ 998 ┆ -1  │
# │ 999 ┆ -1  │
# └─────┴─────┘

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.