Viewing the content of a Spark Dataframe Column

You can access underlying RDD and map over it

df.rdd.map(lambda r: r.zip_code).collect()

You can also use select if you don’t mind results wrapped using Row objects:

df.select('zip_code').collect()

Finally, if you simply want to inspect content then show method should be enough:

df.select('zip_code').show()

You can simply write:

df.select('your column's name').show()

In your case here, it will be:

df.select('zip_code').show()

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)