Skip to content

Pandas v1.3.0 [BREAKING CHANGE]: Pandas indexing changed -> expected list, got FrozenList #141

@G-kodes

Description

@G-kodes

I am unable to run the package at all. At first, I thought it was my data, but even when I changed my generation methods to those indicated in the docs, I still got the same error message.

I am running a Mambaforge implementation if it means anything (Packages all installed fine?). From what I can tell, the upsetplot function plot_matrix() in plotting.py (Link Below) attempts to use pandas column/indices selection (i.e. data[column-name]) which is not designed to take a FrozenList instance, which is what data.index.names returns?

https://github.com/jnothman/UpSetPlot/blob/master/upsetplot/plotting.py#L536

What I ran:

from upsetplot import plot, generate_counts

plot(generate_counts())

The Error I received:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
d:\GitHub\Pharmacogenetics-Snakemake\workflow\scripts\04 - GRAPHS.py in <module>
----> 1 plot(generate_counts())

D:\mambaforge\envs\snakemake\lib\site-packages\upsetplot\plotting.py in plot(data, fig, **kwargs)
    715         Keys are 'matrix', 'intersections', 'totals', 'shading'
    716     """
--> 717     return UpSet(data, **kwargs).plot(fig)

D:\mambaforge\envs\snakemake\lib\site-packages\upsetplot\plotting.py in plot(self, fig)
    669         matrix_ax = self._reorient(fig.add_subplot)(specs['matrix'],
    670                                                     sharey=shading_ax)
--> 671         self.plot_matrix(matrix_ax)
    672         totals_ax = self._reorient(fig.add_subplot)(specs['totals'],
    673                                                     sharey=matrix_ax)

D:\mambaforge\envs\snakemake\lib\site-packages\upsetplot\plotting.py in plot_matrix(self, ax)
    502         n_cats = data.index.nlevels
    503 
--> 504         idx = np.flatnonzero(data.index.to_frame()[data.index.names].values)
    505         c = np.array(['lightgrey'] * len(data) * n_cats, dtype='O')
    506         c[idx] = self._facecolor

D:\mambaforge\envs\snakemake\lib\site-packages\pandas\core\frame.py in __getitem__(self, key)
   3443 
   3444         # Do we have a (boolean) 1d indexer?
-> 3445         if com.is_bool_indexer(key):
   3446             return self._getitem_bool_array(key)
   3447 

D:\mambaforge\envs\snakemake\lib\site-packages\pandas\core\common.py in is_bool_indexer(key)
    144     elif isinstance(key, list):
    145         # check if np.array(key).dtype would be bool
--> 146         return len(key) > 0 and lib.is_bool_list(key)
    147 
    148     return False

TypeError: Argument 'obj' has incorrect type (expected list, got FrozenList)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions