Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from functools import reduce
- import numpy as np
- def mor(x):
- """x: iterable of np.array."""
- return reduce(np.logical_or, x)
- def mand(x):
- """x: iterable of np.array."""
- return reduce(np.logical_and, x)
- def madd(x):
- """Performs element-wise string concatenation with multiple input arrays.
- Args:
- x: iterable of np.array.
- Returns: np.array.
- """
- for i, arr in enumerate(x):
- if type(arr.item(0)) is not str:
- x[i] = x[i].astype(str)
- return reduce(np.core.defchararray.add, x)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement