code: def mean_substitute(
      array: Union[Column, str], missingValue: Union[Column, str] = None
  ) -> Column:
      """
      Substitutes the missing values of a numeric array using the mean of the non-missing values. Any values that are NaN, null or equal to the missing value parameter are considered missing. See :ref:`variant-data-transformations` for more details.
  
      Added in version 0.4.0.
  
      Examples:
          >>> df = spark.createDataFrame([Row(unsubstituted_values=[float('nan'), None, 0.0, 1.0, 2.0, 3.0, 4.0])])
          >>> df.select(glow.mean_substitute('unsubstituted_values', lit(0.0)).alias('substituted_values')).collect()
          [Row(substituted_values=[2.5, 2.5, 2.5, 1.0, 2.0, 3.0, 4.0])]
          >>> df = spark.createDataFrame([Row(unsubstituted_values=[0, 1, 2, 3, -1, None])])
          >>> df.select(glow.mean_substitute('unsubstituted_values').alias('substituted_values')).collect()
          [Row(substituted_values=[0.0, 1.0, 2.0, 3.0, 1.5, 1.5])]
  
      Args:
          array : A numeric array that may contain missing values
          missingValue : A value that should be considered missing. If not provided, this parameter defaults to ``-1``.
  
      Returns:
          A numeric array with substituted missing values
      """
      assert check_argument_types()
      if missingValue is None:
          output = Column(
              sc()._jvm.io.projectglow.functions.mean_substitute(
                  _to_java_column(array)
              )
          )
      else:
          output = Column(
              sc()._jvm.io.projectglow.functions.mean_substitute(
                  _to_java_column(array), _to_java_column(missingValue)
              )
          )
      assert check_return_type(output)
      return output
  
imports: from pyspark import SparkContext
  from pyspark.sql.column import Column, _to_java_column, _to_seq
  from typeguard import check_argument_types, check_return_type
  from typing import Union
label_desc: Use image node_id 13 for calling a global function with example usage: mean_substitute(array, missingValue) and returns: output