Skip to content

Commit 93d28f3

Browse files
committed
slightly faster AxisCollection.combine_axes
1 parent 6168ded commit 93d28f3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

larray/core/axis.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2904,9 +2904,9 @@ def combine_axes(self, axes=None, sep='_', wildcard=False, front_if_spread=False
29042904
# Q: if axis is a wildcard axis, should the result be a wildcard axis (and axes_labels discarded?)
29052905
combined_labels = _axes[0].labels
29062906
else:
2907-
combined_labels = [sep.join(str(l) for l in p)
2908-
for p in product(*_axes.labels)]
2909-
2907+
sepjoin = sep.join
2908+
axes_labels = [np.array(l, np.str, copy=False) for l in _axes.labels]
2909+
combined_labels = [sepjoin(p) for p in product(*axes_labels)]
29102910
combined_axis = Axis(combined_labels, combined_name)
29112911
new_axes = new_axes - _axes
29122912
new_axes.insert(combined_axis_pos, combined_axis)

0 commit comments

Comments
 (0)