4 ms·
I would say that pandas and R can pretty much express everything that APL/J/Q can. They are a lot slower though (than Q atleast, I haven’t used J or APL)
by mruts 8y ago
I would say that pandas and R can pretty much express everything that APL/J/Q can. They are a lot slower though (than Q atleast, I haven’t used J or APL)
- macleginn 8y agoTheir another downside, I guess, is that they are wildly inelegant. R is inelegant in its core, despite all the nice functionality, and Pandas, IMO, presents a rather ugly addition to the regular Python syntax despite all its nice functionality. So people still yearn for things pure and beautiful.
- disgruntledphd2 8y agoPandas looks like R from around 2010. Now, granted, I can see how R is perceived as inelegant, but I strongly believe that this is driven by unfamiliarity (for many people).
- 4thaccount 8y agoThis is like saying a Turing complete language can simulate everything another Turing complete language can. A decent sized idiomatic APL program will be very different from the same Python program only using Numpy, even if the outputs are the same.
- mruts 8y agoDo you mean pandas? numpy isn’t very similar to APL like functionality at all. On the otherhand, pandas is very similar though much much less elegant.
- 4thaccount 8y agoYes and No. Pandas does the data frame stuff and various calcs, but you need Numpy to do things like invert a matrix unless Pandas supports that as well. APL combines a lot of that in a single coherant package.
- beagle3 8y agoBasic operations, yes. Composabilitu, not quite. I don’t remember enough APL, so my examples are K: Maximum subarray sum: |/(0|+)\ Flatten: ,// Rank: << In these examples, every single character is its own operation, and they compose to give another useful operation. Any Turing complete language can express what any other Turing complete language can (by definition). And pandas/r do provide APL’s vector and matrix operations. But not the composability, which IMHO is just as important to what this family brings to the table.
- mruts 8y agoWell 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.