DataFrame.
first
Returns the first row as a Row.
Row
New in version 1.3.0.
Changed in version 3.4.0: Supports Spark Connect.
First row if DataFrame is not empty, otherwise None.
DataFrame
None
Examples
>>> df = spark.createDataFrame([ ... (2, "Alice"), (5, "Bob")], schema=["age", "name"]) >>> df.first() Row(age=2, name='Alice')