Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug(memtable): can't load polars Enum #10015

Closed
gforsyth opened this issue Sep 4, 2024 Discussed in #9983 · 0 comments · Fixed by #10017
Closed

bug(memtable): can't load polars Enum #10015

gforsyth opened this issue Sep 4, 2024 Discussed in #9983 · 0 comments · Fixed by #10017
Assignees
Labels
bug Incorrect behavior inside of ibis

Comments

@gforsyth
Copy link
Member

gforsyth commented Sep 4, 2024

Discussed in #9983

Originally posted by bzm3r August 31, 2024
I am using "ibis-framework[duckdb,polars]=9.3.0". I create a polars dataframe:

import polars as pl

xs = ["a", "b", "c"]
xs = pl.Series("x", xs, dtype=pl.Enum(xs))
df = pl.DataFrame(xs)
print(df)

Which produces:

shape: (3, 1)
┌──────┐
│ x    │
│ ---  │
│ enum │
╞══════╡
│ a    │
│ b    │
│ c    │
└──────┘

Then, I load this using Ibis:

import ibis

ibis.options.interactive = True
t = ibis.memtable(df, name="t")
print(t)

Which produces:

File ~/.venv/lib/python3.12/site-packages/ibis/expr/api.py:557, in _memtable_from_polars_dataframe(data, name, schema, columns)
    553     assert schema is None, "if `columns` is not `None` then `schema` must be `None`"
    554     schema = sch.Schema(dict(zip(columns, sch.infer(data).values())))
...
     75     )
     76 else:
---> 77     return _from_polars_types[base_type](nullable=nullable)

KeyError: Enum
@gforsyth gforsyth added the bug Incorrect behavior inside of ibis label Sep 4, 2024
@gforsyth gforsyth changed the title bug(polars): can't load polars Enum bug(memtable): can't load polars Enum Sep 4, 2024
@jcrist jcrist self-assigned this Sep 4, 2024
@github-project-automation github-project-automation bot moved this from backlog to done in Ibis planning and roadmap Sep 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Incorrect behavior inside of ibis
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants