赞
踩
def removeDuplicateLineInfo(): path = os.path.join(OutputPath, 'MacroInfo_cared_PLL0.xlsx') macro_info = pd.read_excel(path, sheet_name="frequency_plan", dtype=str, keep_default_na=False, header=0) # need to update keyName:'VCO freq (GHz)', if changed, # Delete invalid line with error message macro_info = macro_info[~ macro_info['VCO freq (GHz)'].isin(["Error"])] x = pd.DataFrame(macro_info.iloc[:, :]) # Delete 重复行,并重新写入'MacroInfo_cared_PLL0_demo.xlsx' x.drop_duplicates(keep='first', inplace=True) path_simple = os.path.join(OutputPath, 'MacroInfo_cared_PLL0_simple.xlsx') x.to_excel(path_simple, header=1, index=False, encoding='utf-8', sheet_name='frequency_plan') # if PLL0 exist pll1Path = os.path.join(OutputPath, 'MacroInfo_cared_PLL1.xlsx') if (os.path.exists(pll1Path)): macro_info_PLL1 = pd.read_excel(pll1Path, sheet_name="frequency_plan", dtype=str, keep_default_na=False, header=0) macro_info_PLL1 = macro_info_PLL1[~macro_info_PLL1['VCO freq (GHz)'].isin(["Error"])] y = pd.DataFrame(macro_info_PLL1.iloc[:, :]) if y.empty: print('PLL1 info is empty') else: print('PLL1 info is existed') # Delete 重复行,并重新写入'MacroInfo_cared_PLL0_demo.xlsx' y.drop_duplicates(keep='first', inplace=True) path_simple = os.path.join(OutputPath, 'MacroInfo_cared_PLL1_simple.xlsx') y.to_excel(path_simple, header=1, index=False, encoding='utf-8', sheet_name='frequency_plan')
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。