对dataframe用literal_eval报错SyntaxError: unexpected EOF while parsing,如何解决?

问题遇到的现象和发生背景

想把电影字符串类型的数据转化为python objectives

问题相关代码,请勿粘贴截图
# Convert the stringified objects into the native python objects
from ast import literal_eval

features = ['cast', 'crew', 'keywords', 'genres']
for feature in features:
    df[feature] = df[feature].apply(literal_eval)
运行结果及报错内容

img

img

我的解答思路和尝试过的方法

试了.dropna()也不行

我想要达到的结果

求解答,谢谢~

出现无法解析的错误,检查原数据是不是没有完整的标记结束符,比如字符串结尾是不是漏掉了}}等符号。
还可以试试用json.loads()来处理。
https://www.cnblogs.com/yoyoketang/p/9319829.html

是不是应该这么用

df[feature] = df[feature].apply(lambda x : literal_eval(x))