调用 XGBoost 时遇到如下 FutureWarning:
compat.py:36: FutureWarning: pandas.Int64Index is deprecated and will be removed from pandas in a future version. Use pandas.Index with the appropriate dtype instead.
from pandas import MultiIndex, Int64Index
data.py:267: FutureWarning: pandas.Int64Index is deprecated and will be removed from pandas in a future version. Use pandas.Index with the appropriate dtype instead.
elif isinstance(data.columns, (pd.Int64Index, pd.RangeIndex)):
我的解决方法:
pip uninstall pandas
pip install pandas==1.3
其他解决方案说降低 xgboost 的版本,或者先导入 MultiIndex, Int16Dtype,如下所示:
import pandas as pd
from pandas import MultiIndex, Int16Dtype
import xgboost as xgb