A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://api-docs.databricks.com/python/pyspark/latest/pyspark.sql/api/pyspark.sql.Row.asDict.html below:

pyspark.sql.Row.asDict — PySpark master documentation

pyspark.sql.Row.asDict¶
Row.asDict(recursive: bool = False) → Dict[str, Any]¶

Return as a dict

Parameters
recursivebool, optional

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