Row.
asDict
(recursive: bool = False) → Dict[str, Any]¶
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
.
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
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4