Generation

generate functionSun, 28 May 2023

Excel里面某一列所有相同的按顺序排列在下面行,不同的用空行隔开

import pandas as pd def excel_sort(input_path, output_path): df = pd.read_excel(input_path) df.sort_values(by=['流水号','登记日期'], inplace=True) df.to_excel(output_path, index=False) input_path = 'data/2019-4-1.xlsx' output_path = 'data/2019-4-1-output.xlsx' excel_sort(input_path, output_path)

Questions about programming?Chat with your personal AI assistant