I have a got a list of Post Codes that I would like to return just the first part of it.
postcodes = list(df['postcode'][0:10])
['EC4V 3EJ', 'SE1 9DW', 'W12 7EY', 'E14 9GA', 'E17 8ES', 'N10 3LR', 'W2 2RH', 'W3 7ST', 'W2 1PW', 'W4 5RG']
for p in postcodes:
postcodes.append(p.split()[0])
postcodes
I was expecting to get something like:
['EC4V', 'SE1', 'W12', 'E14' ...]
but my kernel keeps looping and it doesn't return anything.