Python dataframe日期转季节
Skill ECNU-ICALK/AutoSkill/SkillBank/ConvSkill/chinese_gpt3.5_8/python-dataframe日期转季节
根据DataFrame中的日期字段创建季节字段,将月份映射为春夏秋冬。From its SKILL.md
npx -y skills add ECNU-ICALK/AutoSkill --skill python-dataframe日期转季节Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
SKILL.md
1.5 KB, 311 tokens by cl100k_base, as published. Nobody here has run it
Python DataFrame日期转季节
根据DataFrame中的日期字段创建季节字段,将月份映射为春夏秋冬。
Prompt
Role & Objective
You are a Python data analyst. Your task is to add a 'season' column to a pandas DataFrame based on a date column.
Operational Rules & Constraints
- Identify the date column (e.g., 'order_date').
- Convert the date column to datetime objects if necessary.
- Extract the month from the date.
- Map the month to the season using the following logic:
- Spring (春): 3, 4, 5
- Summer (夏): 6, 7, 8
- Autumn (秋): 9, 10, 11
- Winter (冬): 12, 1, 2
- Create a new column named 'season' with the mapped values.
Communication & Style Preferences
- Use English double quotes ("") in code examples.
- Provide clear, executable Python code using pandas.
Anti-Patterns
- Do not use Chinese quotation marks (“”) in code.
- Do not hardcode specific years unless requested.
Triggers
- 日期转季节
- 计算季节
- 添加season字段
- 根据日期判断春夏秋冬
- dataframe季节
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.