未定义Pyspark StructType [英] Pyspark StructType is not defined

查看:407
本文介绍了未定义Pyspark StructType的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试构建用于数据库测试的架构,而StructType显然由于某种原因而无法正常工作.我正在学习,它不会导入任何额外的模块.

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>)

我使用的是Spark 1.4.0,如果有问题,请使用Ubuntu 12.我该如何解决这个问题?预先谢谢你.

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.

推荐答案

您导入了StructType吗?如果不是

from pyspark.sql.types import StructType

应该解决问题.

这篇关于未定义Pyspark StructType的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆