Skip to content

Commit 04dd8be

Browse files
committed
PERF: use unique_list() instead of list(unique())
1 parent 4e71496 commit 04dd8be

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

larray/core/group.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99

1010
from larray.core.abstractbases import ABCAxis, ABCAxisReference, ABCArray
1111
from larray.util.oset import OrderedSet
12-
from larray.util.misc import (unique, find_closing_chr, _parse_bound, _seq_summary, _isintstring, renamed_to, LHDFStore)
12+
from larray.util.misc import (unique_list, find_closing_chr, _parse_bound, _seq_summary, _isintstring, renamed_to,
13+
LHDFStore)
1314

1415

1516
def _slice_to_str(key, repr_func=str):
@@ -694,7 +695,7 @@ def union(*args):
694695
['a', 'b', 'c', 'd', 'e', 'f', 0, 1, 2]
695696
"""
696697
if args:
697-
return list(unique(chain(*(_to_ticks(arg) for arg in args))))
698+
return unique_list(chain(*(_to_ticks(arg) for arg in args)))
698699
else:
699700
return []
700701

larray/inout/pandas.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from larray.core.array import Array
77
from larray.core.axis import Axis, AxisCollection
88
from larray.core.constants import nan
9-
from larray.util.misc import unique
9+
from larray.util.misc import unique_list
1010

1111

1212
def decode(s, encoding='utf-8', errors='strict'):
@@ -48,7 +48,7 @@ def index_to_labels(idx, sort=True):
4848
if sort:
4949
return list(idx.levels)
5050
else:
51-
return [list(unique(idx.get_level_values(label))) for label in range(idx.nlevels)]
51+
return [unique_list(idx.get_level_values(label)) for label in range(idx.nlevels)]
5252
else:
5353
assert isinstance(idx, pd.Index)
5454
labels = list(idx.values)

0 commit comments

Comments
 (0)