Cannot import name 'to_html' from 'pandas_profiling.report' using JupyterLab - pandas

I'm new using Jupyter Lab and Pandas profiling.
I'm trying to install and import and install Pandas Profiling in a jupyter notebook. I'm able to install pandas collab using pip, but unable to import the library. The error says I cannot import name 'to_html' from 'pandas_profiling.report'.
Here's the code and the error.
Funny thing is: I also tried to run the notebook in Google Colab, but I got a different but similar error:
ImportError: cannot import name 'PandasProfiling' from 'pandas_profiling' (/usr/local/lib/python3.8/dist-packages/pandas_profiling/__init__.py)
I already tried to use Jupyter Lab and Jupyter Notebook from Anaconda and Google Colab to see if it works, but no look.

conda install -c conda-forge pandas-profiling
See this question.

from pandas_profiling import ProfileReport
https://pandas-profiling.ydata.ai/docs/master/pages/getting_started/quickstart.html
PandasProfiling object does not exist.

Related

cannot import name 'Appender' from 'statsmodels.compat.pandas' in google colab error?

I am trying to import from pmdarima.arima import auto_arima and
from pmdarima.arima import ADFTest but it giving me error cannot import name 'Appender' from 'statsmodels.compat.pandas'
I tried !pip install pmdarima in google colab but it is still giving me error
I had the same and fixed it by downgrading scipy
pip install pmdarima scipy==1.2 -Uqq
got it from How to fix Google colab import errors on statsmodels logsumexp and factorial
A restart of the runtime environment was needed after installation.

pandas_profiling.ProfileReport(dataframe) in google colab

Why doesn't pandas_profiling.ProfileReport(dataframe) work in google colab?
Returns a type error.
TypeError: concat() got an unexpected keyword argument 'join_axes'
Just use pandas-profiling version 2.7.1 and you are good to go.Run this command in the colab !pip install pandas-profiling==2.7.1
Aishah Ismail's post on Medium may help you fix this issue.
Install the pandas-profiling package using pip.
! pip install https://github.com/pandas-profiling/pandas-profiling/archive/master.zip
Restart your kernel = Go to "Runtime" in the option menu and click "Reset All Runtimes"
Execute your code to create your dataframe and create the pandas profile.
import pandas as pd
import numpy as np
from pandas_profiling import ProfileReport
df = pd.read_excel('fileName.xlsx')
profile = ProfileReport(df)
profile.to_notebook_iframe()
You may need to pip install pandas-profiling if the import above does not work.
!pip install pandas-profiling==2.7.1 Re-execute your code after the pip install.
When you try to display the profile do not use .to_widgets()--it isn't working in Colab.
If the above doesn't work, I suggest switching to Jupyter Lab or Jupyter Notebook. The pandas profile dashboard works well in the Jupyter environment.
I hope this helps! Pandas-Profiling a wonderful EDA tool--such a time saver.

ModuleNotFoundError for pandas_datareader: Jupyter Notebook using different packages from conda environment

I am using Anaconda windows v5.3.
I am getting the error:
ModuleNotFoundError: No module named 'pandas_datareader'
When I tried to print out the packages used by Jupyter Notebook, I realized that pandas_datareader is not in, and a different version of pandas (0.23.0) is used:
import pkg_resources
for i in pkg_resources.working_set:
print(i)
Output
...
pandocfilters 1.4.2
pandas 0.23.0
packaging 17.1
openpyxl 2.5.3
...
This differs from the library installed in the pyfinance environment:
>conda list
# Name Version Build
pandas 0.20.3 py36_0
pandas-datareader 0.4.0 py36_0
Hence, pandas_datareader seem to work in the python shell in the command prompt, but not in jupyter notebook. Are there anyways to sync jupyter notebook environment to the conda environment?
I realized to sync jupyter notebook you just have to do:
conda install jupyter

problems when importing tensorflow in Jupiter Notebook

I am using Jupiter Notebook installed with Anaconda distribution and I want to install Tensorflow.
I wrote
!pip install tensorflow
it installed it, but now when I want to import tensorflow, when I type
import tensorflow as tf
it gives me an error:
ImportError: DLL load failed with error code -1073741795
I searched for answers and questions related to this issue but nothing helped me. The most weird is that I managed to install and import tensorflow on another computer like this. I can`t find out what I am missing.

ipython cannot search matplotlib while using tensorflow and jupyter also has import error

I am using python 2.7 in Ubuntu and recently updated tensorflow 0.12.1.
I installed jupyter today for my sample code of tf and I need to use matplotlib. It does not find module name matplotlib and ipython in tensorflow has same error.
1. How can I set path in virtualenv or ipython or jupyter?
After activate tensorflow, I need to use jupyter notebook.
This below in the script for error does not work.
import sys
sys.path.append('my/path/to/module/folder')
import module-of-interest
2. other information: My environments are below.
mickyefromsd#DEKSTOP~$source ~/tensorflow/bin/activate
When I find matplotlib by python script under TF condition and before TF activation, it has below;
/usr/lib/python2.7/dist-packages/matplotlib/
When I type 'which ipython', it has below (not by /usr/bin/ipython) ;
/home/mickeyfromd/tensorflow/bin/ipython
Btw, /tensorflow/lib/python2.7/site-packages/ it has ipython and jupyter.
(not in the same path of matplotlib)
3. My ipython under TF cannot find my existing matplotlib.
(tensorflow) mickeyfromd#DK-DESKTOP:~$ ipython
Python 2.7.11+ (default, Apr 17 2016, 14:00:29)
In [1]: import matplotlib ImportError: No module named matplotlib
4. I wanted to setup virtualenv, so I just run this
I followed this site. site:http://help.pythonanywhere.com/pages/IPythonNotebookVirtualenvs
(tensorflow) mickeyfromd#ipython kernelspec install-self --user
.....
Installed kernelspec python2 in /home/mickeyfromd/.local/share/jupyter/kernels/python2
(tensorflow) mickeyfromd#DK-DESKTOP:~$
I cannot move the the folder (in the second step)
How can I make ipython to have path for Matplotlib?
That import error is due to change in environment of the jupyter notebook. You might have installed the packages in one environment and you are running the jupyter notebook in another environment.
I have got two environments (envs) in my Anaconda folder ( I have Anaconda3 folder to be specific ).
(windows key+cmd ) -> open the windows command prompt run as administrator.
Activate (name of the environment) -> eg.: activate tensorflow-gpu
Start installing packages using conda install
Note: For each environment you need to install all the packages you want to use, separately using the same process. This solution is for windows users, might work for linux users not sure though.
Additionally to make sure your conda environment is up to date run:
conda update conda
conda update anaconda
check this out : https://pradyumnamajumder.wordpress.com/2017/09/30/solution-to-the-python-packages-import-error-in-jupyter/