code: def to_numeric(arg, errors="raise"):
      """
      Convert argument to a numeric type.
  
      Parameters
      ----------
      arg : scalar, list, tuple, 1-d array, or Series
          Argument to be converted.
      errors : {'raise', 'coerce'}, default 'raise'
          * If 'coerce', then invalid parsing will be set as NaN.
          * If 'raise', then invalid parsing will raise an exception.
          * If 'ignore', then invalid parsing will return the input.
  
          .. note:: 'ignore' doesn't work yet when `arg` is pandas-on-Spark Series.
  
      Returns
      -------
      ret : numeric if parsing succeeded.
  
      See Also
      --------
      DataFrame.astype : Cast argument to a specified dtype.
      to_datetime : Convert argument to datetime.
      to_timedelta : Convert argument to timedelta.
      numpy.ndarray.astype : Cast a numpy array to a specified type.
  
      Examples
      --------
  
      >>> psser = ps.Series(['1.0', '2', '-3'])
      >>> psser
      0    1.0
      1      2
      2     -3
      dtype: object
  
      >>> ps.to_numeric(psser)
      0    1.0
      1    2.0
      2   -3.0
      dtype: float32
  
      If given Series contains invalid value to cast float, just cast it to `np.nan`
      when `errors` is set to "coerce".
  
      >>> psser = ps.Series(['apple', '1.0', '2', '-3'])
      >>> psser
      0    apple
      1      1.0
      2        2
      3       -3
      dtype: object
  
      >>> ps.to_numeric(psser, errors="coerce")
      0    NaN
      1    1.0
      2    2.0
      3   -3.0
      dtype: float32
  
      Also support for list, tuple, np.array, or a scalar
  
      >>> ps.to_numeric(['1.0', '2', '-3'])
      array([ 1.,  2., -3.])
  
      >>> ps.to_numeric(('1.0', '2', '-3'))
      array([ 1.,  2., -3.])
  
      >>> ps.to_numeric(np.array(['1.0', '2', '-3']))
      array([ 1.,  2., -3.])
  
      >>> ps.to_numeric('1.0')
      1.0
      """
      if isinstance(arg, Series):
          if errors == "coerce":
              return arg._with_new_scol(arg.spark.column.cast("float"))
          elif errors == "raise":
              scol = arg.spark.column
              scol_casted = scol.cast("float")
              cond = F.when(
                  F.assert_true(
                      scol.isNull() | scol_casted.isNotNull()
                  ).isNull(),
                  scol_casted,
              )
              return arg._with_new_scol(cond)
          elif errors == "ignore":
              raise NotImplementedError(
                  "'ignore' is not implemented yet, when the `arg` is Series."
              )
          else:
              raise ValueError("invalid error value specified")
      else:
          return pd.to_numeric(arg, errors=errors)
  
imports: from typing import Any, Callable, Dict, List, Optional, Set, Sized, Tuple, Type, Union, cast, no_type_check
  from collections.abc import Iterable
  from datetime import tzinfo
  from functools import reduce
  from io import BytesIO
  import json
  import warnings
  import numpy
  import pandas
  from pandas.api.types import is_datetime64_dtype, is_list_like
  from pandas.tseries.offsets import DateOffset
  import pyarrow
  import pyarrow.parquet
  from pyspark.sql import functions, Column
  from pyspark.sql.functions import pandas_udf
  from pyspark.sql.types import ByteType, ShortType, IntegerType, LongType, FloatType, DoubleType, BooleanType, TimestampType, TimestampNTZType, DecimalType, StringType, DateType, StructType, DataType
  from pyspark.sql.dataframe import DataFrame
  from pyspark import pandas
  from pyspark.pandas._typing import Axis, Dtype, Label, Name
  from pyspark.pandas.base import IndexOpsMixin
  from pyspark.pandas.utils import align_diff_frames, default_session, is_name_like_tuple, is_name_like_value, name_like_string, same_anchor, scol_for, validate_axis, log_advice
  from pyspark.pandas.frame import DataFrame, _reduce_spark_multi
  from pyspark.pandas.internal import InternalFrame, DEFAULT_SERIES_NAME, HIDDEN_COLUMNS, SPARK_INDEX_NAME_FORMAT
  from pyspark.pandas.series import Series, first_series
  from pyspark.pandas.spark.utils import as_nullable_spark_type, force_decimal_precision_scale
  from pyspark.pandas.indexes import Index, DatetimeIndex, TimedeltaIndex
  from pyspark.pandas.indexes.multi import MultiIndex
  from pyspark.sql.utils import get_column_class
label_desc: Use image node_id 26 for calling a global function with example usage: to_numeric(arg, errors) and returns: pd, arg, arg