Skip to content

内容修改

内容修改 #1

name: Content cleanup 2
on:
push:
branches: [main]
permissions:
contents: write
jobs:
cleanup:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Refine repetitive wording
shell: python
run: |
from pathlib import Path
replacements = [
("操作起来操作可能变得卡顿", "数据量大时操作也可能变得卡顿"),
("Excel打开要等好久,数据量大时操作也可能变得卡顿", "Excel 打开较慢,数据量大时操作也可能变得卡顿"),
("**5行代码,几行代码即可批量完成。**", "**几行代码即可批量完成。**"),
("几行代码搞定!", "几行代码即可完成。"),
("几行代码搞定", "几行代码即可完成"),
("几行就搞定", "几行即可完成"),
("瞬间搞定!", "即可完成。"),
("自动搞定!", "可以直接处理。"),
("自动搞定", "可以直接处理"),
("超方便", "很方便"),
("超级简单", "很简单"),
("超级好用", "很好用"),
("超级灵活", "很灵活"),
("超级直观", "很直观"),
("超级丰富", "很丰富"),
("超级详细", "很详细"),
("Pandas能做什么?几乎所有数据处理的事情!", "Pandas 能覆盖很多常见的数据处理任务。"),
("它让你能像操作Excel表格一样直观,但拥有编程语言的强大能力和无限可能!", "它保留了表格数据的直观性,同时可以把处理步骤写成可重复执行的 Python 代码。"),
("| **数据量限制** | 约100万行(超过就卡) | 几乎无限(只要内存够) |", "| **数据量限制** | 单工作表最多约 104 万行 | 主要受可用内存和数据类型影响 |"),
("如果你用过SQL,你会爱上Pandas,因为它能做SQL能做的一切,而且更灵活!", "如果你用过 SQL,会发现筛选、分组、聚合和连接等操作在 Pandas 中也有相似的表达方式。"),
("**结论**:Pandas不是最强的,但是最全面、最易用、生态最好的!", "**结论**:Pandas 适合常见的表格数据清洗、转换和分析,并且与 Python 科学计算生态衔接良好。"),
("继续加油!", ""),
("继续加油。", ""),
("继续加油", ""),
("✅", ""),
("❌", ""),
]
changed = []
for path in Path(".").rglob("*"):
if not path.is_file() or path.suffix.lower() not in {".md", ".ipynb"}:
continue
text = path.read_text(encoding="utf-8")
new = text
for old, replacement in replacements:
new = new.replace(old, replacement)
if new != text:
path.write_text(new, encoding="utf-8", newline="")
changed.append(str(path))
print(f"changed files: {len(changed)}")
for path in changed:
print(path)
- name: Commit content changes
shell: bash
run: |
rm -f .github/workflows/style-cleanup-2.yml
git config user.name "hujinghaoabcd"
git config user.email "42744442+hujinghaoabcd@users.noreply.github.com"
git add -A
if git diff --cached --quiet; then
exit 0
fi
git commit -m "内容修改"
git push origin main