Describe the bug
Importing Lux breaks Seaborn.
To Reproduce
Generate histograms normally using Seaborn without importing Lux:
import pandas as pd
import seaborn as sns
BEERS = pd.read_csv('https://raw.githubusercontent.com/camillasancricca/DATADIQ/master/BEERS.csv')
sns.histplot(BEERS)
# Plot generated with no errors
importing Lux raises IndexError: Requested axis not found in manager:
import lux
import pandas as pd
import seaborn as sns
BEERS = pd.read_csv('https://raw.githubusercontent.com/camillasancricca/DATADIQ/master/BEERS.csv')
sns.histplot(BEERS)
# `IndexError` thrown
Expected behavior
Lux should not impact Seaborn plot generation.
Debugging information
Seaborn version 0.13.2
Package Versions
----------------
Version
python 3.12.6
lux 0.5.1
pandas 2.2.3
luxwidget 0.1.11
matplotlib 3.9.2
altair 5.4.1
IPython 8.28.0
ipykernel 6.29.5
ipywidgets 8.1.5
jupyter_client 8.6.3
jupyter_core 5.7.2
jupyter_server 2.14.2
jupyterlab 4.2.5
nbclient 0.10.0
nbconvert 7.16.4
nbformat 5.10.4
notebook 7.2.2
qtconsole not installed
traitlets 5.14.3
Widget Setup
-------------
✅ Jupyter Notebook Running
❌ Failed to run 'jupyter nbextension list'
❌ WARNING: luxwidget is not enabled in Jupyter Notebook.
You may need to run the following code in your command line:
jupyter nbextension install --py luxwidget
jupyter nbextension enable --py luxwidget
Additional context
Filing as a bug here rather than on Seaborn since the traceback shows the error being thrown by Pandas, which I assume would be due to some modification Lux makes to it.
Traceback:
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
Cell In[1], line 6
3 import seaborn as sns
5 BEERS = pd.read_csv('https://raw.githubusercontent.com/camillasancricca/DATADIQ/master/BEERS.csv')
----> 6 sns.histplot(BEERS)
File ~/Documents/Classes/3rd Semester/Data and Information Quality/Notebooks/.venv/lib/python3.12/site-packages/seaborn/distributions.py:1389, in histplot(data, x, y, hue, weights, stat, bins, binwidth, binrange, discrete, cumulative, common_bins, common_norm, multiple, element, fill, shrink, kde, kde_kws, line_kws, thresh, pthresh, pmax, cbar, cbar_ax, cbar_kws, palette, hue_order, hue_norm, color, log_scale, legend, ax, **kwargs)
1386 if ax is None:
1387 ax = plt.gca()
-> 1389 p._attach(ax, log_scale=log_scale)
1391 if p.univariate: # Note, bivariate plots won't cycle
1392 if fill:
File ~/Documents/Classes/3rd Semester/Data and Information Quality/Notebooks/.venv/lib/python3.12/site-packages/seaborn/_base.py:1128, in VectorPlotter._attach(self, obj, allowed_types, log_scale)
1126 # Now actually update the matplotlib objects to do the conversion we want
1127 grouped = self.plot_data[var].groupby(self.converters[var], sort=False)
-> 1128 for converter, seed_data in grouped:
1129 if self.var_types[var] == "categorical":
1130 if self._var_ordered[var]:
File ~/Documents/Classes/3rd Semester/Data and Information Quality/Notebooks/.venv/lib/python3.12/site-packages/pandas/core/groupby/ops.py:620, in BaseGrouper.get_iterator(self, data, axis)
618 splitter = self._get_splitter(data, axis=axis)
619 keys = self.group_keys_seq
--> 620 yield from zip(keys, splitter)
File ~/Documents/Classes/3rd Semester/Data and Information Quality/Notebooks/.venv/lib/python3.12/site-packages/pandas/core/groupby/ops.py:1160, in DataSplitter.__iter__(self)
1157 starts, ends = lib.generate_slices(self._slabels, self.ngroups)
1159 for start, end in zip(starts, ends):
-> 1160 yield self._chop(sdata, slice(start, end))
File ~/Documents/Classes/3rd Semester/Data and Information Quality/Notebooks/.venv/lib/python3.12/site-packages/pandas/core/groupby/ops.py:1186, in FrameSplitter._chop(self, sdata, slice_obj)
1180 def _chop(self, sdata: DataFrame, slice_obj: slice) -> DataFrame:
1181 # Fastpath equivalent to:
1182 # if self.axis == 0:
1183 # return sdata.iloc[slice_obj]
1184 # else:
1185 # return sdata.iloc[:, slice_obj]
-> 1186 mgr = sdata._mgr.get_slice(slice_obj, axis=1 - self.axis)
1187 df = sdata._constructor_from_mgr(mgr, axes=mgr.axes)
1188 return df.__finalize__(sdata, method="groupby")
File ~/Documents/Classes/3rd Semester/Data and Information Quality/Notebooks/.venv/lib/python3.12/site-packages/pandas/core/internals/managers.py:1978, in SingleBlockManager.get_slice(self, slobj, axis)
1974 def get_slice(self, slobj: slice, axis: AxisInt = 0) -> SingleBlockManager:
1975 # Assertion disabled for performance
1976 # assert isinstance(slobj, slice), type(slobj)
1977 if axis >= self.ndim:
-> 1978 raise IndexError("Requested axis not found in manager")
1980 blk = self._block
1981 array = blk.values[slobj]
IndexError: Requested axis not found in manager
Describe the bug
Importing Lux breaks Seaborn.
To Reproduce
Generate histograms normally using Seaborn without importing Lux:
importing Lux raises
IndexError: Requested axis not found in manager:Expected behavior
Lux should not impact Seaborn plot generation.
Debugging information
Seaborn version
0.13.2Additional context
Filing as a bug here rather than on Seaborn since the traceback shows the error being thrown by Pandas, which I assume would be due to some modification Lux makes to it.
Traceback: