title: How do I solve a XGBoost error "feature_names mismatch"?
body: <p>I'm working on using XGBoost to make predictions using the iris dataset. The model is trained but when I try to make a new prediction I get the following error: ValueError: feature_names mismatch. </p>
  
  <pre><code>import numpy as np
  import pandas as pd
  from sklearn.datasets import load_iris
  
  iris = load_iris()
  iris_df = pd.DataFrame(data= np.c_[iris['data'], iris['target']],
                   columns= iris['feature_names'] + ['target'])
  
  iris_df.rename(columns={'sepal length (cm)':'sepal_length'}, inplace=True)
  iris_df.rename(columns={'sepal width (cm)':'sepal_width'},inplace=True)
  iris_df.rename(columns={'petal length (cm)':'petal_length'},inplace=True)
  iris_df.rename(columns={'petal width (cm)':'petal_width'}, inplace=True)
  
  data = iris_df[['sepal_length', 'sepal_width', 'petal_length', 'petal_width']]
  target = iris_df[['targets']]
  
  from sklearn.model_selection import train_test_split
  
  X_train, X_test, y_train, y_test = train_test_split(data, target, test_size=0.2, random_state=0)
  
  import xgboost as xgb
  
  train = xgb.DMatrix(X_train, label=y_train)
  test = xgb.DMatrix(X_test, label=y_test)
  
  param = {
      'max_depth':4,
      'eta':0.3,
      'objective': 'multi:softmax',
      'num_class': 3}
  epochs = 10
  
  model = xgb.train(param, train, epochs)
  
  predictions = model.predict(test)
  print(predictions)
  
  from sklearn.metrics import accuracy_score
  
  accuracy_score(y_test, predictions)
  </code></pre>
  
  <p>All the code above works, but making new predictions is throwing an error:</p>
  
  <pre><code>testArray=np.array([[5.1,3.5,1.4,0.2]])
  
  test_individual=xgb.DMatrix(testArray)
  
  print(model.predict(test_individual))\
  </code></pre>
  
  <p>How do I make the new prediction work?</p>