# pyspark.SparkContext.accumulator¶

SparkContext.accumulator(value: T, accum_param: Optional[AccumulatorParam[T]] = None) → Accumulator[T][source]

Create an Accumulator with the given initial value, using a given AccumulatorParam helper object to define how to add values of the data type if provided. Default AccumulatorParams are used for integers and floating-point numbers if you do not provide one. For other types, a custom AccumulatorParam can be used.