नोट
इस पेज तक पहुँच के लिए प्रमाणन की आवश्यकता होती है. आप साइन इन करने या निर्देशिकाओं को बदलने का प्रयास कर सकते हैं.
इस पेज तक पहुँच के लिए प्रमाणन की आवश्यकता होती है. आप निर्देशिकाओं को बदलने का प्रयास कर सकते हैं.
Applies the f function to each partition of this DataFrame.
Syntax
foreachPartition(f: Callable[[Iterator[Row]], None])
Parameters
| Parameter | Type | Description |
|---|---|---|
f |
function | A function that accepts one parameter which will receive each partition to process. |
Examples
df = spark.createDataFrame(
[(14, "Tom"), (23, "Alice"), (16, "Bob")], ["age", "name"])
def func(itr):
for person in itr:
print(person.name)
df.foreachPartition(func)