parameters: (data: Union[np.ndarray, ABCExtensionArray])
return_statement: return data, dtype_name
docstring: Convert the passed data into a storable form and a dtype string.
docstring_summary: Convert the passed data into a storable form and a dtype string.
docstring_tokens: Convert the passed data into a storable form and a dtype string .
function: def _get_data_and_dtype_name(data: Union[np.ndarray, ABCExtensionArray]):
      """
      Convert the passed data into a storable form and a dtype string.
      """
      if is_categorical_dtype(data.dtype):
          data = data.codes
  
      # For datetime64tz we need to drop the TZ in tests TODO: why?
      dtype_name = data.dtype.name.split("[")[0]
  
      if data.dtype.kind in ["m", "M"]:
          data = np.asarray(data.view("i8"))
          # TODO: we used to reshape for the dt64tz case, but no longer
          #  doing that doesn't seem to break anything.  why?
  
      elif isinstance(data, PeriodIndex):
          data = data.asi8
  
      data = np.asarray(data)
      return data, dtype_name
function_tokens: def _get_data_and_dtype_name ( data : Union [ np . ndarray , ABCExtensionArray ] ) : if is_categorical_dtype ( data . dtype ) : data = data . codes # For datetime64tz we need to drop the TZ in tests TODO: why? dtype_name = data . dtype . name . split ( "[" ) [ 0 ] if data . dtype . kind in [ "m" , "M" ] : data = np . asarray ( data . view ( "i8" ) ) # TODO: we used to reshape for the dt64tz case, but no longer #  doing that doesn't seem to break anything.  why? elif isinstance ( data , PeriodIndex ) : data = data . asi8 data = np . asarray ( data ) return data , dtype_name