Skip to content

Commit

Permalink
Reduce overhead of to_series call
Browse files Browse the repository at this point in the history
  • Loading branch information
InnovativeInventor committed May 18, 2022
1 parent daffd15 commit 8c34a91
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions gerrychain/partition/assignment.py
Expand Up @@ -92,10 +92,7 @@ def update_parts(self, new_parts):

def to_series(self):
"""Convert the assignment to a :class:`pandas.Series`."""
groups = [
pandas.Series(data=part, index=nodes) for part, nodes in self.parts.items()
]
return pandas.concat(groups)
return pandas.Series(self.mapping, dtype="uint32")

def to_dict(self):
"""Convert the assignment to a ``{node: part}`` dictionary."""
Expand Down

0 comments on commit 8c34a91

Please sign in to comment.