删除操作
2、drop方法的用法:drop(labels, axis=0, level=None, inplace=False, errors='raise')
-- axis为0时表示删除行,axis为1时表示删除列
变成字典
pd = pandas.read_excel(file,usecols=[0,1, 2,3,4,5])
df_li = pd.values.tolist()
字典dataframe 变excel
如:
[{},{}]
## 创建DataFrame 集合
df_li = []
df = pd.DataFrame(dict([(k, pd.Series(v)) for k, v in All_policy[0].items()]))
# print(df)
for i in range(len(All_policy)):
df_li.append(pd.DataFrame(dict([(k, pd.Series(v)) for k, v in All_policy[i].items()]))) ## 字典转DataFrame不等长的处理
df_li = pd.concat(df_li, sort=False) # 合并
df_li.to_csv("../已排序-{}".format(filename), index=None) # 去除索引