ValueError: Some of types cannot be determined by the first 100 rows, please try again with sampling
Resolutions:
1.Improve sample ratio, e.g.
sqlContext.createDataFrame(rdd, samplingRatio=0.2)
2.Tell spark the explicit schema, e.g.
from pyspark.sql.types import *
schema = StructType([
StructField("column_1", StringType(), True),
StructField("column_2", IntegerType(), True)
])
df = sqlContext.createDataFrame(rdd, schema=schema)
本文介绍了解决PySpark中出现ValueError异常的方法,包括提高采样率和显式指定模式等两种途径,帮助开发者有效处理数据帧创建过程中的类型确定问题。
7万+

被折叠的 条评论
为什么被折叠?



