这是熊猫数组:
id text spam
4016 Subject: re : vacation vince : i just found ... 0
4017 Subject: re : receipts from visit jim , than... 0
4018 Subject: re : enron case study update wow ! a...0
4019 Subject: re : interest david , please , call... 0
4020 Subject: news : aurora 5 . 2 update aurora ve...0
我想从所有行中删除“文本”列中的“主题”一词,使其变为:
id text spam
4016 re : vacation vince : i just found ... 0
4017 re : receipts from visit jim , than... 0
4018 re : enron case study update wow ! a...0
4019 re : interest david , please , call... 0
4020 news : aurora 5 . 2 update aurora ve...0
试试这个:
df.text = df.text.apply(lambda row: row[9:])
每行将在“text”列中更改,其中前 9 个字符“Subject:”被删除。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句