title: A given column is not a column of the dataframe Pandas
body: <p>I have the following splitting function:</p>
  <pre><code>from typing import Tuple
  from sklearn.preprocessing import LabelEncoder, StandardScaler
  from sklearn.model_selection import train_test_split
  
  def split_dataframe(
      
      df: pd.DataFrame, 
      target_feature: str, 
      split_ratio: int = 0.2
  
  ) -&gt; Tuple[pd.DataFrame, pd.DataFrame, np.ndarray, np.ndarray]:
       
      df_ = df.copy()
      
      X = df_.drop(target_feature, axis=1)
      y = df_[target_feature]
      
      encoder = LabelEncoder()
      y = encoder.fit_transform(y)
      
      X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = split_ratio)
      
      return  X_train, X_test, y_train, y_test
  </code></pre>
  <p>I split the dataframe by using the following:</p>
  <pre><code>X_train, X_test, y_train, y_test = split_dataframe(df, 'Банк')
  </code></pre>
  <p>I use pipeline to transform X_train and y_train</p>
  <pre><code>from sklearn.pipeline import Pipeline, FeatureUnion
  from mlxtend.feature_selection import ColumnSelector
  import category_encoders as ce
  
  cat_pipe = Pipeline(
      [
          ('selector', ColumnSelector(categorical_features)),
          ('encoder', ce.one_hot.OneHotEncoder())
      ]
  )
  
  num_pipe = Pipeline(
      [
          ('selector', ColumnSelector(numeric_features)),
          ('scaler', StandardScaler())
      ]
  )
  
  preprocessor = FeatureUnion(
      transformer_list=[
          
          ('cat', cat_pipe),
          ('num', num_pipe)
      ]
  )
  
  new_df = pipe.fit_transform(X_train, y_train)
  </code></pre>
  <p>And after that I got <strong>ValueError: A given column is not a column of the dataframe</strong> and specifically <strong>KeyError: 'Банк'</strong>. I checked if the columns exist before of pass the dataframe to split in train and test. If i remove <code>X = df_.drop(target_feature, axis=1)</code> to <code>X = df_</code> everything works correctly but target feature still in X.</p>