Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError: cannot specify integer bins when input data contains infinity [BUG] #440

Closed
flppgg opened this issue Dec 20, 2021 · 2 comments · Fixed by #442
Closed

ValueError: cannot specify integer bins when input data contains infinity [BUG] #440

flppgg opened this issue Dec 20, 2021 · 2 comments · Fixed by #442
Assignees
Labels
bug Something isn't working easy Easy to fix; Good issues for newcomers

Comments

@flppgg
Copy link

flppgg commented Dec 20, 2021

Trying to open a dataframe from a .csv that contains numpy.inf values fails with this error:

import lux, pandas
df = pandas.read_csv('filepath')
C:\Users\???\anaconda\envs\base_up_to_date\lib\site-packages\IPython\core\formatters.py:918: UserWarning:
Unexpected error in rendering Lux widget and recommendations. Falling back to Pandas display.
Please report the following issue on Github: https://github.com/lux-org/lux/issues 

C:\Users\???\anaconda\envs\base_up_to_date\lib\site-packages\lux\core\frame.py:632: UserWarning:Traceback (most recent call last):
  File "C:\Users\???\anaconda\envs\base_up_to_date\lib\site-packages\lux\core\frame.py", line 594, in _ipython_display_
    self.maintain_recs()
  File "C:\Users\???\anaconda\envs\base_up_to_date\lib\site-packages\lux\core\frame.py", line 436, in maintain_recs
    custom_action_collection = custom_actions(rec_df)
  File "C:\Users\???\anaconda\envs\base_up_to_date\lib\site-packages\lux\action\custom.py", line 76, in custom_actions
    recommendation = lux.config.actions[action_name].action(ldf)
  File "C:\Users\???\anaconda\envs\base_up_to_date\lib\site-packages\lux\action\correlation.py", line 50, in correlation
    vlist = VisList(intent, ldf)
  File "C:\Users\???\anaconda\envs\base_up_to_date\lib\site-packages\lux\vis\VisList.py", line 43, in __init__
    self.refresh_source(self._source)
  File "C:\Users\???\anaconda\envs\base_up_to_date\lib\site-packages\lux\vis\VisList.py", line 336, in refresh_source
    lux.config.executor.execute(self._collection, ldf, approx=approx)
  File "C:\Users\???\anaconda\envs\base_up_to_date\lib\site-packages\lux\executor\PandasExecutor.py", line 146, in execute
    PandasExecutor.execute_2D_binning(vis)
  File "C:\Users\???\anaconda\envs\base_up_to_date\lib\site-packages\lux\executor\PandasExecutor.py", line 387, in execute_2D_binning
    vis._vis_data["xBin"] = pd.cut(vis._vis_data[x_attr], bins=lux.config.heatmap_bin_size)
  File "C:\Users\???\anaconda\envs\base_up_to_date\lib\site-packages\pandas\core\reshape\tile.py", line 244, in cut
    "cannot specify integer `bins` when input data contains infinity"
ValueError: cannot specify integer `bins` when input data contains infinity
@flppgg
Copy link
Author

flppgg commented Dec 21, 2021

simply setting
pandas.set_option('mode.use_inf_as_na', True)
solves the issue for the user, but I don't know how this can be solved in lux

@dorisjlee
Copy link
Member

Thanks @flppgg! It looks like this issue comes up when we try to plot a binned histogram when the data contains inf. We'll look into fixing this issue!

@dorisjlee dorisjlee added bug Something isn't working easy Easy to fix; Good issues for newcomers labels Jan 3, 2022
cgarciae added a commit to Quansight/lux that referenced this issue Jan 6, 2022
Signed-off-by: Cristian Garcia <cgarcia.e88@gmail.com>
cgarciae added a commit that referenced this issue Jan 6, 2022
Signed-off-by: Cristian Garcia <cgarcia.e88@gmail.com>
cgarciae added a commit that referenced this issue Jan 6, 2022
Signed-off-by: Cristian Garcia <cgarcia.e88@gmail.com>
dorisjlee added a commit that referenced this issue Jan 13, 2022
…ap (#442)

* FIX-#440: replace infs with nans

Signed-off-by: Cristian Garcia <cgarcia.e88@gmail.com>

* Change test name

Co-authored-by: Doris Lee <dorisjunglinlee@gmail.com>

* remove ignore format option on PandasExecutor.py

Co-authored-by: Doris Lee <dorisjunglinlee@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working easy Easy to fix; Good issues for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants