The string
package is useful for stripping punctuation from individual strings as demonstrated below:
import string
stripPunct = str.maketrans('', '', string.punctuation)
word = 'foo.bar.baz'
word.translate(stripPunct)
Output: 'foobarbaz'
But what is the method to apply this exact same method to every string in a numpy array of strings?
myArr = np.array(['foo.bar.baz', 'foo.bar.baz', 'foo.bar.baz'], dtype='<U15')
myArr.translate(stripPunct)
AttributeError: 'numpy.ndarray' object has no attribute 'translate'