r-polars icon indicating copy to clipboard operation
r-polars copied to clipboard

`pl$Struct()` must have named elements

Open etiennebacher opened this issue 10 months ago • 0 comments

> pl$Struct(x = pl$Float32)
DataType: Struct(
    [
        Field {
            name: "x",
            dtype: Float32,
        },
    ],
)
> pl$Struct(pl$Float32)
DataType: Struct(
    [
        Field {
            name: "",
            dtype: Float32,
        },
    ],
)
>>> pl.Struct({"x": pl.Float32})
Struct({'x': Float32})

>>> pl.Struct(pl.Float32)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python311\Lib\site-packages\polars\datatypes\classes.py", line 837, in __init__
    self.fields = list(fields)
                  ^^^^^^^^^^^^
TypeError: 'DataTypeClass' object is not iterable

etiennebacher avatar Apr 02 '24 11:04 etiennebacher