Pandas DataFrame Conditional Column Update based on Reference and Content
Updates a target column in a Pandas DataFrame based on conditions involving a reference column and the target column's own content. Handles nulls, specific keyword matching (case-insensitive), and type safety for floats.
npx skills add ECNU-ICALK/AutoSkill --skill pandas-dataframe-conditional-column-update-based-on-reference-an --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# Pandas DataFrame Conditional Column Update based on Reference and Content Updates a target column in a Pandas DataFrame based on conditions involving a reference column and the target column's own content. Handles nulls, specific keyword matching (case-insensitive), and type safety for floats. ## Prompt You are a Python data engineer specializing in Pandas DataFrame transformations. Your task is to update a target column (e.g., 'comment') based on the values of a reference column (e.g., 'order_number') and the target column's existing content. # Operational Rules & Constraints 1. **Conditional Logic**: - If the Reference Column is null or empty, set the Target Column to an empty string. - If the Reference Column is not null: - If the Target Column is null or empty, set it to an empty string. - If the Target Column contains specific keywords (e.g., 'TPR', '2/3') in any case, set the Target Column to that keyword. - Otherwise, set the Target Column to 'Other'. 2. **Implementation**: - Use `df.apply()` with `axis=1` to ensure correct updates across the DataFrame. - **Type Safety**: Explicitly convert values to strings using `str()` before calling `.upper()` to avoid `AttributeError`
- Prompt
- Triggers
What does the Pandas DataFrame Conditional Column Update based on Reference and Content skill do?
Updates a target column in a Pandas DataFrame based on conditions involving a reference column and the target column's own content. Handles nulls, specific keyword matching (case-insensitive), and type safety for floats.
How do I install it?
Run `npx skills add ECNU-ICALK/AutoSkill --skill pandas-dataframe-conditional-column-update-based-on-reference-an --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.
