Search code examples
pythonpycharm

Pycharm not show out put in the case of Numpy (Google colab show)


enter image description here

In the case of the pycharm, it doesn't show any output.

I used "print()" already. But, Pycharm is showing the <numpy.vectorize object at 0x0000022CF6EDDFA0>.


Solution

  • "aa" in your code is a vectorized function object.

    Like any other function or object, when you do print(aa), you aren't calling it. Similarly, if you write print(len), you get basic description of the function len: <built-in function len>. In order to actually call it, it needs to be followed by brackets. For example: print(len('hello'))

    In your code, you probably need print( aa([1,2,3,4], 2) )