I am using the Python API of Spark version 1.4.1.
My row object looks like this :
row_info = Row(name = Tim, age = 5, is_subscribed = false)
How can I get as a result, a list of the object attributes ?
Something like : ["name", "age", "is_subscribed"]
If you don't care about the order you can simply extract these from a dict
:
list(row_info.asDict())
otherwise the only option I am aware of is using __fields__
directly:
row_info.__fields__