title: OneHotEncoder object has no attribute get_feature_names_out
body: <p>I was trying to understand differences between OneHotEncoder and get_dummies from this link: <a href="https://pythonsimplified.com/difference-between-onehotencoder-and-get_dummies/" rel="nofollow noreferrer">enter link description here</a></p>
  <p>When I wrote exact same code, I am getting an error and it says</p>
  <pre><code>AttributeError: 'OneHotEncoder' object has no attribute 'get_feature_names_out'
  </code></pre>
  <p>Here is the code:</p>
  <pre><code>import pandas as pd
  import seaborn as sns
  from sklearn.pipeline import Pipeline
  from sklearn.compose import ColumnTransformer
  from sklearn.preprocessing import OneHotEncoder
  from sklearn.preprocessing import MinMaxScaler, StandardScaler
  from sklearn.linear_model import LinearRegression
  from sklearn.model_selection import train_test_split
  
  df = sns.load_dataset('tips')
  df = df[['total_bill', 'tip', 'day', 'size']]
  
  df.head(5)
  
  X = df.drop('tip', axis=1)
  y = df['tip']
  
  X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=0)
  
  ohe = OneHotEncoder(handle_unknown='ignore', sparse=False, dtype='int')
  ohe.fit(X_train[['day']])
  
  def get_ohe(df):
      temp_df = pd.DataFrame(data=ohe.transform(df[['day']]), columns=ohe.get_feature_names_out())
      df.drop(columns=['day'], axis=1, inplace=True)
      df = pd.concat([df.reset_index(drop=True), temp_df], axis=1)
      return df
  
  X_train = get_ohe(X_train)
  X_test = get_ohe(X_test)
  
  X_train.head()
  </code></pre>
  <p>I checked OneHotEncoder from sklearn.preprocessing module and get_feature_names_out() method is there and it is not deprecated. I don't know why I am getting this error.</p>