snowflake.snowpark.Row¶
- class snowflake.snowpark.Row(*values: Any, **named_values: Any)[source] (https://github.com/snowflakedb/snowpark-python/blob/v1.16.0/src/snowflake/snowpark/row.py#L42-L320)¶
Bases:
tuple
Represents a row in
DataFrame
.It is immutable and works like a tuple or a named tuple.
>>> row = Row(1, 2) >>> row Row(1, 2) >>> row[0] 1 >>> len(row) 2 >>> row[0:1] Row(1) >>> named_row = Row(name1=1, name2=2) >>> named_row Row(name1=1, name2=2) >>> named_row["name1"] 1 >>> named_row.name1 1 >>> row == named_row True
A
Row
object is callable. You can use it to create otherRow
objects:>>> Employee = Row("name", "salary") >>> emp1 = Employee("John", 10000) >>> emp1 Row(name='John', salary=10000) >>> emp2 = Employee("James", 20000) >>> emp2 Row(name='James', salary=20000)
Methods
asDict
([recursive])Convert to a dict if this row object has both keys and values.
as_dict
([recursive])Convert to a dict if this row object has both keys and values.