Bug: shift+tab tooltip / pandas dataframe break in ipython / Jupyter Server

Hey all,

I’m seeing an interesting break with pandas=1.5.3 and ipython=8.12.0, jupyter_core=5.3.0, jupyter _server=1.23.4 (conda install).

I’ve made a toy dataframe df, then called df.head().
Everything works fine.
If I do shift+tab within the parens, instead of a tooltip I get this error to the command line

[IPKernelApp] ERROR | Exception in message handler:
Traceback (most recent call last):
  File "/opt/anaconda3/envs/2023_q2_ipywidgets_talk/lib/python3.10/site-packages/ipykernel/kernelbase.py", line 406, in dispatch_shell
    await result
  File "/opt/anaconda3/envs/2023_q2_ipywidgets_talk/lib/python3.10/site-packages/ipykernel/kernelbase.py", line 796, in inspect_request
    reply_content = self.do_inspect(
  File "/opt/anaconda3/envs/2023_q2_ipywidgets_talk/lib/python3.10/site-packages/ipykernel/ipkernel.py", line 544, in do_inspect
    bundle = self.shell.object_inspect_mime(
  File "/opt/anaconda3/envs/2023_q2_ipywidgets_talk/lib/python3.10/site-packages/IPython/core/interactiveshell.py", line 1838, in object_inspect_mime
    return self.inspector._get_info(
  File "/opt/anaconda3/envs/2023_q2_ipywidgets_talk/lib/python3.10/site-packages/IPython/core/oinspect.py", line 738, in _get_info
    info_dict = self.info(obj, oname=oname, info=info, detail_level=detail_level)
  File "/opt/anaconda3/envs/2023_q2_ipywidgets_talk/lib/python3.10/site-packages/IPython/core/oinspect.py", line 838, in info
    if info and info.parent and hasattr(info.parent, HOOK_NAME):
  File "/opt/anaconda3/envs/2023_q2_ipywidgets_talk/lib/python3.10/site-packages/pandas/core/generic.py", line 1527, in __nonzero__
    raise ValueError(
ValueError: The truth value of a DataFrame is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().

Is this a known issue? Probably I should just file a bug with ipython…

1 Like

I’m having the same issue. When I place the curser between the .head() parathesis the tooltip function does not activate.

I think it might be an issue with an updated version of Jupyter? It worked ok until I updated to the latest version of Jupyter Notebook.

Any thoughts out there?

Same problem over here. Have you found the solution?

Reinstall. Tooltip was not working on the newest version of Anaconda. I installed older version: Anaconda3-2023.03-1-Windows-x86_64, jupyter is the 6.5.2 version and now it works!

I have the same error on linux as well when using jupyter notebooks.


It seems to have been fixed in IPython’s master branch, but if you don’t want to upgrade, just modify

        if info and info.parent and hasattr(info.parent, HOOK_NAME):


        if info and info.parent is not None and hasattr(info.parent, HOOK_NAME):

in IPython/core/inspect.py