Agent skill · Databases

DataFrame合并后的列清理与数据库插入准备

用于在Pandas DataFrame执行合并操作后,清理由merge产生的后缀列(_x, _y)和指示列,使其符合数据库表结构以便进行to_sql插入操作。

ECNU-ICALKgithub.com/ECNU-ICALKGitHub ↗
claude-code
Install
npx skills add ECNU-ICALK/AutoSkill --skill dataframe合并后的列清理与数据库插入准备 --agent claude-code

Same command for any agent — swap --agent for codex, cursor, copilot.

Facts
Files in the skill folder: 1
SKILL.md size: 1 KB
Bundled scripts: none
Version: 0.1.0
Path: SkillBank/ConvSkill/chinese_gpt4_8_GLM4.7/dataframe合并后的列清理与数据库插入准备/SKILL.md
Open the folder on GitHub →
Where it comes from
Stars: 539
Language: Python

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

From the SKILL.md

# DataFrame合并后的列清理与数据库插入准备 用于在Pandas DataFrame执行合并操作后,清理由merge产生的后缀列(_x, _y)和指示列,使其符合数据库表结构以便进行to_sql插入操作。 ## Prompt # Role & Objective 你是一个数据处理专家。你的任务是处理经过Pandas merge操作后的DataFrame,清理多余的列和后缀,使其准备好用于数据库插入(to_sql)。 # Operational Rules & Constraints 1. **识别新数据**:假设已通过 `pd.merge(df, existing_data, on=primary_key, how='outer', indicator=True)` 合并了数据。你需要筛选出 `_merge` 列值为 `'left_only'` 的行,这些是需要插入的新数据。 2. **删除指示列**:必须删除 `_merge` 列。 3. **处理后缀列**: - **重命名 _x 列**:将所有以 `_x` 结尾的列重命名,去掉 `_x` 后缀(例如 `attack_x` 变为 `attack`)。这些列包含来自左侧DataFrame(新数据)的值。 - **删除 _y 列**:删除所有以 `_y` 结尾的列。这些列包含来自右侧DataFrame(旧数据)的值,插入新数据时不需要。 4. **输出要求**:最终输出的DataFrame不应包含 `_x`、`_y` 或 `_merge` 相关的列,列名必须与数据库表结构完全一致。 # Anti-Patterns - 不要在原始的 `df` 上尝试删除 `_x` 或 `_y` 列,这些列只存在于 merge 后的结果中。 - 不要直接使用带有 `_x` 后缀的列名进行 `to_sql` 操作,这会导致“Unknown column”错误。 - 不要在筛选新数据之前就删除 `_merge` 列。 # Interaction Workflow 1. 接收合并后的DataFrame。 2. 筛选 `left_only` 行。 3. 执行列清理(重命名和删除)。 4. 返回清理后的DataFrame。 ## Triggers - 清理merge后的_x_y列 - dataframe to_sql 列名不匹配 - pandas merge 数据库插入 - 合并数据后准备插入数据库 - Unknown column in field list

What's inside
Steps it walks through
  1. Prompt
  2. Triggers
More from AutoSkill
All skills →
About this skill
What does the DataFrame合并后的列清理与数据库插入准备 skill do?

用于在Pandas DataFrame执行合并操作后,清理由merge产生的后缀列(_x, _y)和指示列,使其符合数据库表结构以便进行to_sql插入操作。

How do I install it?

Run `npx skills add ECNU-ICALK/AutoSkill --skill dataframe合并后的列清理与数据库插入准备 --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.

Where does this skill come from?

From ECNU-ICALK/AutoSkill, a repository with 539 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.

Is a popular skill a good skill?

Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.

Keep going