parameters: (
      data: np.ndarray, copy: bool, dtype: np.dtype
  )
docstring: Attempt to convert an array of data into an integer array.
  
      Parameters
      ----------
      data : The data to convert.
      copy : bool
          Whether to copy the data or not.
      dtype : np.dtype
  
      Returns
      -------
      int_array : data converted to either an ndarray[int64] or ndarray[uint64]
  
      Raises
      ------
      ValueError if the conversion was not successful.
docstring_summary: Attempt to convert an array of data into an integer array.
docstring_tokens: Attempt to convert an array of data into an integer array .
function: def _try_convert_to_int_array(
      data: np.ndarray, copy: bool, dtype: np.dtype
  ) -> np.ndarray:
      """
      Attempt to convert an array of data into an integer array.
  
      Parameters
      ----------
      data : The data to convert.
      copy : bool
          Whether to copy the data or not.
      dtype : np.dtype
  
      Returns
      -------
      int_array : data converted to either an ndarray[int64] or ndarray[uint64]
  
      Raises
      ------
      ValueError if the conversion was not successful.
      """
  
      if not is_unsigned_integer_dtype(dtype):
          # skip int64 conversion attempt if uint-like dtype is passed, as
          # this could return Int64Index when UInt64Index is what's desired
          try:
              res = data.astype("i8", copy=False)
              if (res == data).all():
                  return res  # TODO: might still need to copy
          except (OverflowError, TypeError, ValueError):
              pass
  
      # Conversion to int64 failed (possibly due to overflow) or was skipped,
      # so let's try now with uint64.
      try:
          res = data.astype("u8", copy=False)
          if (res == data).all():
              return res  # TODO: might still need to copy
      except (OverflowError, TypeError, ValueError):
          pass
  
      raise ValueError
function_tokens: def _try_convert_to_int_array ( data : np . ndarray , copy : bool , dtype : np . dtype ) -> np . ndarray : if not is_unsigned_integer_dtype ( dtype ) : # skip int64 conversion attempt if uint-like dtype is passed, as # this could return Int64Index when UInt64Index is what's desired try : res = data . astype ( "i8" , copy = False ) if ( res == data ) . all ( ) : return res # TODO: might still need to copy except ( OverflowError , TypeError , ValueError ) : pass # Conversion to int64 failed (possibly due to overflow) or was skipped, # so let's try now with uint64. try : res = data . astype ( "u8" , copy = False ) if ( res == data ) . all ( ) : return res # TODO: might still need to copy except ( OverflowError , TypeError , ValueError ) : pass raise ValueError