Skip to content
Advertisement

My project is working on google colab but not working on pycharm

My project is a handwriting digit analyzer. It is working on Google Colab but is showing an error on Pycharm. The statement that is making it work in colab is “%matplotlib inline” this line is showing an error in pycharm.

JavaScript

Traceback (most recent call last): File “C:UsersAsusPycharmProjectspythonProjectHandwriting_Digit_Recognitiondigit.py”, line 15, in plt.imshow(np.reshape(image, (18, 18)), cmap=”gray”) File “<array_function internals>”, line 5, in reshape File “C:UsersAsusPycharmProjectspythonProjectvenvlibsite-packagesnumpycorefromnumeric.py”, line 299, in reshape return _wrapfunc(a, ‘reshape’, newshape, order=order) File “C:UsersAsusPycharmProjectspythonProjectvenvlibsite-packagesnumpycorefromnumeric.py”, line 55, in _wrapfunc return _wrapit(obj, method, *args, **kwds) File “C:UsersAsusPycharmProjectspythonProjectvenvlibsite-packagesnumpycorefromnumeric.py”, line 44, in _wrapit result = getattr(asarray(obj), method)(*args, **kwds) ValueError: cannot reshape array of size 1 into shape (18,18)

Advertisement

Answer

%matplotlib inline is a message to Jupyter notebook to render images into the notebook itself. You need to remove that line if you use your code from Pycharm.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement