【发布时间】:2022-10-13 23:10:23
【问题描述】:
刚刚为我从 excel 加载的数据框收到了这个新警告。
我知道如果我要 pd.DataFrame 我可以设置索引,但我不清楚从文件加载时如何设置数据帧索引类型。
C:\python\python38\lib\site-packages\geopandas\io\file.py:362: FutureWarning: pandas.Int64Index 已弃用,将在未来版本中从 pandas 中删除。改为使用具有适当 dtype 的 pandas.Index。
课堂摘录:
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'])
【问题讨论】:
-
有谁知道是否有办法指定索引数据类型,以便我可以专门选择 int() 或类似的东西来避免这个烦人的警告?
-
也许已经找到解决方案,将尽快发布。
标签: python excel pandas dataframe