categorical-comparison-analysis
Installation
SKILL.md
categorical-comparison-analysis
This sub-skill covers one capability of the Excel workflow. For reading/counting/Parquet optimization, see the parent workflow SKILL.md.
Step1 读取文件并统计所有 sheet 的总行数,评估是否需要进行大文件优化处理。
import pandas as pd
from pandas import read_excel
from pathlib import Path
# 统计所有 sheet 的行数以决定处理策略
file_path = "input_data.xlsx"
sheet_names = pd.ExcelFile(file_path).sheet_names
total_rows = 0
for sheet in sheet_names:
# 仅读取行索引以快速计数
df_tmp = read_excel(file_path, sheet_name=sheet, usecols=[0])
total_rows += len(df_tmp)