I have a Spark DataFrame built through pyspark from a JSON file as
sc = SparkContext()
sqlc = SQLContext(sc)
users_df = sqlc.read.json('users.json')
Now, I want to access a chosen_user data, where this is its _id field. I can do
print users_df[users_df._id == chosen_user].show()
and this gives me the full Row of the user. But suppose I just want one specific field in the Row, say the user gender, how would I obtain it?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…