Cannot resolve column (numeric column name) in Spark Dataframe

后端 未结 2 1074
离开以前
离开以前 2020-12-29 11:33

This is my data:

scala> data.printSchema
root
 |-- 1.0: string (nullable = true)
 |-- 2.0: string (nullable = true)
 |-- 3.0: string (nullable = true)
         


        
2条回答
  •  情书的邮戳
    2020-12-29 11:59

    You can use backticks to escape the dot, which is reserved for accessing columns for struct type:

    data.select("`2.0`").show
    +---+
    |2.0|
    +---+
    | , |
    +---+
    

提交回复
热议问题