Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python vectorize

import numpy as np

# array
a = np.array(["a b c", "d e f", "h i j"])

# function
replace_space = np.vectorize(lambda x: x.replace(" ", "_"))

# response
print(replace_space(a))

# will return: ['a_b_c' 'd_e_f' 'h_i_j']
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #vectorize
ADD COMMENT
Topic
Name
5+8 =