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

[BUG] LuxSeries.unique returns incorrect values after subsetting #467

Open
lukauskas opened this issue Mar 15, 2022 · 1 comment
Open

[BUG] LuxSeries.unique returns incorrect values after subsetting #467

lukauskas opened this issue Mar 15, 2022 · 1 comment
Assignees

Comments

@lukauskas
Copy link

Describe the bug

LuxSeries wrapper around pandas Series, does not compute the unique values correctly for series corresponding to subsets of dataframe.

To Reproduce

Invent some data:

data = pd.DataFrame([['a', 1, 2], ['b', 2, 3], ['c', -1, 17]], columns=['foo', 'bar', 'baz'])

View it, no need to click on the lux button or anything.

data

Now create a subset of this data from bar > 0 and select foo column only.

data = data[data['bar'] > 0]['foo']

data is now a Series with two values in it 'a' and 'b'.
In the notebook I view it again and it produces the correct output, no need to click anything:

data

However running the .unique() function on the series:

data.unique()

Returns all values including ['a', 'b', 'c'], when it should forget about the value 'c' due to subsetting.

See gist and screenshot below

Expected behavior

data.unique() should return only ['a', 'b'].

Screenshots

image

Debugging information

Package Versions
----------------
               Version
        python 3.10.2 
           lux  0.5.1 
        pandas  1.4.0 
     luxwidget 0.1.11 
    matplotlib  3.5.1 
        altair  4.2.0 
       IPython  8.0.1 
     ipykernel  6.9.0 
    ipywidgets  7.6.5 
jupyter_client  7.1.2 
  jupyter_core  4.9.1 
jupyter_server 1.13.5 
    jupyterlab  3.3.0 
      nbclient 0.5.10 
     nbconvert  6.4.1 
      nbformat  5.1.3 
      notebook  6.4.8 
     qtconsole  5.2.2 
     traitlets  5.1.1 

Widget Setup
-------------
✅ Jupyter Lab Running
✅ luxwidget is enabled

Additional context

This actually can cause some very nasty and silent errors in the analyses that depend on this .unique() operator, as only the import of lux is needed to redefine behaviour.

@dorisjlee
Copy link
Member

dorisjlee commented Mar 20, 2022

Thanks for your detailed issue report @lukauskas! We will be looking into this issue soon!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants