Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

Aggregate the elements of each partition, and then the results for all the partitions

#Aggregate the elements of each partition, and then the results for all the partitions

seqOp = (lambda x, y: (x[0] + y, x[1] + 1))
combOp = (lambda x, y: (x[0] + y[0], x[1], y[1]))
sc.parallelize([1, 2, 3, 4]).aggregate((0, 0), seqOp, combOp)
# (10, 4)
sc.parallelize([]).aggregate((0, 0), seqOp, combOp)
# (0, 0)
Comment

PREVIOUS NEXT
Code Example
Python :: pydrive list shared folder 
Python :: django voice lib 
Python :: reference other libraries in library 
Python :: Randomly splits this DataFrame with the provided weights 
Python :: pygame for loop for draw shape 
Python :: use reshape in python with zeros 
Python :: how to read a data file in python and build a list of files 
Python :: matplot lib mehrere bilder nebeneinander 
Python :: how to call the tkinter insert command from another class 
Python :: numpy collapse last dimension 
Python :: discord.py find channel by id 
Python :: idwt pywt 
Python :: python != 
Python :: regrid ntdcf file usig xarray 
Python :: python numpy + opencv + overlay image 
Python :: get a liste from a txt file python 
Python :: python dict ffrom lists 
Python :: download pyautogui 
Python :: fcpython.com 
Python :: anaconda pytorch depencies windows 
Python :: sklearn random forest feature importance 
Python :: minio python remove an object 
Python :: pandas to latex table newline not working 
Python :: Django LogEntry or Change History 
Python :: python convert a dict to list or a list to dict or a slice a dict or sort a dict by key or value without import 
Python :: Python Multiline docstring example 
Python :: The Model display 
Python :: discord.py find user by name 
Python :: python list all youtube channel videos 
Python :: repeat every entru n times 
ADD CONTENT
Topic
Content
Source link
Name
9+8 =