不能select几栏
Cannot select a few columns
import pyspark.sql.functions as F
file_list = [ i.path for i in dbutils.fs.ls("/location/01/01/01/01/") ]
df = spark.read.json(file_list)
test_df = df.select(F.col('card_1.card_type'))
test_df.show()
我收到此错误消息
Column 'card_1.card_type' does not exist. Did you mean one of the following? [card_1.card_type, card_1.name, ... ]
谁能告诉我如何解决这个问题?
我认为添加反引号 ` 可以解决您的问题:
test_df = df.select(F.col('`card_1.card_type`'))
import pyspark.sql.functions as F
file_list = [ i.path for i in dbutils.fs.ls("/location/01/01/01/01/") ]
df = spark.read.json(file_list)
test_df = df.select(F.col('card_1.card_type'))
test_df.show()
我收到此错误消息
Column 'card_1.card_type' does not exist. Did you mean one of the following? [card_1.card_type, card_1.name, ... ]
谁能告诉我如何解决这个问题?
我认为添加反引号 ` 可以解决您的问题:
test_df = df.select(F.col('`card_1.card_type`'))