Skip to content

Commit ac04061

Browse files
Copilotmrjf
andauthored
Add CI Python validation, fix ewm.html, update pages.yml and ci.yml workflows
Agent-Logs-Url: https://github.com/githubnext/tsessebe/sessions/6dab294e-9636-49b9-bcf3-918c3a4b9c3c Co-authored-by: mrjf <180956+mrjf@users.noreply.github.com>
1 parent 602d897 commit ac04061

3 files changed

Lines changed: 30 additions & 3 deletions

File tree

.github/workflows/ci.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,20 @@ jobs:
5959
with:
6060
name: dist
6161
path: dist/
62+
63+
validate-python-examples:
64+
name: Validate Python Examples
65+
runs-on: ubuntu-latest
66+
steps:
67+
- uses: actions/checkout@v4
68+
69+
- name: Setup Python
70+
uses: actions/setup-python@v5
71+
with:
72+
python-version: "3.12"
73+
74+
- name: Install Python dependencies
75+
run: pip install pandas numpy
76+
77+
- name: Validate Python playground examples
78+
run: python scripts/validate-python-examples.py playground/

.github/workflows/pages.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,17 @@ jobs:
3636
- name: Bundle TypeScript compiler for offline playground
3737
run: cp node_modules/typescript/lib/typescript.js ./playground/dist/typescript.js
3838

39+
- name: Setup Python
40+
uses: actions/setup-python@v5
41+
with:
42+
python-version: "3.12"
43+
44+
- name: Install Python dependencies
45+
run: pip install pandas numpy
46+
47+
- name: Validate Python playground examples
48+
run: python scripts/validate-python-examples.py playground/
49+
3950
- name: Setup Pages
4051
uses: actions/configure-pages@v5
4152
with:

playground/ewm.html

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -542,13 +542,12 @@ <h2>9 · Custom apply</h2>
542542
);
543543
console.log("weighted sum:", ewmWeightedSum.values);</textarea>
544544
<textarea class="playground-python" style="display:none">import pandas as pd
545-
import numpy as np
546545

547546
s = pd.Series([1, 2, 3, 4, 5])
548547

549548
# EWM weighted sum (equivalent to unadjusted numerator)
550-
# Note: pandas ewm.apply() does not pass weights; custom logic needed
551-
ewm_weighted_sum = s.ewm(alpha=0.5).apply(lambda vals: sum(vals), raw=True)
549+
# Note: pandas 3.0 removed ewm().apply(); use ewm().sum() instead
550+
ewm_weighted_sum = s.ewm(alpha=0.5).sum()
552551
print("weighted sum:", list(ewm_weighted_sum))</textarea>
553552
<div class="playground-output">Click ▶ Run to execute</div>
554553
<div class="playground-hint">Ctrl+Enter to run · Tab to indent</div>

0 commit comments

Comments
 (0)