Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: module 'pandas' has no attribute 'plotting' #16536

Closed
stepseazy opened this issue May 30, 2017 · 12 comments
Closed

AttributeError: module 'pandas' has no attribute 'plotting' #16536

stepseazy opened this issue May 30, 2017 · 12 comments
Labels
Duplicate Report Duplicate issue or pull request
Milestone

Comments

@stepseazy
Copy link

I have no idea why I'm getting this error, as I looked in the pandas folder and there is clearly a subfolder called plotting. please help.

RIk

import os
import math
import numpy as np
import h5py
import tqdm as tqdm
import keras
from keras.models import Sequential, Model
from keras.layers.core import Dense, Dropout, Activation, Flatten, Reshape
from keras.layers import Embedding, Input, merge
from keras.layers.recurrent import SimpleRNN, LSTM
from keras.layers.convolutional import Convolution2D, MaxPooling2D
from keras.optimizers import SGD, Adam, RMSprop
import sklearn.metrics as metrics

/home/rik/anaconda3/bin/python /home/rik/PycharmProjects/self_driving/self_driving.py
Using TensorFlow backend.
Traceback (most recent call last):
File "/home/rik/PycharmProjects/self_driving/self_driving.py", line 6, in
import keras
File "/home/rik/anaconda3/lib/python3.5/site-packages/keras/init.py", line 3, in
from . import activations
File "/home/rik/anaconda3/lib/python3.5/site-packages/keras/activations.py", line 3, in
from . import backend as K
File "/home/rik/anaconda3/lib/python3.5/site-packages/keras/backend/init.py", line 64, in
from .tensorflow_backend import *
File "/home/rik/anaconda3/lib/python3.5/site-packages/keras/backend/tensorflow_backend.py", line 1, in
import tensorflow as tf
File "/home/rik/anaconda3/lib/python3.5/site-packages/tensorflow/init.py", line 24, in
from tensorflow.python import *
File "/home/rik/anaconda3/lib/python3.5/site-packages/tensorflow/python/init.py", line 77, in
from tensorflow.python.estimator import estimator_lib as estimator
File "/home/rik/anaconda3/lib/python3.5/site-packages/tensorflow/python/estimator/estimator_lib.py", line 24, in
from tensorflow.python.estimator.inputs import inputs
File "/home/rik/anaconda3/lib/python3.5/site-packages/tensorflow/python/estimator/inputs/inputs.py", line 23, in
from tensorflow.python.estimator.inputs.pandas_io import pandas_input_fn
File "/home/rik/anaconda3/lib/python3.5/site-packages/tensorflow/python/estimator/inputs/pandas_io.py", line 28, in
import pandas as pd
File "/home/rik/anaconda3/lib/python3.5/site-packages/pandas/init.py", line 51, in
plot_params = pandas.plotting._style._Options(deprecated=True)
AttributeError: module 'pandas' has no attribute 'plotting'

Process finished with exit code 1

@jreback
Copy link
Contributor

jreback commented May 30, 2017

so this doesn't work?

(pandas) bash-3.2$ python -c "import pandas; print(pandas.plotting.scatter_matrix)"
<function scatter_matrix at 0x10f6b5a60>

show pd.show_versions()

@stepseazy
Copy link
Author

I'm getting this error now when I try to import pandas. My pyqt is 5.6.0, not sure if that is the problem:

In [1]: import pandas
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-d6ac987968b6> in <module>()
----> 1 import pandas

/home/rik/anaconda3/lib/python3.5/site-packages/pandas/__init__.py in <module>()
     56 
     57 from pandas.util._print_versions import show_versions
---> 58 from pandas.io.api import *
     59 from pandas.util._tester import test
     60 import pandas.testing

/home/rik/anaconda3/lib/python3.5/site-packages/pandas/io/api.py in <module>()
      6 
      7 from pandas.io.parsers import read_csv, read_table, read_fwf
----> 8 from pandas.io.clipboard.clipboard import read_clipboard
      9 from pandas.io.excel import ExcelFile, ExcelWriter, read_excel
     10 from pandas.io.pytables import HDFStore, get_store, read_hdf

/home/rik/anaconda3/lib/python3.5/site-packages/pandas/io/clipboard/__init__.py in <module>()
    101 
    102 
--> 103 copy, paste = determine_clipboard()
    104 
    105 __all__ = ["copy", "paste"]

/home/rik/anaconda3/lib/python3.5/site-packages/pandas/io/clipboard/__init__.py in determine_clipboard()
     74             pass
     75         else:
---> 76             return init_qt_clipboard()
     77 
     78         if _executable_exists("xclip"):

/home/rik/anaconda3/lib/python3.5/site-packages/pandas/io/clipboard/clipboards.py in init_qt_clipboard()
     47 def init_qt_clipboard():
     48     # $DISPLAY should exist
---> 49     from PyQt4.QtGui import QApplication
     50 
     51     # use the global instance if it exists

ImportError: No module named 'PyQt4.QtGui'

@TomAugspurger
Copy link
Contributor

See #16322 then.

Can you check if you have a (maybe empty) PyQt4 directory in your site-packages? Removing that should fix it.

@stepseazy
Copy link
Author

Fixed it thanks.

-Rik

@alexeygrigorev
Copy link

for me updating pandas helped, but removing the qt folder didn't

@hqkhan
Copy link

hqkhan commented Jul 9, 2018

I was using pandas version 0.23.3 when I was getting this exact error. Was able to fix this by re-ordering my import statements.

I was getting this error when trying to import a file that imported pandas itself. By importing that file FIRST and the rest later fixed the issue for me.

@smilyswap
Copy link

I have no idea why I'm getting this error, as I looked in the pandas folder and there is clearly a subfolder called plotting. please help.

RIk

import os
import math
import numpy as np
import h5py
import tqdm as tqdm
import keras
from keras.models import Sequential, Model
from keras.layers.core import Dense, Dropout, Activation, Flatten, Reshape
from keras.layers import Embedding, Input, merge
from keras.layers.recurrent import SimpleRNN, LSTM
from keras.layers.convolutional import Convolution2D, MaxPooling2D
from keras.optimizers import SGD, Adam, RMSprop
import sklearn.metrics as metrics

/home/rik/anaconda3/bin/python /home/rik/PycharmProjects/self_driving/self_driving.py
Using TensorFlow backend.
Traceback (most recent call last):
File "/home/rik/PycharmProjects/self_driving/self_driving.py", line 6, in
import keras
File "/home/rik/anaconda3/lib/python3.5/site-packages/keras/init.py", line 3, in
from . import activations
File "/home/rik/anaconda3/lib/python3.5/site-packages/keras/activations.py", line 3, in
from . import backend as K
File "/home/rik/anaconda3/lib/python3.5/site-packages/keras/backend/init.py", line 64, in
from .tensorflow_backend import *
File "/home/rik/anaconda3/lib/python3.5/site-packages/keras/backend/tensorflow_backend.py", line 1, in
import tensorflow as tf
File "/home/rik/anaconda3/lib/python3.5/site-packages/tensorflow/init.py", line 24, in
from tensorflow.python import *
File "/home/rik/anaconda3/lib/python3.5/site-packages/tensorflow/python/init.py", line 77, in
from tensorflow.python.estimator import estimator_lib as estimator
File "/home/rik/anaconda3/lib/python3.5/site-packages/tensorflow/python/estimator/estimator_lib.py", line 24, in
from tensorflow.python.estimator.inputs import inputs
File "/home/rik/anaconda3/lib/python3.5/site-packages/tensorflow/python/estimator/inputs/inputs.py", line 23, in
from tensorflow.python.estimator.inputs.pandas_io import pandas_input_fn
File "/home/rik/anaconda3/lib/python3.5/site-packages/tensorflow/python/estimator/inputs/pandas_io.py", line 28, in
import pandas as pd
File "/home/rik/anaconda3/lib/python3.5/site-packages/pandas/init.py", line 51, in
plot_params = pandas.plotting._style._Options(deprecated=True)
AttributeError: module 'pandas' has no attribute 'plotting'
Process finished with exit code 1

you need to update pandas version then run the programme and you will find error remove automatically.

@Jacob-Stevens-Haas
Copy link
Contributor

Not sure if mine is related, but if I sys.modules.pop('pandas'), then try import pandas, I get the error. On Pandas 0.23.4, python 3.6.

@Nikhilkumar8143
Copy link

I have no idea why I'm getting this error, as I looked in the pandas folder and there is clearly a subfolder called plotting. please help.

RIk

import os
import math
import numpy as np
import h5py
import tqdm as tqdm
import keras
from keras.models import Sequential, Model
from keras.layers.core import Dense, Dropout, Activation, Flatten, Reshape
from keras.layers import Embedding, Input, merge
from keras.layers.recurrent import SimpleRNN, LSTM
from keras.layers.convolutional import Convolution2D, MaxPooling2D
from keras.optimizers import SGD, Adam, RMSprop
import sklearn.metrics as metrics

/home/rik/anaconda3/bin/python /home/rik/PycharmProjects/self_driving/self_driving.py
Using TensorFlow backend.
Traceback (most recent call last):
File "/home/rik/PycharmProjects/self_driving/self_driving.py", line 6, in
import keras
File "/home/rik/anaconda3/lib/python3.5/site-packages/keras/init.py", line 3, in
from . import activations
File "/home/rik/anaconda3/lib/python3.5/site-packages/keras/activations.py", line 3, in
from . import backend as K
File "/home/rik/anaconda3/lib/python3.5/site-packages/keras/backend/init.py", line 64, in
from .tensorflow_backend import *
File "/home/rik/anaconda3/lib/python3.5/site-packages/keras/backend/tensorflow_backend.py", line 1, in
import tensorflow as tf
File "/home/rik/anaconda3/lib/python3.5/site-packages/tensorflow/init.py", line 24, in
from tensorflow.python import *
File "/home/rik/anaconda3/lib/python3.5/site-packages/tensorflow/python/init.py", line 77, in
from tensorflow.python.estimator import estimator_lib as estimator
File "/home/rik/anaconda3/lib/python3.5/site-packages/tensorflow/python/estimator/estimator_lib.py", line 24, in
from tensorflow.python.estimator.inputs import inputs
File "/home/rik/anaconda3/lib/python3.5/site-packages/tensorflow/python/estimator/inputs/inputs.py", line 23, in
from tensorflow.python.estimator.inputs.pandas_io import pandas_input_fn
File "/home/rik/anaconda3/lib/python3.5/site-packages/tensorflow/python/estimator/inputs/pandas_io.py", line 28, in
import pandas as pd
File "/home/rik/anaconda3/lib/python3.5/site-packages/pandas/init.py", line 51, in
plot_params = pandas.plotting._style._Options(deprecated=True)
AttributeError: module 'pandas' has no attribute 'plotting'
Process finished with exit code 1

Even I am having the same problem,I tried doing in your way but the current version already adds with try and catch block for pyqt.Please reply me I need to have a solution for this also where can find my pyqt if installed or not?

AttributeError: partially initialized module 'pandas' has no attribute 'plotting' (most likely due to a circular import)

@Nikhilkumar8143
Copy link

See #16322 then.

Can you check if you have a (maybe empty) PyQt4 directory in your site-packages? Removing that should fix it.

Where can I find if my pyqt package is available or not? Please I need to have a solution for this

@Nikhilkumar8143
Copy link

I was using pandas version 0.23.3 when I was getting this exact error. Was able to fix this by re-ordering my import statements.

I was getting this error when trying to import a file that imported pandas itself. By importing that file FIRST and the rest later fixed the issue for me.

I didn't understand what you were saying.please I need to have a solution for these
AttributeError: partially initialized module 'pandas' has no attribute 'plotting' (most likely due to a circular import)

@jazzyhari
Copy link

from pandas.plotting._misc import scatter_matrix

then don't use pd.scatter_matrix or pandas.scatter_matrix
u can call direct scatter_matrix

eg - cmap = cm.get_cmap('gnuplot')
scatter = scatter_matrix(X, c = y, marker = 'o', s=40, hist_kwds={'bins':15}, figsize=(9,9), cmap = cmap)
plt.suptitle('Scatter-matrix for each input variable')
plt.savefig('fruits_scatter_matrix')
plt.show()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate Report Duplicate issue or pull request
Projects
None yet
Development

No branches or pull requests

10 participants