Skip to content

Commit

Permalink
Merge 9326302 into 82bc087
Browse files Browse the repository at this point in the history
  • Loading branch information
jnothman committed Jan 5, 2023
2 parents 82bc087 + 9326302 commit 11f1715
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ What's new in version 0.8
- Allowed ``show_percentages`` to be provided with a custom formatting string,
for example to show more decimal places. (:issue:`194`)
- Added `subsets` attribute to QueryResult. (:issue:`198`)
- Fixed a bug where more than 64 categories could result in an error. (:issue:`193`)

What's new in version 0.7
-------------------------
Expand Down
4 changes: 3 additions & 1 deletion upsetplot/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ def _process_data(df, sort_by, sort_categories_by, subset_size,
# XXX: ugly!
def _pack_binary(X):
X = pd.DataFrame(X)
out = 0
# use objects if arbitrary precision integers are needed
dtype = np.object_ if X.shape[1] > 62 else np.uint64
out = pd.Series(0, index=X.index, dtype=dtype)
for i, (_, col) in enumerate(X.items()):
out *= 2
out += col
Expand Down
12 changes: 12 additions & 0 deletions upsetplot/tests/test_upsetplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -915,3 +915,15 @@ def test_style_subsets_artists(orientation):

# TODO: check lines between dots
# matrix_line_collection = upset_axes["matrix"].collections[1]


def test_many_categories():
# Tests regressions against GH#193
n_cats = 250
index1 = [True, False] + [False] * (n_cats - 2)
index2 = [False, True] + [False] * (n_cats - 2)
columns = [chr(i + 33) for i in range(n_cats)]
data = pd.DataFrame([index1, index2], columns=columns)
data["value"] = 1
data = data.set_index(columns)["value"]
UpSet(data)

0 comments on commit 11f1715

Please sign in to comment.