3 ms·
Well every pandas operation returns a DataFrame so that’s pretty composable. No doubt APL-likes are much nicer than pandas but in terms of operations, I belive
by mruts 8y ago
Well every pandas operation returns a DataFrame so that’s pretty composable.
No doubt APL-likes are much nicer than pandas but in terms of operations, I belive they support the same operations.
- geocar 8y ago, is a function, not dissimilar to pd.concat and indeed, x,y is very similar to pd.concat([x,y]) / is an operator. It's similar to functools.reduce. ,/ is a function, not dissimilar to pd.concat, ,/x is pd.concat(x) which is a little weird. It's tricky, but not impossible to implement functools.reduce(lambda x,y: pd.concat([y,x]), x) but I might've gotten the order of the arguments wrong. ,// is also a function. I think you can do pd.concat(x).values.flatten(), but this obviously doesn't compose. I don't see how you can implement it with another functools.reduce but maybe functools.reduce operates on dataframes after all, so maybe it's just functools.reduce(lambda x,y: pd.concat([y,x.values.flatten()]), functools.reduce(lambda x,y: pd.concat([y,x]), x)) but I have no idea: pd.concat(x).values.flatten() is shorter so I can't imagine anyone would prefer trying to make this monstrosity work. Being "much nicer" is everything. If the syntax, and the rules for the syntactic elements means nothing, and you are fine with merely the ability to write the transformations, then you haven't thought about this clearly: VB6 is the same as Pandas since it too supports the same operations (or they can be implemented, as they can be in any turing-complete, and many non-turing-complete languages), but I find this line of thinking quite insulting: Pandas is much better for data programming than VB6, and whether you know it (or like it) or not, APL and their ilk are much better than Pandas for data programming.
- beagle3 8y agoThe second / is converge, rather than reduce - I don’t think python (or pandas) has it in a common library - and even if it did, usage would be ultra clunky. Your description is excellent, just wanted to make it more precise.