code: def transform(self, df):
          
  
          # Make sure the dataframe columns are the same as the ones passed to fit
          assert df.columns.equals(self.columns_)
  
          # Convert the dataframe with get_dummies
          df_with_dummies = pd.get_dummies(df)
  
          # Make sure our columns exactly match what we stored during the fit operation
          my_columns = set(df_with_dummies.columns.tolist())
          output_column_set = set(self.columns_in_order)
          for column in my_columns.difference(output_column_set):
              print('Deleting extra column {:s}'.format(column))
              del df_with_dummies[column]
          for column in output_column_set.difference(my_columns):
              print('Adding column {:s}'.format(column))
              df_with_dummies[column] = 0
  
          # Returns the same columns in the same order every time
          return np.asarray(df_with_dummies[self.columns_in_order])
docs: Transform dataframe into a numpy ndarray(matrix)