I have a python list which is derived from a pandas series as follows:
dsa = pd.Series(crew_data['Work Type'])
disc = [dsa]
print(disc)
The output is as follows:
[0 Disc - Standard Removal & Herbicide
1 Disc - Standard Removal & Herbicide
2 Standard Trim
3 Disc - Hazard Tree
4 Disc - Hazard Tree
...
134 Disc - Hazard Tree
135 Disc - Hazard Tree
136 Disc - Hazard Tree
137 Disc - Hazard Tree
138 Disc - Hazard Tree
Name: Work Type, Length: 139, dtype: object]
Now the next step is to slice the first 4 characters of each element so that the value returned is Disc
This appears to be simple when performed on a single string, however when attempting to do this with a list for some reason appears to be almost impossible. This can be done simply in Excel using the formula =LEFT(A1,4), so surely it can be done as simple in python?
If anyone has a solution that would be great.