code: def is_categorical(X: np.ndarray) -> bool:
      """Checks if all of the given columns are categorical, i.e. either a string or a boolean. Only if all of the
      columns are categorical, this method will return True. Alternatively, consider has_categorical for checking if any
      of the columns is categorical.
  
      Note: A np matrix with mixed data types might internally convert numeric columns to strings and vice versa. To
      ensure that the given given data keeps the original data type, consider converting/initializing it with the dtype
      'object'. For instance: np.array([[1, 'True', '0', 0.2], [3, 'False', '1', 2.3]], dtype=object)
  
      :param X: Input array to check if all columns are categorical.
      :return: True if all columns of the input are categorical, False otherwise.
      """
      X = shape_into_2d(X)
  
      status = True
      for column in range(X.shape[1]):
          if (
              isinstance(X[0, column], int)
              or isinstance(X[0, column], float)
          ) and np.isnan(X[0, column]):
              raise ValueError(
                  "Input contains NaN values! This is currently not supported. "
                  "Consider imputing missing values."
              )
  
          status &= (
              isinstance(X[0, column], str)
              or isinstance(X[0, column], bool)
              or isinstance(X[0, column], np.bool_)
          )
  
          if not status:
              break
  
      return status
  
imports: import random
  from typing import Dict, Optional, Union
  import numpy
  from scipy.optimize import minimize
  from sklearn.preprocessing import OneHotEncoder
  from dowhy.gcm.util.catboost_encoder import CatBoostEncoder
label_desc: Use image node_id 9 for calling a global function with example usage: is_categorical(X) and returns: status