我有一个数据框 all_data,地址列的标题已粘贴在下面。
all_data['Address'].head()
0 Brocklebank Ground, Torver, LA21 8BS
1 23 Leigh Street, Aspull, WN2 1QQ
2 Dewsland, Ponthenry Road, Pontyates, SA15 5TY
3 1 Croft Close, Wainfleet, PE24 4DT
4 3 Landor Avenue, Killay, SA2 7BP
Name: Address, dtype: object
我正在尝试仅提取邮政编码以将其放入新列中:
all_data['Postcode'] = all_data['Address'].str.split(',')[-1]
我收到以下错误消息:
ValueError: Length of values does not match length of index
我应该怎么做?
翻过高山走不出你
烙印99
相关分类