[Python] How to create python classes in Jupyter Notebook

Discussão em 'Python' iniciado por Stack, Abril 21, 2025.

  1. Stack

    Stack Membro Participativo

    I've tried to created and use classes in jupyter notebook. But it seems it doesn't work And I've tried this :

    def pxlocal(line, cell):
    ip = get_ipython()
    ip.run_cell_magic("px", line, cell)
    ip.run_cell(cell)
    ip.register_magic_function(pxlocal, "cell")


    And in different cell:

    %%pxlocal class MyClass(object):

    But when I run those two cells it gave me this error:

    ERROR:root:Cell magic `%%px` not found.
    In [11]:


    What am I doing wrong?

    Continue reading...

Compartilhe esta Página