Pyspark StructType is not defined

两盒软妹~` 提交于 2020-01-13 07:31:23

问题


I'm trying to struct a schema for db testing, and StructType apparently isn't working for some reason. I'm following a tut, and it doesn't import any extra module.

<type 'exceptions.NameError'>, NameError("name 'StructType' is not defined",), <traceback object at 0x2b555f0>)

I'm on spark 1.4.0, and Ubuntu 12 if that has anything to do with the problem. How would I fix this problem? Thank you in advance.


回答1:


Did you import StructType? If not

from pyspark.sql.types import StructType

should solve the problem.



来源:https://stackoverflow.com/questions/30905515/pyspark-structtype-is-not-defined

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!