Comments (9)
A bit of context on my rationale to not have this included on the Series
trait is that this will be compiled for every datatype in polars.
Doing so for many operations will put a lot of constrain on compile times of polars-core.
The recommended way for a user to apply a numeric operation like pow
, sin
exp
etc. is downcasting the Series
to the ChunkedArray
and then calling apply
Something like this.
let s = Series::new("foo", [1i32, 2, 3]);
s.i32()?.apply(|v| v.pow(3)).into_series()
Given that Explorer defines bindings to polars, you'd need to pattern match on the dtype
and downcast to the appropriate type.
from explorer.
@kimjoaoun that's probably the best in terms of having a record to point to for others contributing. But you can also get me on the EEF or Elixir slacks (same username) or via email at chris at amplified dot ai.
And thanks for taking it on!
from explorer.
Nah, you are being very helpful. Contributions are very welcome! :)
from explorer.
Good catch. Unfortunately this is because polars
only takes f64
for the pow
method: https://docs.rs/polars/0.18.0/polars/prelude/trait.SeriesTrait.html#method.pow.
I'm sure we could work around it, and at the very least document it!
from explorer.
@kimjoaoun if you could also ping polars folks and ask if they want to support an int version. It could be a good contribution upstream! ❤️
from explorer.
@josevalim I'll ping them!
(se eu estiver sendo chato abrindo várias issues, por favor, me avise)
from explorer.
@josevalim It looks like pow() will be removed, so I think they'll not support an int
version. I think we would need to do what ritchie46 suggested and coerce our integer
to a float
.
from explorer.
Thanks for the clarification @ritchie46! That makes total sense as a preferred path forward.
I'm fighting against a Wednesday deadline with work at the minute but could pick this up after. Otherwise @kimjoaoun if you're keen then I can definitely give some guidance and would be happy to review a PR.
from explorer.
@cigrainger I accept the guidance, I'll start working on that. If I have a question should I contact you via a PR comment?
from explorer.
Related Issues (20)
- `Explorer.Series.cut` crashes when series is a dataframe field HOT 1
- Add binding to str.slice and/or str.split and/or add trim/2 HOT 6
- `DataFrame.from_csv` incorrectly reads "NA" as `nil` HOT 2
- [Question] Linting Elixir code as an Elixir beginner HOT 1
- Pairwise operations HOT 2
- mutate only certain rows based on a filter? HOT 5
- It is not clear how to filter on categories HOT 3
- Aggregate a series to list in groupby HOT 2
- Missing behaviour on filtering DataFrames on categories. HOT 3
- &Explorer.DataFrame.print/2 does not print header names if no options is provided HOT 4
- Pass dtype to Series callbacks
- Use sink cloud versions of parquet and ipc HOT 2
- Date(time) to Calendar week
- Drop_nil for Series missing HOT 7
- Regex for Series.contains additional documentation needed. Perhaps not working?
- missing replace/3 expression HOT 1
- ** (FunctionClauseError) no function clause matching in Explorer.PolarsBackend.Shared.normalise_dtype/1 HOT 1
- Add a cheatsheet HOT 8
- Revisit `Series.mask` vs. `Series.filter` HOT 19
- Can't compile `polars-lazy` with `nightly-2023-10-12` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from explorer.