Just getting this new warning for my dataframes that are loaded from excel.
I understand if I were to pd.DataFrame I could set the index, but I am not clear how to set the dataframe index type when I am loading from a file.
C:\python\python38\lib\site-packages\geopandas\io\file.py:362: FutureWarning: pandas.Int64Index is deprecated and will be removed from pandas in a future version. Use pandas.Index with the appropriate dtype instead.
Excerpt from class:
xls = pd.ExcelFile('C:/QGISwork/generic_templates/fielddbtemplate_db.xlsx') self.header = xls.parse('generic', header = None) self.df = xls.parse('generic', skiprows=4, index_col=0, na_values=['NA']) 25 Answers
I had faced same issue while training XGBoostClassifier on my local machine.
As per this link, I upgraded my XGBoost from 1.5.1 to 1.6.1 and all such warnings disappeared.
To upgrade version you may first need to uninstall current XGBoost package using
pip3 uninstall xgboost
Next, reinstall XGBoost using
1pip3 install xgboost
The warning is generating merely just by importing xgboost too. No apparent way to stop the warnings unless you explicitly suppress them using the "warnings" library.
Interestingly, the warning only generates when using the specific Int64Index method, but not an equivalent object. I don't think you will have to worry about problems unless you were using this method.
This warning I found coming from xgboost compat.py . I commented out the import parts of multiindex and index64index The warning disappeared
The reason for this could be that the deprecation in pandas new version is not taken into consideration in xgboost even latest versions of it.
I found that the best way to avoid this warning is to import pandas first, then, import MultiIndex and Int16Dtype before importing any other libraries that depend on the Panda index. This is how I got rid of the warning.
import pandas as pd from pandas import MultiIndex, Int16Dtype import xgboost as xgb In my case it was xgboost that needed the Index reference. In your case, it is probably the geopandas library.
1Just upgrade xgboost
pip install xgboost --upgrade
in jupyter lab:
!pip install xgboost --upgrade
I did this and the problem disappeared
