Skip to content

Commit

Permalink
add series sphinx docs entry and mark unstable
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-beedie committed May 19, 2024
1 parent 1e41760 commit a68782a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion crates/polars-core/src/chunked_array/ops/aggregate/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ where
}
}

/// Booleans are casted to 1 or 0.
/// Booleans are cast to 1 or 0.
impl BooleanChunked {
pub fn sum(&self) -> Option<IdxSize> {
Some(if self.is_empty() {
Expand Down
2 changes: 2 additions & 0 deletions py-polars/docs/source/reference/series/export.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ Export Series data to other formats:

Series.to_arrow
Series.to_frame
Series.to_jax
Series.to_list
Series.to_numpy
Series.to_pandas
Series.to_init_repr
Series.to_torch
14 changes: 14 additions & 0 deletions py-polars/polars/series/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -4476,10 +4476,17 @@ def to_numpy(

return self._s.to_numpy(allow_copy=allow_copy, writable=writable)

@unstable()
def to_jax(self, device: jax.Device | str | None = None) -> jax.Array:
"""
Convert this Series to a Jax Array.
.. versionadded:: 0.20.27
.. warning::
This functionality is currently considered **unstable**. It may be
changed at any point without it being considered a breaking change.
Parameters
----------
device
Expand Down Expand Up @@ -4519,10 +4526,17 @@ def to_jax(self, device: jax.Device | str | None = None) -> jax.Array:
order="K",
)

@unstable()
def to_torch(self) -> torch.Tensor:
"""
Convert this Series to a PyTorch Tensor.
.. versionadded:: 0.20.23
.. warning::
This functionality is currently considered **unstable**. It may be
changed at any point without it being considered a breaking change.
Examples
--------
>>> s = pl.Series("x", [1, 0, 1, 2, 0], dtype=pl.UInt8)
Expand Down

0 comments on commit a68782a

Please sign in to comment.