AttributeError: 'numpy.ndarray' object has no attribute 'split'

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

AttributeError: 'numpy.ndarray' object has no attribute 'split'

问题相关代码,请勿粘贴截图

max_document_length = max([len(x.split(" ")) for x in x_data])
vocab_processor = learn.preprocessing.VocabularyProcessor(max_document_length)

运行结果及报错内容

AttributeError: 'numpy.ndarray' object has no attribute 'split'

我的解答思路和尝试过的方法
我想要达到的结果

max([len(x.split(" ")) for x in x_data]),你的x的数据类型可能是numpy,她是没有.split属性的,你把x转换为字符串,如str(x)

x_data是什么,是frame吗
报错说x是numpy.ndarray,
而你把x当做字符串在用了