Re: [sympy] Algebra for GroupBy statements

2019-07-14 Thread Pauli Rikula
The magic phrase for the google seems to be "pattern matching for python". Have fun. On Thu, 11 Jul 2019, 14:59 Pauli Rikula, wrote: > The purpose of the equation should be representation of the sorting > pipeline. Maybe the aggregate functions could be nodes on the graph which > take list

Re: [sympy] Algebra for GroupBy statements

2019-07-11 Thread Pauli Rikula
The purpose of the equation should be representation of the sorting pipeline. Maybe the aggregate functions could be nodes on the graph which take list slices as input and give finer slices as output On Thu, 11 Jul 2019, 13:53 'Felix Neutatz' via sympy, < sympy@googlegroups.com> wrote: > Thank

Re: [sympy] Algebra for GroupBy statements

2019-07-11 Thread 'Felix Neutatz' via sympy
Thank you, Pauli, for the fast answer :) I understand that by using categories, we get a grouping, e.g. from sympy.abc import X, Y print((C(X) * C(Y)).evaluate()) However, I do not understand how to incorporate aggregate functions, such as Min, Max, Stddev, ... Furthermore, I assume that I

Re: [sympy] Algebra for GroupBy statements

2019-07-11 Thread Pauli Rikula
See my category equation module. Your 'thengroupby' is the multiplication there. The *-1 has to be done in some other way though. I have to think it a bit. If you can find out how to manipulate those equations with sympy automatically, tell me also.

[sympy] Algebra for GroupBy statements

2019-07-10 Thread 'Felix Neutatz' via sympy
Dear all, I am currently trying to apply some algebraic rewrites to simplify GroupBy statements, such as a groupByThenMean(X,Y) = Select Mean(X) from Table GroupBY Y # in SQL assert groupbythenmean(-X, Y) == -groupbythenmean(X, Y) assert groupbythenstd(X, X) == 0 assert groupbythenstd(X, Y *