Row.
asDict
Return as a dict
turns the nested Rows to dict (default: False).
Notes
If a row contains duplicate field names, e.g., the rows of a join between two DataFrame that both have the fields of same names, one of the duplicate fields will be selected by asDict. __getitem__ will also return one of the duplicate fields, however returned value might be different to asDict.
DataFrame
__getitem__
Examples
>>> Row(name="Alice", age=11).asDict() == {'name': 'Alice', 'age': 11} True >>> row = Row(key=1, value=Row(name='a', age=2)) >>> row.asDict() == {'key': 1, 'value': Row(name='a', age=2)} True >>> row.asDict(True) == {'key': 1, 'value': {'name': 'a', 'age': 2}} True