by account-5 · 4y ago · 0 comments
It has a rather different api, and is significantly faster. Highly recommend it.
So you are one `df.to_numpy()/df.to_pandas()` away to `X` libary you want to use.
Or you can convert it directly into a pandas Df
Background: I first gained some experience with J, where I first learned to appreciate the advantages of array languages. The main advantage is actually having your own way of thinking about processing multidimensional data. Now, recently, I've gotten into the notation of APL, and it's really even cooler than the ASCII "noise" of J. The symbols make it easier for me to both write and read programs. Admittedly, for more complex operations with data it takes a lot of learning that you usually don't have. But for simple transformation APL is already quite fast usable and convinces beyond the "mainstream".
From https://docs.python.org/3/howto/functional.html it's got map/filter/currying and plenty more, what's misting in your view?
nothing intrinsically 'functional' about this, though it's nice
> syntax for partial application
<https://docs.python.org/3/library/functools.html#functools.p...>
> and composition,
Hmm, to my surprise I can't find this but TBH it's trivial to write, here's an eg <https://stackoverflow.com/questions/16739290/composing-funct...>
> a typing system which can express structural types,
typing is orthogonal to FP (though very nice to have)
> a generalised list comprehension
IDK what this means, what's ungeneral about comprehensions currently?
Available in 3.10: https://peps.python.org/pep-0636/
> syntax for partial application...
from functools import partial
somefunc_arg1_arg2 = partial(somefunc, arg1, arg2)
> ...and compositionA native compositional syntax would be nice.
> a typing system which can express structural types
# mypy will typecheck this code and see `MyString()` has a `.read()` method, so it's a `Readable` even though it doesn't sub-class `Readable`
from typing import Any, Protocol
class Readable(Protocol):
def read(self) -> Any: ...
def read_something(something: Readable) -> Any:
return something.read()
class MyString:
a_string: str = "something"
def read(self) -> str:
return self.a_string
read_something(MyString())
> a generalised list comprehensionI agree this would be nice.
https://github.com/otsaloma/dataiter
Here's a comparison of dplyr vs. Dataiter vs. Pandas, which should give quick overview of the similarieties and differences.
https://dataiter.readthedocs.io/en/latest/_static/comparison...