data = pd.DataFrame({ 'Long Title' :
Stand-Up: "Weird Al" Yankovic, Stand-Up: "Weird Al",Yankovic HD,
Rampage4Real: Opening Round,
Rampage4Real: Opening Round HD,
Hashtag Wars S1,
Hashtag Wars S1 HD,
Best of Season})
def func(value):
if value.str.contains(":"):
return value
data["LongTitleAdjusted"] = data["Long Title"].apply(func)
我正在接受这个错误:
AttributeError: 'unicode' object has no attribute 'str'
所以我一直在尝试将系列转换为字符串数据类型,但即使在编码时“忽略”,也会一直收到此错误:
'ascii' codec can't encode character u'\u2019' in position 16: ordinal not in range(128)