【发布时间】:2021-03-15 22:38:11
【问题描述】:
所以,我在 Spark(scala) 中有 2 个列表。它们都包含相同数量的值。第一个列表a 包含所有字符串,第二个列表b 包含所有Long。
a: List[String] = List("a", "b", "c", "d")
b: List[Long] = List(17625182, 17625182, 1059731078, 100)
我还有一个模式定义如下:
val schema2=StructType(
Array(
StructField("check_name", StringType, true),
StructField("metric", DecimalType(38,0), true)
)
)
将我的列表转换为单个数据框的最佳方法是什么,该数据框具有架构 schema2 并且列分别由 a 和 b 组成?
【问题讨论】:
标签: scala dataframe apache-spark