numpy string operations | join() function
numpy.core.defchararray.join(sep, arr)
is another function for doing string operations in numpy. For each element in arr, it returns a copy of the string in which the string elements of array have been joined by 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 # importing numpy import numpy as geek # input array in_arr = geek.array([ 'Python' , 'Numpy' , 'Pandas' ]) print ( "Input original array : " , in_arr) # creating the separator sep = geek.array([ '-' , '+' , '*' ]) out_arr = geek.core.defchararray.join(sep, in_arr) print ( "Output joined array: " , out_arr) |
chevron_right
filter_none
Output:
Input original array : ['Python' 'Numpy' 'Pandas'] Output joined array: ['P-y-t-h-o-n' 'N+u+m+p+y' 'P*a*n*d*a*s']
Recommended Posts:
- numpy string operations | less() function
- numpy string operations | rsplit() function
- numpy string operations | split() function
- numpy string operations | isdigit() function
- numpy string operations | index() function
- numpy string operations | isspace() function
- numpy string operations | swapcase() function
- numpy string operations | isalpha() function
- numpy string operations | rjust() function
- numpy string operations | ljust() function
- numpy string operations | translate() function
- numpy string operations | isnumeric() function
- numpy string operations | count() function
- numpy string operations | istitle() function
- numpy string operations | find() function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.