Note
Kailangan ng pahintulot para ma-access ang page na ito. Maaari mong subukang mag-sign in o magpalit ng mga direktoryo.
Ang pag-access sa pahinang ito ay nangangailangan ng pahintulot. Maaari mong subukang baguhin ang mga direktoryo.
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)