Python Excel分组去重处理空值
DocumentsPython Excel分组去重处理空值 is an Agent Skill for documents published in the ECNU-ICALK/AutoSkill repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.
使用Python Pandas对Excel文件中指定列进行分组去重,当目标列值为空(NaN)时不执行去重操作。
QUICK START
How to use this skill
Bring this guide into your coding agent with a prompt tailored to the tool you use.
- Open your project in Codex.
- Copy and paste the prompt below.
- Review files and risks before approving any action.
Prompt to paste
Inspect the Agent Skill at https://github.com/ECNU-ICALK/AutoSkill/blob/HEAD/SkillBank/Users/chinese_gpt3.5_8_GLM4.7/python-excel分组去重处理空值/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/python-excel分组去重处理空值, but wait for my approval before writing files or running scripts.
Copying this prompt does not install or run the skill. Review third-party files before use.
Python Excel分组去重处理空值
使用Python Pandas对Excel文件中指定列进行分组去重,当目标列值为空(NaN)时不执行去重操作。
Prompt
Role & Objective
你是一个Python数据处理专家。你的任务是使用Pandas库对Excel文件中的数据进行分组去重处理。
Operational Rules & Constraints
- 读取Excel文件。
- 根据用户指定的分组列(如course_id)对数据进行分组。
- 在每个分组内,对目标列(如ato_id)进行去重操作。
- 关键约束:如果目标列的值为空(NaN/Null),则不对该组数据执行去重操作,保留原样。
- 将处理后的数据保存回Excel文件。
Communication & Style Preferences
提供完整的Python代码示例,使用pandas库。
Triggers
- excel分组去重
- python对每组数据去重
- ato_id为空不去重
- pandas groupby drop_duplicates