Just select and select:
result = users_df.where(users_df._id == chosen_user).select("gender")
or with col
from pyspark.sql.functions import col result = users_df.where(col("_id") == chosen_user).select(col("gender"))
Finally, PySpark Row
is just a tuple
with some extensions, so you can, for example, flatMap
:
result.rdd.flatMap(list).first()
or map
with something like this:
result.rdd.map(lambda x: x.gender).first()
source share