Skip to content

Commit

Permalink
chore: assert df index is unique before generating hash ID column (#644)
Browse files Browse the repository at this point in the history
  • Loading branch information
nayib-jose-gloria authored Sep 26, 2023
1 parent 0cefd85 commit 40d56c8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cellxgene_schema_cli/cellxgene_schema/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,10 @@ def get_hash_digest_column(dataframe):
"""
Get column with hash digest for each row in dataframe.
"""

df_index = dataframe.index.to_series()
assert df_index.is_unique
return (
dataframe.index.to_series()
.map(xxh3_64_intdigest)
df_index.map(xxh3_64_intdigest)
.astype(np.uint64)
.apply(lambda v: b85encode(v.to_bytes(8, "big")).decode("ascii"))
)

0 comments on commit 40d56c8

Please sign in to comment.