如何替换DataFrame中的最后一个empy行(pandas,python)

时间:2019-06-11 21:55:04

标签: python excel pandas dataframe replace

我想通过python将统计信息从Oracle导出到Excel,我几乎做了一切 我比结果:

import cx_Oracle
import pandas as pd
1) Use data=pd.read_sql(select slid,name,sum(lines),sum(packs) group by...)
2) sum_row=data[["LINES","PACKS","PACKS_C"]].sum()
3) data_final=data.append(sum_row,ignore_index=True) 

那之后,我得到了:

enter image description here

我要更改最后一行,在“ OT”列下的空值处,必须添加诸如“总计”之类的词 我尝试使用data_final2=data_final.append({'OT':'Total'},ignore_index=True) 但我有:

enter image description here

0 个答案:

没有答案