ydataai / ydata-profiling

1 Line of code data quality profiling & exploratory data analysis for Pandas and Spark DataFrames.
https://docs.profiling.ydata.ai
MIT License
12.45k stars 1.68k forks source link

module 'numpy' has no attribute 'printoptions' #260

Closed duckbill closed 4 years ago

duckbill commented 5 years ago

Describe the bug

AttributeError Traceback (most recent call last)

in () 6 columns=['a', 'b', 'c', 'd', 'e'] 7 ) ----> 8 df.profile_report(style={'full_width':True}) 9 profile = df.profile_report() 10 rejected_variables = profile.get_rejected_variables(threshold=0.9) ~/anaconda3/lib/python3.6/site-packages/pandas_profiling/controller/pandas_decorator.py in profile_report(df, **kwargs) 14 A ProfileReport of the DataFrame. 15 """ ---> 16 p = ProfileReport(df, **kwargs) 17 return p 18 ~/anaconda3/lib/python3.6/site-packages/pandas_profiling/__init__.py in __init__(self, df, **kwargs) 79 80 # Render HTML ---> 81 self.html = to_html(sample, description_set) 82 self.minify_html = config["minify_html"].get(bool) 83 self.use_local_assets = config["use_local_assets"].get(bool) ~/anaconda3/lib/python3.6/site-packages/pandas_profiling/view/report.py in to_html(sample, stats_object) 519 "title": "Variables", 520 "anchor_id": "variables", --> 521 "content": render_variables_section(stats_object), 522 }, 523 { ~/anaconda3/lib/python3.6/site-packages/pandas_profiling/view/report.py in render_variables_section(stats_object) 372 "content": templates.template( 373 "variables/row_num_histogram.html" --> 374 ).render(values=formatted_values), 375 }, 376 "frequency_table": { ~/anaconda3/lib/python3.6/site-packages/jinja2/asyncsupport.py in render(self, *args, **kwargs) 74 def render(self, *args, **kwargs): 75 if not self.environment.is_async: ---> 76 return original_render(self, *args, **kwargs) 77 loop = asyncio.get_event_loop() 78 return loop.run_until_complete(self.render_async(*args, **kwargs)) ~/anaconda3/lib/python3.6/site-packages/jinja2/environment.py in render(self, *args, **kwargs) 1006 except Exception: 1007 exc_info = sys.exc_info() -> 1008 return self.environment.handle_exception(exc_info, True) 1009 1010 def render_async(self, *args, **kwargs): ~/anaconda3/lib/python3.6/site-packages/jinja2/environment.py in handle_exception(self, exc_info, rendered, source_hint) 778 self.exception_handler(traceback) 779 exc_type, exc_value, tb = traceback.standard_exc_info --> 780 reraise(exc_type, exc_value, tb) 781 782 def join_path(self, template, parent): ~/anaconda3/lib/python3.6/site-packages/jinja2/_compat.py in reraise(tp, value, tb) 35 def reraise(tp, value, tb=None): 36 if value.__traceback__ is not tb: ---> 37 raise value.with_traceback(tb) 38 raise value 39 ~/anaconda3/lib/python3.6/site-packages/pandas_profiling/view/templates/variables/row_num_histogram.html in top-level template code() 4 {% if 'histogram_bayesian_blocks' in values %} 5 Histogram ----> 6
Histogram with variable size bins (bins={{ values['histogram_bins_bayesian_blocks'] | fmt_array(threshold=5) }}, "bayesian blocks" binning strategy used)
7 {% endif %} ~/anaconda3/lib/python3.6/site-packages/pandas_profiling/view/formatters.py in fmt_array(value, threshold) 92 The string representation of the numpy array. 93 """ ---> 94 with np.printoptions(threshold=3, edgeitems=threshold): 95 value = str(value) 96 AttributeError: module 'numpy' has no attribute 'printoptions' **To Reproduce** _Code:_ Preferably, use this code format: ```python import pandas as pd import numpy as np import matplotlib.pyplot as plt df = pd.DataFrame( np.random.rand(100, 5), columns=['a', 'b', 'c', 'd', 'e'] ) df.profile_report(style={'full_width':True}) profile = df.profile_report() rejected_variables = profile.get_rejected_variables(threshold=0.9) profile = df.profile_report(title='Pandas Profiling Report') profile.to_file(output_file="output.html") ``` **Version information:** * _Python version_: Python 3.6.5 :: Anaconda custom (64-bit) * _Environment_: jupyter-notebook * _`pip`_: ``` absl-py==0.2.2 alabaster==0.7.10 anaconda-client==1.6.14 anaconda-navigator==1.8.7 anaconda-project==0.8.2 asn1crypto==0.24.0 astor==0.6.2 astroid==1.6.5 astropy==3.0.3 atomicwrites==1.1.5 attrs==18.1.0 Automat==0.6.0 Babel==2.6.0 backcall==0.1.0 backports.shutil-get-terminal-size==1.0.0 backports.weakref==1.0.post1 beautifulsoup4==4.6.0 bitarray==0.8.2 blaze==0.11.3 bleach==1.5.0 bokeh==0.12.16 boto==2.48.0 boto3==1.7.32 botocore==1.10.32 Bottleneck==1.2.1 bz2file==0.98 certifi==2018.4.16 cffi==1.11.5 chardet==3.0.4 click==6.7 cloudpickle==0.5.3 clyent==1.2.2 colorama==0.3.9 conda==4.5.4 confuse==1.0.0 constantly==15.1.0 contextlib2==0.5.5 cryptography==2.2.2 cssselect==1.0.1 cycler==0.10.0 Cython==0.29.7 cytoolz==0.9.0.1 dask==0.17.5 datashape==0.5.4 decorator==4.3.0 dill==0.3.0 distributed==1.21.8 docutils==0.14 dukpy==0.2.2 echarts-china-cities-pypkg==0.0.8 echarts-china-counties-pypkg==0.0.2 echarts-china-misc-pypkg==0.0.1 echarts-china-provinces-pypkg==0.0.3 echarts-countries-pypkg==0.1.4 EMD-signal==0.2.7 entrypoints==0.2.3 enum34==1.1.6 et-xmlfile==1.0.1 fastcache==1.0.2 fasttext==0.8.3 fbprophet==0.2.1 Flask==1.0.2 Flask-Cors==3.0.4 future==0.16.0 gast==0.2.0 gensim==3.4.0 gevent==1.3.2.post0 gmpy2==2.0.8 graphviz==0.7.1 greenlet==0.4.13 grpcio==1.12.0 h5py==2.8.0 heapdict==1.0.0 helper==2.4.2 html5lib==0.9999999 htmlmin==0.1.12 hyperlink==17.3.1 idna==2.6 imageio==2.3.0 imagesize==1.0.0 importlib-metadata==0.23 incremental==17.5.0 ipykernel==4.8.2 ipython==6.4.0 ipython-genutils==0.2.0 ipywidgets==7.2.1 isort==4.3.4 itsdangerous==0.24 javascripthon==0.10 jdcal==1.4 jedi==0.12.0 jieba==0.39 Jinja2==2.10 jmespath==0.9.3 jsonschema==2.6.0 jupyter==1.0.0 jupyter-client==5.2.3 jupyter-console==5.2.0 jupyter-contrib-core==0.3.3 jupyter-contrib-nbextensions==0.5.1 jupyter-core==4.4.0 jupyter-echarts-pypkg==0.1.2 jupyter-highlight-selected-word==0.2.0 jupyter-latex-envs==1.4.6 jupyter-nbextensions-configurator==0.4.1 Keras==2.1.6 Keras-Applications==1.0.2 Keras-Preprocessing==1.0.1 kiwisolver==1.0.1 lazy-object-proxy==1.3.1 lightgbm==0.2 llvmlite==0.29.0 lml==0.0.2 locket==0.2.0 lxml==4.2.1 macropy3==1.1.0b2 Markdown==2.6.11 MarkupSafe==1.0 MatchZoo==0.2.0 matplotlib==3.1.1 mbdata==2017.6.2 mccabe==0.6.1 missingno==0.4.2 mistune==0.8.3 mkl-fft==1.0.0 mkl-random==1.0.1 more-itertools==4.2.0 mpmath==1.0.0 msgpack==0.5.6 msgpack-python==0.5.6 multipledispatch==0.5.0 multiprocess==0.70.8 mysqlclient==1.3.10 navigator-updater==0.2.1 nbconvert==5.3.1 nbformat==4.4.0 networkx==2.1 nltk==3.3 nose==1.3.7 notebook==5.5.0 numba==0.45.1 numexpr==2.6.5 numpy==1.17.2 numpydoc==0.8.0 odo==0.5.1 olefile==0.45.1 openpyxl==2.5.4 packaging==17.1 pandas==0.25.1 pandas-profiling==2.3.0 pandocfilters==1.4.2 parsel==1.2.0 parso==0.2.1 partd==0.3.8 PassgerFlowPredict==1.0 path.py==11.0.1 pathlib2==2.3.2 pathos==0.2.4 patsy==0.5.0 pep8==1.7.1 pexpect==4.6.0 phik==0.9.8 pickleshare==0.7.4 Pillow==5.1.0 pluggy==0.13.0 ply==3.11 pmdarima==1.1.1 pox==0.2.6 ppft==1.6.6.1 prompt-toolkit==1.0.15 protobuf==3.5.2 psutil==5.4.6 ptyprocess==0.5.2 py==1.5.3 pyasn1==0.3.7 pyasn1-modules==0.1.5 pycodestyle==2.4.0 pycosat==0.6.3 pycparser==2.18 pycrypto==2.6.1 pyculiarity==0.0.7 pycurl==7.43.0.2 PyDispatcher==2.0.5 pyecharts==0.5.11 pyecharts-javascripthon==0.0.6 pyecharts-jupyter-installer==0.0.3 pyecharts-snapshot==0.1.8 pyflakes==2.0.0 Pygments==2.2.0 PyInstaller==3.2.1 pylint==1.9.2 pyodbc==4.0.23 pyOpenSSL==18.0.0 pyparsing==2.2.0 PypeR==1.1.2 PySocks==1.6.8 pystan==2.17.1.0 pytest==5.1.2 pytest-arraydiff==0.2 pytest-astropy==0.4.0 pytest-doctestplus==0.1.3 pytest-openfiles==0.3.0 pytest-pylint==0.14.1 pytest-remotedata==0.3.0 python-dateutil==2.7.3 python-Levenshtein==0.12.0 pytz==2018.4 PyWavelets==0.5.2 PyYAML==3.12 pyzmq==17.0.0 QtAwesome==0.4.4 qtconsole==4.3.1 QtPy==1.4.2 queuelib==1.4.2 redis==3.2.1 requests==2.18.4 rope==0.10.7 rpy2==3.0.1 rstl==0.1.3 ruamel-yaml==0.15.37 s3transfer==0.1.13 scikit-image==0.13.1 scikit-learn==0.19.1 scipy==1.1.0 Scrapy==1.4.0 seaborn==0.8.1 Send2Trash==1.5.0 service-identity==17.0.0 simhash==1.9.0 simplegeneric==0.8.1 singledispatch==3.4.0.3 six==1.11.0 sklearn==0.0 smart-open==1.5.7 snowballstemmer==1.2.1 sortedcollections==1.0.1 sortedcontainers==2.0.4 Sphinx==1.7.5 sphinxcontrib-websupport==1.1.0 spyder==3.2.8 SQLAlchemy==1.2.8 statsmodels==0.9.0 sympy==1.1.1 tables==3.4.3 tblib==1.3.2 tensorboard==1.8.0 tensorflow==1.8.0 tensorflow-tensorboard==1.5.1 termcolor==1.1.0 terminado==0.8.1 testpath==0.3.1 tflearn==0.3.2 Theano==1.0.2 toolz==0.9.0 tornado==5.0.2 tqdm==4.23.4 traitlets==4.3.2 Twisted==17.9.0 tzlocal==1.5.1 unicodecsv==0.14.1 urllib3==1.22 w3lib==1.18.0 wcwidth==0.1.7 Werkzeug==0.14.1 widgetsnbextension==3.2.1 wrapt==1.10.11 xgboost==0.6a2 xlrd==1.1.0 XlsxWriter==1.0.5 xlwt==1.3.0 zict==0.1.3 zipp==0.6.0 zope.interface==4.4.3 ```
sbrugman commented 5 years ago

What have you tried to resolve this issue? Did you update numpy (pip install -U numpy).

Other options are mentioned here: https://stackoverflow.com/a/48364708/470433

Joseph530 commented 4 years ago

I also meet the same problem when executing df.profile_report(). I have already try pip uninstall numpy and pip install numpy but the error still exist. How to solve it?

duckbill commented 4 years ago

What have you tried to resolve this issue? Did you update numpy (pip install -U numpy).

Other options are mentioned here: https://stackoverflow.com/a/48364708/470433

it does not work !