-4

Confused what I do wrong any help helps I trying to understand numpy and learn it [1]: https://i.stack.imgur.com/QqPAw.png

import numpy as np

jeff_salary = [3300,2700,9000,2900]

base_salary = np.array([jeff_salary])
print(base_salary)
David H. J.
  • 340
  • 2
  • 12
Larry
  • 1
  • 1
  • 2
    Please, add code in code blocks, not as an image – Vladimir Fokow Aug 13 '22 at 00:21
  • 1
    In addition to what Vladimir mentioned, please mention what is the issue, what is the current behavior and what is the the expected behavior. – Meh Aug 13 '22 at 00:23
  • Please don't post images of code, data, or Tracebacks. Copy and paste it as text then format it as code (select it and type `ctrl-k`) … [Why should I not upload images of code/data/errors when asking a question?](https://meta.stackoverflow.com/questions/285551/why-should-i-not-upload-images-of-code-data-errors-when-asking-a-question) – wwii Aug 13 '22 at 01:23

1 Answers1

1

Your file has a name numpy.py.

The line import numpy as np doesn't import numpy. Instead - it imports itself! (your own script). And of course, your module doesn't have an attribute array.

Rename your script, for example to: learning_numpy.py, and it should work.

You had a hint in the error message:

AttributeError: partially initialized module 'numpy' has no attribute 'array' (most likely due to a circular import).

Gold79
  • 344
  • 3
  • 9
Vladimir Fokow
  • 3,728
  • 2
  • 5
  • 27