读入的 pd 不确定会有多少行,最后一行是没用的表格装饰,想删除,对 pandas 不熟,
试着这样:
PageDF = PageDF.append(pd.read_html(PageStr)[4], ignore_index=True)
dfmaxrow = PageDF.shape[0]
PageDF = PageDF.drop([21])
# print(type(dfmaxrow))
# PageDF = PageDF.drop(21, axis=0, inplace=True)
# PageDF = PageDF.drop([21], axis=0, inplace=True)
# PageDF = PageDF.drop([dfmaxrow],axis=0)
PageDF.to_csv(savestblpath,encoding="utf_8_sig",header=None,index=0,float_format=None)
注释的方式都是不行,第三行知道行号直接 drop 是没问题的。。。
试着这样:
PageDF = PageDF.append(pd.read_html(PageStr)[4], ignore_index=True)
dfmaxrow = PageDF.shape[0]
PageDF = PageDF.drop([21])
# print(type(dfmaxrow))
# PageDF = PageDF.drop(21, axis=0, inplace=True)
# PageDF = PageDF.drop([21], axis=0, inplace=True)
# PageDF = PageDF.drop([dfmaxrow],axis=0)
PageDF.to_csv(savestblpath,encoding="utf_8_sig",header=None,index=0,float_format=None)
注释的方式都是不行,第三行知道行号直接 drop 是没问题的。。。