gzuidhof / starboard-notebook

In-browser literate notebooks
Mozilla Public License 2.0
1.2k stars 95 forks source link

Js exception with pandas - df[‘a’] / df.a #124

Open unhott opened 1 year ago

unhott commented 1 year ago

Confirmed the issue on multiple devices/browsers

https://starboard.gg/unhott/Js-exception-pandas-nwAFWup

When trying to index into a dataframe to get a series, js raises this error.

“ TypeError undefined is not an object (evaluating '$.replace')”

unhott commented 1 year ago

Actually, the error is slightly different on Firefox 103.0.2

'TypeError $ is undefined'

twoxfh commented 1 year ago

I can confirm the above code works on https://pyodide.org/en/stable/console.html which not only runs code but handles console output which is likely handling the output for df.a.

from pyodide.console import PyodideConsole

It does not appear the Starboard-python handles console output, @gzuidhof may have some thoughts on this.

As a workaround you can convert your output to a string and it will display.

str(df.a)

or

df['a'].to_numpy()

gzuidhof commented 1 year ago

This does look like an error yeah, it seems to be related to Starboard trying to display LaTeX output correctly, other than that I don't currently have the time to debug it :/