import matplotlib.pyplot as plt
from xgboost import plot_importance, XGBClassifier # or XGBRegressor
model = XGBClassifier() # or XGBRegressor
# X and y are input and target arrays of numeric variables
model.fit(X,y)
plot_importance(model, importance_type = 'gain') # other options available
plt.show()
# if you need a dictionary
model.get_booster().get_score(importance_type = 'gain')