3 ms·
Interesting. Very nice to see live-updating of results like Excel. Python fails on this transform function: def f(a): v = a if a >= 4 else 2 ret
by ivan_ah 8y ago
Interesting. Very nice to see live-updating of results like Excel.
Python fails on this transform function:
def f(a):
v = a if a >= 4 else 2
return v
Message in red: "Error: (Brython compile error)"
Update: I recommend you try https://pypyjs.org/ https://pypyjs.org/ for python in the browser.
- davedx 8y agoThanks! I’ll look into it. The reason I chose Brython was because it transpiles in the browser, so no server side compilation needed.
- davedx 8y agoI looked into this more. The issue is, at least in a default input, a is an array type, so you need to either access a[0] or map over it. e.g. this works: def f(a): v = a[0] if a[0] >= 4 else 2 return v It looks like the main issue here is getting the correct compile error from Brython. Funnily enough this seems easier to do for the PySpark version :)