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

PanicException in Polars 1.18 on mode() with string-dtype #20513

Closed
2 tasks done
thomas-privat opened this issue Dec 31, 2024 · 1 comment
Closed
2 tasks done

PanicException in Polars 1.18 on mode() with string-dtype #20513

thomas-privat opened this issue Dec 31, 2024 · 1 comment
Labels
bug Something isn't working needs triage Awaiting prioritization by a maintainer python Related to Python Polars

Comments

@thomas-privat
Copy link

Checks

  • I have checked that this issue has not already been reported.
  • I have confirmed this bug exists on the latest version of Polars.

Reproducible example

s = polars.Series("a", ["x", "y"])
s.mode()

Log output

thread '<unnamed>' panicked at crates\polars-core\src\series\mod.rs:533:18:
invalid from_physical(String) for Binary
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Traceback (most recent call last):
  File "<stdin>", line 3, in <module>
  File "D:\****\.venv\Lib\site-packages\polars\series\utils.py", line 106, in wrapper
    return s.to_frame().select_seq(f(*args, **kwargs)).to_series()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\*****\.venv\Lib\site-packages\polars\dataframe\frame.py", line 9347, in select_seq
    return self.lazy().select_seq(*exprs, **named_exprs).collect(_eager=True)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\****.venv\Lib\site-packages\polars\lazyframe\frame.py", line 2043, in collect
    return wrap_df(ldf.collect(callback))
                   ^^^^^^^^^^^^^^^^^^^^^
pyo3_runtime.PanicException: invalid from_physical(String) for Binary

Issue description

no exeption is produced, with numeric data e.g. polars.Series("a", [1, 2]), nor with polars version 1.17

Expected behavior

no panic exception

Installed versions

--------Version info---------
Polars:              1.18.0
Index type:          UInt32
Platform:            Windows-2019Server-10.0.17763-SP0
Python:              3.12.6 (tags/v3.12.6:a4a2d2b, Sep  6 2024, 20:11:23) [MSC v.1940 64 bit (AMD64)]
LTS CPU:             False

----Optional dependencies----
adbc_driver_manager  <not installed>
altair               <not installed>
azure.identity       <not installed>
boto3                <not installed>
cloudpickle          <not installed>
connectorx           <not installed>
deltalake            <not installed>
fastexcel            <not installed>
fsspec               <not installed>
gevent               <not installed>
google.auth          <not installed>
great_tables         <not installed>
matplotlib           3.9.2
nest_asyncio         <not installed>
numpy                2.1.3
openpyxl             <not installed>
pandas               2.2.3
pyarrow              18.1.0
pydantic             <not installed>
pyiceberg            <not installed>
sqlalchemy           <not installed>
torch                <not installed>
xlsx2csv             <not installed>
xlsxwriter           3.2.0
@thomas-privat thomas-privat added bug Something isn't working needs triage Awaiting prioritization by a maintainer python Related to Python Polars labels Dec 31, 2024
@cmdlineluser
Copy link
Contributor

This is fixed on main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage Awaiting prioritization by a maintainer python Related to Python Polars
Projects
None yet
Development

No branches or pull requests

2 participants