buckaroo icon indicating copy to clipboard operation
buckaroo copied to clipboard

infinity displays as blank

Open paddymul opened this issue 2 years ago • 3 comments

Checks

  • [X] I have checked that this issue has not already been reported.

  • [X] I have confirmed this bug exists on the latest version of Buckaroo.

What type of jupyter notebook were you using (VSCode notebook, google colab, Jupyter Lab, Jupyter notebook). Select multiple if you can reproduce this in multiple environments. If other, please add to description.

VS Code, Jupyter Lab, Google Colab, Jupyter Notebook

Reproducible example

pd.DataFrame({'a':[np.inf, 0, -0, 1, np.nan, None, pd.NA ]})

Jupyter Log output

None

Issue description

np.inf displays as blank in the table., just like np.nan.

Infinity also doesn't show up in the label for the histograms, instead displaying as empty. (visible in the screenshot)

Screen Shot 2023-11-10 at 2 31 01 PM

Expected behavior

Infinty, np.inf, inf, or should appear in the table and histogram legend.

Installed versions

/usr/local/lib/python3.10/dist-packages/ipykernel/ipkernel.py:283: DeprecationWarning: `should_run_async` will not call `transform_cell` automatically in the future. Please pass the result to `transformed_cell` argument and any exception that happen during thetransform in `preprocessing_exc_tuple` in IPython 7.17 and above.
  and should_run_async(code)
<frozen importlib._bootstrap>:914: ImportWarning: APICoreClientInfoImportHook.find_spec() not found; falling back to find_module()
<frozen importlib._bootstrap>:914: ImportWarning: _PyDrive2ImportHook.find_spec() not found; falling back to find_module()
<frozen importlib._bootstrap>:914: ImportWarning: _PyDriveImportHook.find_spec() not found; falling back to find_module()
<frozen importlib._bootstrap>:914: ImportWarning: _OpenCVImportHook.find_spec() not found; falling back to find_module()
<frozen importlib._bootstrap>:914: ImportWarning: _BokehImportHook.find_spec() not found; falling back to find_module()
<frozen importlib._bootstrap>:914: ImportWarning: _AltairImportHook.find_spec() not found; falling back to find_module()

Selected Jupyter core packages...
buckaroo         : 0.4.2
jupyterlab       : not installed
notebook         : 6.5.5
ipywidgets       : 7.7.1
traitlets        : 5.7.1
jupyter_core     : 5.5.0
pandas           : 1.5.3
numpy            : 1.23.5
IPython          : 7.34.0
ipykernel        : 5.5.6
jupyter_client   : 6.1.12
jupyter_server   : 1.24.0
nbclient         : 0.9.0
nbconvert        : 6.5.4
nbformat         : 5.9.2
qtconsole        : not installed
buckaroo         : /usr/local/lib/python3.10/dist-packages/buckaroo/__init__.py
jupyterlab       : not installed
notebook         : /usr/local/lib/python3.10/dist-packages/notebook/__init__.py
ipywidgets       : /usr/local/lib/python3.10/dist-packages/ipywidgets/__init__.py
traitlets        : /usr/local/lib/python3.10/dist-packages/traitlets/__init__.py
jupyter_core     : /usr/local/lib/python3.10/dist-packages/jupyter_core/__init__.py
pandas           : /usr/local/lib/python3.10/dist-packages/pandas/__init__.py
numpy            : /usr/local/lib/python3.10/dist-packages/numpy/__init__.py
IPython          : /usr/local/lib/python3.10/dist-packages/IPython/__init__.py
ipykernel        : /usr/local/lib/python3.10/dist-packages/ipykernel/__init__.py
jupyter_client   : /usr/local/lib/python3.10/dist-packages/jupyter_client/__init__.py
jupyter_server   : /usr/local/lib/python3.10/dist-packages/jupyter_server/__init__.py
nbclient         : /usr/local/lib/python3.10/dist-packages/nbclient/__init__.py
nbconvert        : /usr/local/lib/python3.10/dist-packages/nbconvert/__init__.py
nbformat         : /usr/local/lib/python3.10/dist-packages/nbformat/__init__.py
qtconsole        : not installed

paddymul avatar Nov 10 '23 19:11 paddymul

np.inf is blank because of the following error. ColDisplayHints.summary(c['a'], pd.Series({'min': inf, 'max': inf, }), c['a']) # cannot convert float infinity to integer. type(np.inf) i.e np.inf is float type.If we convert it to int it throws the error. 14

nasrin1748 avatar Nov 12 '23 02:11 nasrin1748

JSON can't serialize infinity. Short of doing a replace on the dataframe before serialization which would be expensive. I think this has to wait on better DataFrame serialization

paddymul avatar Nov 15 '23 19:11 paddymul

Just tried this code.Hope it could be useful. 2 1

nasrin1748 avatar Nov 16 '23 11:11 nasrin1748