nxcals.api.extraction.data.builders.DataFrame.first

DataFrame.first() Optional[Row]

Returns the first row as a Row.

New in version 1.3.0.

Changed in version 3.4.0: Supports Spark Connect.

Returns:

First row if DataFrame is not empty, otherwise None.

Return type:

Row

Examples

>>> df = spark.createDataFrame([
...     (2, "Alice"), (5, "Bob")], schema=["age", "name"])
>>> df.first()
Row(age=2, name='Alice')