Thanks to visit codestin.com
Credit goes to github.com

Skip to content

DOC: Missing import numpy as np in interactive example of np.testing.assert_array_equal.html #30509

@ns-rse

Description

@ns-rse

Issue with current documentation:

The interactive example for numpy.testing.assert_array_equal doesn't run on initial loading and raises NameError: name 'np' is not defined.

Image

Idea or request for content:

Adding the import on the first line of the first cell solves this...

import numpy as np

I can take this on but checked a few other pages and it seems a common problem so I'm wondering if there is a more generic solution.

If pyodide is being used then it would perhaps be possible to load the package globally earlier in the configuration/setup. I doubt this will work...

await pyodide.loadPackage("numpy")

...but maybe

await pyodide.import("numpy", as="np")

but struggling to find the API reference for pyodide.import so that may not be possible either and I've not played with it much.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions