operations with empty strings | join () function

numpy.core.defchararray.join (sep, arr) — another function to do string operations in numpy. For each element in arr, it returns a copy of the string where the string elements of the array were concatenated by the separator.

Parameters:
sep: It joins elements with the string between them.
arr: Input array.

Returns: Output array of str or unicode with joined elements.

Code # 1:

# Python program explaining
# numpy.core.defchararray.join () method

 
# numpy import

import numpy as geek

 
# input array

in_arr = geek.array ([ ` Python` , `Numpy` , ` Pandas` ])

print ( "Input original array:" , in_arr) 

 
# create separator

sep = geek.array ([ `-` , `+` , `*` ])

 

 

out_arr = geek.c ore.defchararray.join (sep, in_arr)

print ( "Output joined array:" , out_arr) 

Output :

 Input original array: [`Python`` Numpy` `Pandas`] Output joined array: [` Python` `N + u + m + p + y,, P * a * n * d * a * s`]