【发布时间】:2014-11-15 15:56:32
【问题描述】:
我需要使用scala根据列为每一行创建映射,例如,
sunny,hot,high,FALSE,no
overcast,hot,high,FALSE,yes
rainy,mild,high,FALSE,yes
我想输出为,
RDD[List(
Map(
'0 -> 'sunny,
'1 -> 'hot,
'2 -> 'high,
'3 -> 'false,
'4 -> 'no
),
Map(
'0 -> 'overcast,
'1 -> 'hot,
'2 -> 'high,
'3 -> 'false,
'4 -> 'yes
),
Map(
'0 -> 'rainy,
'1 -> 'mild,
'2 -> 'high,
'3 -> 'false,
'4 -> 'yes
)
)]
这里我们考虑每一列,列号是键,列值是键值对中的值。
【问题讨论】:
标签: scala