from xgboost import XGBClassifier import pandas as pd # Reading data from CSV data = pd.read_csv('data.csv') # Splitting dataset into features and target X = data.iloc[:, :-1] y = data.iloc[:, -1] # Instantiating and fitting XGBClassifier model = XGBClassifier(random_state=42) model.fit(X, y) # Predicting and evaluating accuracy y_pred = model.predict(X) accuracy = accuracy_score(y, y_pred)In this example, we import the XGBClassifier from the XGBoost library and use it to classify a binary target variable based on input features. After reading the data from a CSV file, we split it into features and target, and then instantiate and fit the model using the XGBClassifier. Finally, we use the trained model to make predictions on the training data, and evaluate its accuracy using a metric such as accuracy_score. Package Library: XGBoost.