I am new to pandas_profiling and getting ImportError while importing it. Please help.
import numpy as np
import pandas as pd
import pandas_profiling
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
%matplotlib inline
import seaborn as sns
After executing the above code in jupyter notebook, I am getting the following error.
ImportError: matplotlib is required for plotting when the default backend "matplotlib" is selected.
> python --version
Python 3.7.3
> pip list | grep -E "matplotlib|pandas"
matplotlib 3.2.0
pandas 0.25.3
pandas-profiling 2.5.3
I don't know the actual reason but I restarted the kernel and it is working.
Before restarting the kernel I executed following commands:
conda install -c anaconda pandas-profiling
Related
I have installed numpy, pandas and matplot lib
but installation of seaorn i not possible. I ve tried updating Numpy, installing seaborn through the cmd command but in vain. I restarted the kernel each time.
import seaborn as sns
I keep recieving ;
ImportError: DLL load failed while importing _arpack: The specified procedure could not be found.
I have used:
!pip install seaborn
pip install numpy --upgrade --user
pip import seaborn as sns df = sns.load_dataset(penguins) sns.pairplot(df, hue=species)
It seems like your seaborn and/or numpy installation is broken or at least there is some versions conflict.
Try to run these commande from the command line :
pip unistall seaborn numpy
pip install mkl numpy seaborn
After that, you can run this code in your Jupyter notebook :
import seaborn as sns
df = sns.load_dataset("penguins")
sns.pairplot(df, hue="species")
the problem was fixed by updating matplotlib on the conda shell.
conda update matplotlib
I'm trying to import these libraries:
from math import sqrt
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from statsmodels.tsa.arima_model import ARIMA
from sklearn.metrics import mean_absolute_error, mean_squared_error
from pyramid.arima import auto_arima
from statsmodels.tsa.stattools import adfuller
But this error is coming again and again
ModuleNotFoundError: No module named 'pyramid'
I have tried pip install pyramid-arima but it's also throwing me so many errors in cmd.
Can anyone suggest to me what I can do to resolve this problem?
try
pip install pmdarima
pmdarima is the official new name for pyramid.arima.
Try to install pmdarima by using pip:
pip install pmdarima
I also needed to modify my python script to use:
from pmdarima.arima import auto_arima
I updated my spyder from 3.3.6 to 4.0.1 and since then my libraries are not getting compiled , like pandas library, sklearn , and few other .
I don't know why it's happening . Normal import statements show error . Even numpy did the same , so i just ran pip install numpy in the ipython console and then it got solved .
Is there no other alternative? Spyder 3.6 worked just fine without running the pip command in the ipython console .
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import LabelEncoder,OneHotEncoder
for now i used ipython commands to install the entire library again (pip install sklearn).
Can someone help me out with a permanent fix?
I am new to python, and trying to run this example in Jupyter notebook. Whenever I run following
import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from statsmodels.tsa.api import SimpleExpSmoothing
It gives me following error
ImportError Traceback (most recent call last)
<ipython-input-5-a15788c08ca7> in <module>()
3 import pandas as pd
4 import matplotlib.pyplot as plt
----> 5 from statsmodels.tsa.api import SimpleExpSmoothing
ImportError: cannot import name 'SimpleExpSmoothing'
Although, I have installed statsmodels (0.8.0) by
pip install statsmodels
like other packages (numpy, pandas etc.). I checked on git, api file contains this method but my api file (obtained through pip) doesn't have this method. Maybe I am not getting the git version (seems latest one) through pip? I am working in windows and I also tried on mac OSX, and result is same. I tried to do a copy/paste attempt for missing files/code in files from git (not a good way) but it doesn't help. I would appreciate your suggestions here.
EDIT
So the solution for Jupyter (thanks to #user333700) is to install master branch directly from git by
pip install git+https://github.com/statsmodels/statsmodels.git
I am extending my question for PyCharm, how can I add a git package within PyCharm? This link does not help.
For future reference another solution which worked for me is to pip install the latest version directly:
pip install statsmodels==0.9.0rc1
I have a python program and am trying to plot something using the mplot3d from mpl toolkits, but whenever I try to import the Axes3D from mpl_toolkits from mpl_toolkits.mplot3d import Axes3D
I get the following error: ImportError: No module named mpl_toolkits
I solved this by running the following imports in the following order:
import matplotlib.pyplot as plt
import mpl_toolkits
from mpl_toolkits.mplot3d import Axes3D
Note: This only worked for me on python3. So first, I had to install python3 and pip3. Then I did "pip3 install matplotlib" in Terminal. If you already have matplotlib then try "pip3 install --upgrade matplotlib"