Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pandas.Int64Index fix for FutureWarning

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'])
like image 240
AAmes Avatar asked Nov 23 '25 02:11

AAmes


2 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

pip3 install xgboost

like image 93
Mayur Gite Avatar answered Nov 25 '25 16:11

Mayur Gite


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.

enter image description here

like image 45
Anthony M Avatar answered Nov 25 '25 15:11

Anthony M