0

I was writing something in Jupyter and wrote r=np.array=([1,2,3,4]), and now np.array doesn't work. I used np.array=None, but now it just gives me back: module 'numpy' has no attribute 'array'.

How could I fix this without starting a new jupyter notebook?

John Kugelman
  • 349,597
  • 67
  • 533
  • 578
Beans9991
  • 31
  • 1
  • np.array is a reference to a function. Therefore, if you assign something to it it will become something else. Why would you want to assign something to it? Are you deliberately trying to override it? Not advisable IMO. In your case it will become a list containing [1,2,3,4] – DarkKnight Feb 14 '22 at 16:32
  • I presume the extra `=` was a typo and the OP realizes they made a mistake. – John Kugelman Feb 14 '22 at 16:35
  • @JohnKugelman OP seems to think that restarting Jupyter will solve the problem. It won't – DarkKnight Feb 14 '22 at 16:36
  • 1
    You can [reload](https://stackoverflow.com/questions/1254370/reimport-a-module-in-python-while-interactive) the `np` module with `import importlib`, `importlib.reload(np)`. – John Kugelman Feb 14 '22 at 16:37
  • Thanks for the quick answers! It was a typo i should have made that clear! I didnt think restarting it will solve it thats why i asked a question. – Beans9991 Feb 14 '22 at 16:54

0 Answers0