Skip to content
New issue

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

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

Already on GitHub? # to your account

PanicException raised on converting result to string #17368

Closed
2 tasks done
akshayka opened this issue Jul 2, 2024 · 1 comment
Closed
2 tasks done

PanicException raised on converting result to string #17368

akshayka opened this issue Jul 2, 2024 · 1 comment
Labels
bug Something isn't working needs triage Awaiting prioritization by a maintainer python Related to Python Polars

Comments

@akshayka
Copy link

akshayka commented Jul 2, 2024

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

import polars as pl
import numpy as np
d = pl.DataFrame({"a": [np.arange(5) + i for i in range(5)]})
res = d.select(
    pl.col("a").map_batches(
        lambda x: {"filt_value": np.dot(x, x), "filt_phase": 5.0},
        is_elementwise=True),
    )
str(res)

Log output

thread '<unnamed>' panicked at crates/polars-core/src/chunked_array/ops/any_value.rs:124:75:
called `Option::unwrap()` on a `None` value
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
---------------------------------------------------------------------------
PanicException                            Traceback (most recent call last)
/var/folders/gr/c2cb32s92zgc9vnhprvhj3nw0000gn/T/ipykernel_20751/1691347277.py in ?()
---> 12 import polars as pl
     13 import numpy as np
     14 
     15 df = pl.DataFrame({"a": [np.arange(5) + i for i in range(5)]})

~/envs/playground/lib/python3.9/site-packages/polars/dataframe/frame.py in ?(self)
   1130     def __str__(self) -> str:
-> 1131         return self._df.as_str()

PanicException: called `Option::unwrap()` on a `None` value

Issue description

Reported by a marimo user: marimo-team/marimo#1711

We (marimo) can hack around this. But thought you should know.

Expected behavior

Don't panic.

Installed versions

--------Version info---------
Polars:               1.0.0
Index type:           UInt32
Platform:             macOS-13.4.1-arm64-arm-64bit
Python:               3.9.19 (main, Mar 19 2024, 16:08:27) 
[Clang 15.0.0 (clang-1500.1.0.2.5)]

----Optional dependencies----
adbc_driver_manager:  <not installed>
cloudpickle:          <not installed>
connectorx:           <not installed>
deltalake:            <not installed>
fastexcel:            <not installed>
fsspec:               2024.2.0
gevent:               <not installed>
great_tables:         <not installed>
hvplot:               <not installed>
matplotlib:           3.8.4
nest_asyncio:         1.6.0
numpy:                1.24.4
openpyxl:             <not installed>
pandas:               1.5.3
pyarrow:              15.0.2
pydantic:             2.6.4
pyiceberg:            <not installed>
sqlalchemy:           2.0.21
torch:                2.3.1
xlsx2csv:             <not installed>
xlsxwriter:           <not installed>
@akshayka akshayka added bug Something isn't working needs triage Awaiting prioritization by a maintainer python Related to Python Polars labels Jul 2, 2024
@stinodego
Copy link
Member

Thanks for the report. This is a duplicate of #15237

@stinodego stinodego closed this as not planned Won't fix, can't repro, duplicate, stale Jul 3, 2024
# for free to join this conversation on GitHub. Already have an account? # 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