老师,我读取了一个csv文件var data = spark.read.option("header", "true").format("csv").load("D:\\train.csv")
但是读进来以后数据是String类型的,怎么将数据变成Int类型
printSchema是这样的root
|-- label: string (nullable = true)
|-- pixel0: string (nullable = true)
|-- pixel1: string (nullable = true)
|-- pixel2: string (nullable = true)
|-- pixel3: string (nullable = true)
|-- pixel4: string (nullable = true)
|-- pixel5: string (nullable = true)
|-- pixel6: string (nullable = true)
|-- pixel7: string (nullable = true)
|-- pixel8: string (nullable = true)
|-- pixel9: string (nullable = true)
|-- pixel10: string (nullable = true)
|-- pixel11: string (nullable = true)
|-- pixel12: string (nullable = true)
|-- pixel13: string (nullable =