Skip to content

Commit

Permalink
Add some docs
Browse files Browse the repository at this point in the history
  • Loading branch information
stinodego committed May 20, 2024
1 parent 172ec86 commit cdcd2ee
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions py-polars/src/to_numpy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,11 @@ pub(crate) fn reshape_numpy_array(
#[pymethods]
#[allow(clippy::wrong_self_convention)]
impl PyDataFrame {
/// Create a view of the data as a NumPy ndarray.
///
/// WARNING: The resulting view will show the underlying value for nulls,
/// which may be any value. The caller is responsible for handling nulls
/// appropriately.
pub fn to_numpy_view(&self, py: Python) -> Option<PyObject> {
if self.df.is_empty() {
return None;
Expand Down Expand Up @@ -320,6 +325,7 @@ impl PyDataFrame {
})
}

/// Convert this DataFrame to a NumPy ndarray.
pub fn to_numpy(&self, py: Python, order: Wrap<IndexOrder>) -> Option<PyObject> {
let st = dtypes_to_supertype(self.df.iter().map(|s| s.dtype())).ok()?;

Expand Down

0 comments on commit cdcd2ee

Please sign in to comment.