0

Experts,

Here is my block of code and I am getting the below error.

import pandas 
import os
trainFile = r'C:\PythonProjects\sample.csv'
pwd = os.getcwd()
os.chdir(os.path.dirname(trainFile))
trainData = pandas.read_csv(os.path.basename(trainFile))
p=pandas_profiling.ProfileReport(trainData)
os.chdir(pwd)

--------------------------------------------------------------------------- NameError Traceback (most recent call last) in () 6 trainData = pandas.read_csv(os.path.basename(trainFile)) ----> 7 p=pandas_profiling.ProfileReport(trainData) 8 os.chdir(pwd)

Can you provide your inputs/suggestions to resolve this error pls. NameError: name 'pandas_profiling' is not defined

Simon
  • 5,464
  • 6
  • 49
  • 85
user3512380
  • 1
  • 1
  • 1
  • 2

3 Answers3

2

Remember to run import pandas_profiling before using it.

This should work for those who want to use the latest version:

  1. Run pip uninstall pandas_profiling or conda uninstall pandas_profiling from anaconda prompt/command prompt
  2. Run pip install https://github.com/pandas-profiling/pandas-profiling/archive/master.zip

If you're using something like a Jupyter Notebook/Jupyter Lab, be sure to restart your kernel and re-import your packages.

I hope this helps.

Ray's Web Presence
  • 464
  • 1
  • 5
  • 15
0

"pandas_profiling" comes as a pip packages. Have you installed the package..?

pip install pandas-profiling

or maybe you have installed the package in some virtual environment, not in your complete path.

See the link pandas-profiling

vutsuak
  • 64
  • 8
  • Yes I did check the installation using pip freeze command the package was installed successfully and I do not have a virtual environment. Is there a way I could provide the absolute path of this package in my program. – user3512380 Jun 09 '17 at 15:24
  • Yes. Pycharm removed the reference citing it could not able to locate the reference. – user3512380 Jun 09 '17 at 17:44
0

Try to run pip install pandas-profiling command in a separate cell in the jupyter notebook just before importing all the packages.

After this re-start your kernel and re-run the whole notebook again. This should give you the required profile report.

iPhoneDeveloper
  • 958
  • 1
  • 14
  • 23