parameters: (
      data, columns: Index | None, dtype: DtypeObj | None = None
  )
return_statement: return content, columns
docstring: Return list of arrays, columns.
docstring_summary: Return list of arrays, columns.
docstring_tokens: Return list of arrays columns .
function: def to_arrays(
      data, columns: Index | None, dtype: DtypeObj | None = None
  ) -> tuple[list[ArrayLike], Index]:
      """
      Return list of arrays, columns.
      """
      if isinstance(data, ABCDataFrame):
          # see test_from_records_with_index_data, test_from_records_bad_index_column
          if columns is not None:
              arrays = [
                  data._ixs(i, axis=1).values
                  for i, col in enumerate(data.columns)
                  if col in columns
              ]
          else:
              columns = data.columns
              arrays = [data._ixs(i, axis=1).values for i in range(len(columns))]
  
          return arrays, columns
  
      if not len(data):
          if isinstance(data, np.ndarray):
              if data.dtype.names is not None:
                  # i.e. numpy structured array
                  columns = ensure_index(data.dtype.names)
                  arrays = [data[name] for name in columns]
  
                  if len(data) == 0:
                      # GH#42456 the indexing above results in list of 2D ndarrays
                      # TODO: is that an issue with numpy?
                      for i, arr in enumerate(arrays):
                          if arr.ndim == 2:
                              arrays[i] = arr[:, 0]
  
                  return arrays, columns
          return [], ensure_index([])
  
      elif isinstance(data[0], Categorical):
          # GH#38845 deprecate special case
          warnings.warn(
              "The behavior of DataFrame([categorical, ...]) is deprecated and "
              "in a future version will be changed to match the behavior of "
              "DataFrame([any_listlike, ...]). "
              "To retain the old behavior, pass as a dictionary "
              "DataFrame({col: categorical, ..})",
              FutureWarning,
              stacklevel=4,
          )
          if columns is None:
              columns = ibase.default_index(len(data))
          return data, columns
  
      elif isinstance(data, np.ndarray) and data.dtype.names is not None:
          # e.g. recarray
          columns = Index(list(data.dtype.names))
          arrays = [data[k] for k in columns]
          return arrays, columns
  
      if isinstance(data[0], (list, tuple)):
          arr = _list_to_arrays(data)
      elif isinstance(data[0], abc.Mapping):
          arr, columns = _list_of_dict_to_arrays(data, columns)
      elif isinstance(data[0], ABCSeries):
          arr, columns = _list_of_series_to_arrays(data, columns)
      else:
          # last ditch effort
          data = [tuple(x) for x in data]
          arr = _list_to_arrays(data)
  
      content, columns = _finalize_columns_and_data(arr, columns, dtype)
      return content, columns
function_tokens: def to_arrays ( data , columns : Index | None , dtype : DtypeObj | None = None ) -> tuple [ list [ ArrayLike ] , Index ] : if isinstance ( data , ABCDataFrame ) : # see test_from_records_with_index_data, test_from_records_bad_index_column if columns is not None : arrays = [ data . _ixs ( i , axis = 1 ) . values for i , col in enumerate ( data . columns ) if col in columns ] else : columns = data . columns arrays = [ data . _ixs ( i , axis = 1 ) . values for i in range ( len ( columns ) ) ] return arrays , columns if not len ( data ) : if isinstance ( data , np . ndarray ) : if data . dtype . names is not None : # i.e. numpy structured array columns = ensure_index ( data . dtype . names ) arrays = [ data [ name ] for name in columns ] if len ( data ) == 0 : # GH#42456 the indexing above results in list of 2D ndarrays # TODO: is that an issue with numpy? for i , arr in enumerate ( arrays ) : if arr . ndim == 2 : arrays [ i ] = arr [ : , 0 ] return arrays , columns return [ ] , ensure_index ( [ ] ) elif isinstance ( data [ 0 ] , Categorical ) : # GH#38845 deprecate special case warnings . warn ( "The behavior of DataFrame([categorical, ...]) is deprecated and " "in a future version will be changed to match the behavior of " "DataFrame([any_listlike, ...]). " "To retain the old behavior, pass as a dictionary " "DataFrame({col: categorical, ..})" , FutureWarning , stacklevel = 4 , ) if columns is None : columns = ibase . default_index ( len ( data ) ) return data , columns elif isinstance ( data , np . ndarray ) and data . dtype . names is not None : # e.g. recarray columns = Index ( list ( data . dtype . names ) ) arrays = [ data [ k ] for k in columns ] return arrays , columns if isinstance ( data [ 0 ] , ( list , tuple ) ) : arr = _list_to_arrays ( data ) elif isinstance ( data [ 0 ] , abc . Mapping ) : arr , columns = _list_of_dict_to_arrays ( data , columns ) elif isinstance ( data [ 0 ] , ABCSeries ) : arr , columns = _list_of_series_to_arrays ( data , columns ) else : # last ditch effort data = [ tuple ( x ) for x in data ] arr = _list_to_arrays ( data ) content , columns = _finalize_columns_and_data ( arr , columns , dtype ) return content , columns