parameters: (values, fill_value=np.nan, dtype=None, copy: bool = False)
return_statement: return values, fill_value
docstring: Provide explicit type promotion and coercion.
  
      Parameters
      ----------
      values : ndarray or ExtensionArray
          The array that we want to maybe upcast.
      fill_value : what we want to fill with
      dtype : if None, then use the dtype of the values, else coerce to this type
      copy : bool, default True
          If True always make a copy even if no upcast is required.
docstring_summary: Provide explicit type promotion and coercion.
docstring_tokens: Provide explicit type promotion and coercion .
function: def maybe_upcast(values, fill_value=np.nan, dtype=None, copy: bool = False):
      """
      Provide explicit type promotion and coercion.
  
      Parameters
      ----------
      values : ndarray or ExtensionArray
          The array that we want to maybe upcast.
      fill_value : what we want to fill with
      dtype : if None, then use the dtype of the values, else coerce to this type
      copy : bool, default True
          If True always make a copy even if no upcast is required.
      """
      if not is_scalar(fill_value) and not is_object_dtype(values.dtype):
          # We allow arbitrary fill values for object dtype
          raise ValueError("fill_value must be a scalar")
  
      if is_extension_array_dtype(values):
          if copy:
              values = values.copy()
      else:
          if dtype is None:
              dtype = values.dtype
          new_dtype, fill_value = maybe_promote(dtype, fill_value)
          if new_dtype != values.dtype:
              values = values.astype(new_dtype)
          elif copy:
              values = values.copy()
  
      return values, fill_value
function_tokens: def maybe_upcast ( values , fill_value = np . nan , dtype = None , copy : bool = False ) : if not is_scalar ( fill_value ) and not is_object_dtype ( values . dtype ) : # We allow arbitrary fill values for object dtype raise ValueError ( "fill_value must be a scalar" ) if is_extension_array_dtype ( values ) : if copy : values = values . copy ( ) else : if dtype is None : dtype = values . dtype new_dtype , fill_value = maybe_promote ( dtype , fill_value ) if new_dtype != values . dtype : values = values . astype ( new_dtype ) elif copy : values = values . copy ( ) return values , fill_value