splitMessage = pd.DataFrame(array_data)
splitMessage = splitMessage
print(splitMessage)
75 [repair, materials, rub]
76 [food, pizza, rub]
77 [services, delivery, rub]
78 [donation, donation, usd]
79 [repair, work, rub]
80 [coffee]
81 [lunch, rub]
82 [lunch]
83 [dentist]
我需要
[rub]
[rub]
[rub]
[usd]
[rub]
[coffe]
...
答案 0 :(得分:0)
如果数据框列中的每个元素都是一个列表,则可以使用以下命令获取最后一个元素:
splitMessage[column_name].apply(lambda x: x[-1])
如果您需要将输出列出,请使用:
splitMessage[column_name].apply(lambda x: list(x[-1]))