code: def check_X(
      X: Union[np.generic, np.ndarray, pd.DataFrame]
  ) -> pd.DataFrame:
      """
      Checks if the input is a DataFrame and then creates a copy. This is an important
      step not to accidentally transform the original dataset entered by the user.
  
      If the input is a numpy array, it converts it to a pandas Dataframe. The column
      names are strings representing the column index starting at 0.
  
      Feature-engine was originally designed to work with pandas dataframes. However,
      allowing numpy arrays as input allows 2 things:
  
      We can use the Scikit-learn tests for transformers provided by the
      `check_estimator` function to test the compatibility of our transformers with
      sklearn functionality.
  
      Feature-engine transformers can be used within a Scikit-learn Pipeline together
      with Scikit-learn transformers like the `SimpleImputer`, which return by default
      Numpy arrays.
  
      Parameters
      ----------
      X : pandas Dataframe or numpy array.
          The input to check and copy or transform.
  
      Raises
      ------
      TypeError
          If the input is not a Pandas DataFrame or a numpy array.
      ValueError
          If the input is an empty dataframe.
  
      Returns
      -------
      X : pandas Dataframe.
          A copy of original DataFrame or a converted Numpy array.
      """
      if isinstance(X, pd.DataFrame):
          X = X.copy()
  
      elif isinstance(X, (np.generic, np.ndarray)):
          # If input is scalar raise error
          if X.ndim == 0:
              raise ValueError(
                  "Expected 2D array, got scalar array instead:\narray={}.\n"
                  "Reshape your data either using array.reshape(-1, 1) if "
                  "your data has a single feature or array.reshape(1, -1) "
                  "if it contains a single sample.".format(X)
              )
          # If input is 1D raise error
          if X.ndim == 1:
              raise ValueError(
                  "Expected 2D array, got 1D array instead:\narray={}.\n"
                  "Reshape your data either using array.reshape(-1, 1) if "
                  "your data has a single feature or array.reshape(1, -1) "
                  "if it contains a single sample.".format(X)
              )
  
          X = pd.DataFrame(X)
          X.columns = [f"x{i}" for i in range(X.shape[1])]
  
      elif issparse(X):
          raise TypeError(
              "This transformer does not support sparse matrices."
          )
  
      else:
          raise TypeError(
              f"X must be a numpy array or pandas dataframe. Got {type(X)} instead."
          )
  
      if X.empty:
          raise ValueError(
              "0 feature(s) (shape=%s) while a minimum of %d is required."
              % (X.shape, 1)
          )
  
      return X
  
file_path: feature_engine/feature_engine/dataframe_checks.py
imports: from typing import List, Tuple, Union
  import numpy
  import pandas
  from scipy.sparse import issparse
  from sklearn.utils.validation import _check_y, check_consistent_length
label_desc: Use image node_id 1 for calling a global function with example usage: check_X(X) and returns: X