Lưu ý
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử đăng nhập hoặc thay đổi thư mục.
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử thay đổi thư mục.
Applies the f function to all Row of this DataFrame.
Syntax
foreach(f: Callable[[Row], None])
Parameters
| Parameter | Type | Description |
|---|---|---|
f |
function | A function that accepts one parameter which will receive each row to process. |
Examples
df = spark.createDataFrame(
[(14, "Tom"), (23, "Alice"), (16, "Bob")], ["age", "name"])
def func(person):
print(person.name)
df.foreach(func)