1 "1-D Array For example, [2, 3] would, for axis=0, result in
2
3ary[:2]
4
5ary[2:3]
6
7ary[3:]
1# Split string inside numpay array
2import numpy as np
3
4# In this case I want to remove everything before " – "
5# to stay only with --> "I have a friendly staff", "Friendly staff advice for..."
6
7array = ['Linda Rodway – I have a friendly staff',
8 'Kevin Ransom – Friendly staff advice for...']
9
10# Create numpy array
11a = np.array(array)
12# Now you can split using .split method and loop through all inside a
13b = np.array([x.split(' – ')[1] for x in a])
14
15# in this case if you remove [1] you will see the following result:
16# 'Linda Rodway', 'I have a friendly staff', and you use [1] to show only
17# the second one 'I have a friendly staff'
18