#[repr(transparent)]pub struct PyDataFrame {
pub df: DataFrame,
}
Fields§
§df: DataFrame
Implementations§
Source§impl PyDataFrame
impl PyDataFrame
pub fn from_rows( py: Python<'_>, data: Vec<Wrap<Row<'_>>>, schema: Option<Wrap<Schema>>, infer_schema_length: Option<usize>, ) -> PyResult<Self>
pub fn from_dicts( py: Python<'_>, data: &Bound<'_, PyAny>, schema: Option<Wrap<Schema>>, schema_overrides: Option<Wrap<Schema>>, strict: bool, infer_schema_length: Option<usize>, ) -> PyResult<Self>
pub fn from_arrow_record_batches( py: Python<'_>, rb: Vec<Bound<'_, PyAny>>, schema: Bound<'_, PyAny>, ) -> PyResult<Self>
Source§impl PyDataFrame
impl PyDataFrame
pub fn row_tuple<'py>( &self, idx: i64, py: Python<'py>, ) -> PyResult<Bound<'py, PyTuple>>
pub fn row_tuples<'py>(&self, py: Python<'py>) -> PyResult<Bound<'py, PyList>>
pub fn to_arrow( &mut self, py: Python<'_>, compat_level: PyCompatLevel, ) -> PyResult<Vec<PyObject>>
Sourcepub fn to_pandas(&mut self, py: Python<'_>) -> PyResult<Vec<PyObject>>
pub fn to_pandas(&mut self, py: Python<'_>) -> PyResult<Vec<PyObject>>
Create a Vec
of PyArrow RecordBatch instances.
Note this will give bad results for columns with dtype pl.Object
,
since those can’t be converted correctly via PyArrow. The calling Python
code should make sure these are not included.
Source§impl PyDataFrame
impl PyDataFrame
pub fn __init__(columns: Vec<PySeries>) -> PyResult<Self>
pub fn estimated_size(&self) -> usize
pub fn dtype_strings(&self) -> Vec<String>
pub fn add(&self, py: Python<'_>, s: &PySeries) -> PyResult<Self>
pub fn sub(&self, py: Python<'_>, s: &PySeries) -> PyResult<Self>
pub fn div(&self, py: Python<'_>, s: &PySeries) -> PyResult<Self>
pub fn mul(&self, py: Python<'_>, s: &PySeries) -> PyResult<Self>
pub fn rem(&self, py: Python<'_>, s: &PySeries) -> PyResult<Self>
pub fn add_df(&self, py: Python<'_>, s: &Self) -> PyResult<Self>
pub fn sub_df(&self, py: Python<'_>, s: &Self) -> PyResult<Self>
pub fn div_df(&self, py: Python<'_>, s: &Self) -> PyResult<Self>
pub fn mul_df(&self, py: Python<'_>, s: &Self) -> PyResult<Self>
pub fn rem_df(&self, py: Python<'_>, s: &Self) -> PyResult<Self>
pub fn sample_n( &self, py: Python<'_>, n: &PySeries, with_replacement: bool, shuffle: bool, seed: Option<u64>, ) -> PyResult<Self>
pub fn sample_frac( &self, py: Python<'_>, frac: &PySeries, with_replacement: bool, shuffle: bool, seed: Option<u64>, ) -> PyResult<Self>
pub fn rechunk(&self, py: Python<'_>) -> Self
pub fn get_columns(&self) -> Vec<PySeries>
Sourcepub fn set_column_names(&mut self, names: Vec<PyBackedStr>) -> PyResult<()>
pub fn set_column_names(&mut self, names: Vec<PyBackedStr>) -> PyResult<()>
set column names
pub fn n_chunks(&self) -> usize
pub fn shape(&self) -> (usize, usize)
pub fn height(&self) -> usize
pub fn width(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn hstack(&self, py: Python<'_>, columns: Vec<PySeries>) -> PyResult<Self>
pub fn hstack_mut( &mut self, py: Python<'_>, columns: Vec<PySeries>, ) -> PyResult<()>
pub fn vstack(&self, py: Python<'_>, other: &PyDataFrame) -> PyResult<Self>
pub fn vstack_mut( &mut self, py: Python<'_>, other: &PyDataFrame, ) -> PyResult<()>
pub fn extend(&mut self, py: Python<'_>, other: &PyDataFrame) -> PyResult<()>
pub fn drop_in_place(&mut self, name: &str) -> PyResult<PySeries>
pub fn to_series(&self, index: isize) -> PyResult<PySeries>
pub fn get_column_index(&self, name: &str) -> PyResult<usize>
pub fn get_column(&self, name: &str) -> PyResult<PySeries>
pub fn select( &self, py: Python<'_>, columns: Vec<PyBackedStr>, ) -> PyResult<Self>
pub fn gather( &self, py: Python<'_>, indices: Wrap<Vec<IdxSize>>, ) -> PyResult<Self>
pub fn gather_with_series( &self, py: Python<'_>, indices: &PySeries, ) -> PyResult<Self>
pub fn replace(&mut self, column: &str, new_col: PySeries) -> PyResult<()>
pub fn replace_column( &mut self, index: usize, new_column: PySeries, ) -> PyResult<()>
pub fn insert_column(&mut self, index: usize, column: PySeries) -> PyResult<()>
pub fn slice(&self, py: Python<'_>, offset: i64, length: Option<usize>) -> Self
pub fn head(&self, py: Python<'_>, n: usize) -> Self
pub fn tail(&self, py: Python<'_>, n: usize) -> Self
pub fn is_unique(&self, py: Python<'_>) -> PyResult<PySeries>
pub fn is_duplicated(&self, py: Python<'_>) -> PyResult<PySeries>
pub fn equals( &self, py: Python<'_>, other: &PyDataFrame, null_equal: bool, ) -> bool
pub fn with_row_index( &self, py: Python<'_>, name: &str, offset: Option<IdxSize>, ) -> PyResult<Self>
pub fn _to_metadata(&self) -> Self
pub fn group_by_map_groups( &self, by: Vec<PyBackedStr>, lambda: PyObject, maintain_order: bool, ) -> PyResult<Self>
pub fn clone(&self) -> Self
pub fn unpivot( &self, py: Python<'_>, on: Vec<PyBackedStr>, index: Vec<PyBackedStr>, value_name: Option<&str>, variable_name: Option<&str>, ) -> PyResult<Self>
pub fn pivot_expr( &self, py: Python<'_>, on: Vec<String>, index: Option<Vec<String>>, values: Option<Vec<String>>, maintain_order: bool, sort_columns: bool, aggregate_expr: Option<PyExpr>, separator: Option<&str>, ) -> PyResult<Self>
pub fn partition_by( &self, py: Python<'_>, by: Vec<String>, maintain_order: bool, include_key: bool, ) -> PyResult<Vec<Self>>
pub fn lazy(&self) -> PyLazyFrame
pub fn to_dummies( &self, py: Python<'_>, columns: Option<Vec<String>>, separator: Option<&str>, drop_first: bool, ) -> PyResult<Self>
pub fn null_count(&self, py: Python<'_>) -> Self
pub fn map_rows( &mut self, lambda: Bound<'_, PyAny>, output_type: Option<Wrap<DataType>>, inference_size: usize, ) -> PyResult<(PyObject, bool)>
pub fn shrink_to_fit(&mut self, py: Python<'_>)
pub fn hash_rows( &mut self, py: Python<'_>, k0: u64, k1: u64, k2: u64, k3: u64, ) -> PyResult<PySeries>
pub fn transpose( &mut self, py: Python<'_>, keep_names_as: Option<&str>, column_names: &Bound<'_, PyAny>, ) -> PyResult<Self>
pub fn upsample( &self, py: Python<'_>, by: Vec<String>, index_column: &str, every: &str, stable: bool, ) -> PyResult<Self>
pub fn to_struct( &self, py: Python<'_>, name: &str, invalid_indices: Vec<usize>, ) -> PySeries
pub fn clear(&self, py: Python<'_>) -> Self
pub fn into_raw_parts(&mut self) -> (usize, usize, usize)
Source§impl PyDataFrame
impl PyDataFrame
pub fn read_csv( py: Python<'_>, py_f: Bound<'_, PyAny>, infer_schema_length: Option<usize>, chunk_size: usize, has_header: bool, ignore_errors: bool, n_rows: Option<usize>, skip_rows: usize, skip_lines: usize, projection: Option<Vec<usize>>, separator: &str, rechunk: bool, columns: Option<Vec<String>>, encoding: Wrap<CsvEncoding>, n_threads: Option<usize>, path: Option<String>, overwrite_dtype: Option<Vec<(PyBackedStr, Wrap<DataType>)>>, overwrite_dtype_slice: Option<Vec<Wrap<DataType>>>, low_memory: bool, comment_prefix: Option<&str>, quote_char: Option<&str>, null_values: Option<Wrap<NullValues>>, missing_utf8_is_empty_string: bool, try_parse_dates: bool, skip_rows_after_header: usize, row_index: Option<(String, IdxSize)>, eol_char: &str, raise_if_empty: bool, truncate_ragged_lines: bool, decimal_comma: bool, schema: Option<Wrap<Schema>>, ) -> PyResult<Self>
pub fn read_parquet( py: Python<'_>, py_f: PyObject, columns: Option<Vec<String>>, projection: Option<Vec<usize>>, n_rows: Option<usize>, row_index: Option<(String, IdxSize)>, low_memory: bool, parallel: Wrap<ParallelStrategy>, use_statistics: bool, rechunk: bool, ) -> PyResult<Self>
pub fn read_json( py: Python<'_>, py_f: Bound<'_, PyAny>, infer_schema_length: Option<usize>, schema: Option<Wrap<Schema>>, schema_overrides: Option<Wrap<Schema>>, ) -> PyResult<Self>
pub fn read_ndjson( py: Python<'_>, py_f: Bound<'_, PyAny>, ignore_errors: bool, schema: Option<Wrap<Schema>>, schema_overrides: Option<Wrap<Schema>>, ) -> PyResult<Self>
pub fn read_ipc( py: Python<'_>, py_f: Bound<'_, PyAny>, columns: Option<Vec<String>>, projection: Option<Vec<usize>>, n_rows: Option<usize>, row_index: Option<(String, IdxSize)>, memory_map: bool, ) -> PyResult<Self>
pub fn read_ipc_stream( py: Python<'_>, py_f: Bound<'_, PyAny>, columns: Option<Vec<String>>, projection: Option<Vec<usize>>, n_rows: Option<usize>, row_index: Option<(String, IdxSize)>, rechunk: bool, ) -> PyResult<Self>
pub fn read_avro( py: Python<'_>, py_f: PyObject, columns: Option<Vec<String>>, projection: Option<Vec<usize>>, n_rows: Option<usize>, ) -> PyResult<Self>
pub fn write_csv( &mut self, py: Python<'_>, py_f: PyObject, include_bom: bool, include_header: bool, separator: u8, line_terminator: String, quote_char: u8, batch_size: NonZeroUsize, datetime_format: Option<String>, date_format: Option<String>, time_format: Option<String>, float_scientific: Option<bool>, float_precision: Option<usize>, null_value: Option<String>, quote_style: Option<Wrap<QuoteStyle>>, cloud_options: Option<Vec<(String, String)>>, credential_provider: Option<PyObject>, retries: usize, ) -> PyResult<()>
pub fn write_parquet( &mut self, py: Python<'_>, py_f: PyObject, compression: &str, compression_level: Option<i32>, statistics: Wrap<StatisticsOptions>, row_group_size: Option<usize>, data_page_size: Option<usize>, partition_by: Option<Vec<String>>, partition_chunk_size_bytes: usize, cloud_options: Option<Vec<(String, String)>>, credential_provider: Option<PyObject>, retries: usize, ) -> PyResult<()>
pub fn write_json(&mut self, py_f: PyObject) -> PyResult<()>
pub fn write_ndjson(&mut self, py_f: PyObject) -> PyResult<()>
pub fn write_ipc( &mut self, py: Python<'_>, py_f: PyObject, compression: Wrap<Option<IpcCompression>>, compat_level: PyCompatLevel, cloud_options: Option<Vec<(String, String)>>, credential_provider: Option<PyObject>, retries: usize, ) -> PyResult<()>
pub fn write_ipc_stream( &mut self, py: Python<'_>, py_f: PyObject, compression: Wrap<Option<IpcCompression>>, compat_level: PyCompatLevel, ) -> PyResult<()>
pub fn write_avro( &mut self, py: Python<'_>, py_f: PyObject, compression: Wrap<Option<AvroCompression>>, name: String, ) -> PyResult<()>
Source§impl PyDataFrame
impl PyDataFrame
Trait Implementations§
Source§impl Clone for PyDataFrame
impl Clone for PyDataFrame
Source§fn clone(&self) -> PyDataFrame
fn clone(&self) -> PyDataFrame
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl From<DataFrame> for PyDataFrame
impl From<DataFrame> for PyDataFrame
Source§impl<'py> IntoPyObject<'py> for PyDataFrame
impl<'py> IntoPyObject<'py> for PyDataFrame
Source§type Target = PyDataFrame
type Target = PyDataFrame
The Python output type
Source§type Output = Bound<'py, <PyDataFrame as IntoPyObject<'py>>::Target>
type Output = Bound<'py, <PyDataFrame as IntoPyObject<'py>>::Target>
The smart pointer type to use. Read more
Source§fn into_pyobject(
self,
py: Python<'py>,
) -> Result<<Self as IntoPyObject<'_>>::Output, <Self as IntoPyObject<'_>>::Error>
fn into_pyobject( self, py: Python<'py>, ) -> Result<<Self as IntoPyObject<'_>>::Output, <Self as IntoPyObject<'_>>::Error>
Performs the conversion.
Source§impl PyClass for PyDataFrame
impl PyClass for PyDataFrame
Source§impl PyClassImpl for PyDataFrame
impl PyClassImpl for PyDataFrame
Source§const IS_BASETYPE: bool = false
const IS_BASETYPE: bool = false
#[pyclass(subclass)]
Source§const IS_SUBCLASS: bool = false
const IS_SUBCLASS: bool = false
#[pyclass(extends=…)]
Source§const IS_MAPPING: bool = false
const IS_MAPPING: bool = false
#[pyclass(mapping)]
Source§const IS_SEQUENCE: bool = false
const IS_SEQUENCE: bool = false
#[pyclass(sequence)]
Source§type ThreadChecker = SendablePyClass<PyDataFrame>
type ThreadChecker = SendablePyClass<PyDataFrame>
This handles following two situations: Read more
type Inventory = Pyo3MethodsInventoryForPyDataFrame
Source§type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
Immutable or mutable
Source§type BaseNativeType = PyAny
type BaseNativeType = PyAny
The closest native ancestor. This is
PyAny
by default, and when you declare
#[pyclass(extends=PyDict)]
, it’s PyDict
.fn items_iter() -> PyClassItemsIter
fn lazy_type_object() -> &'static LazyTypeObject<Self>
fn dict_offset() -> Option<isize>
fn weaklist_offset() -> Option<isize>
Source§impl PyClassNewTextSignature<PyDataFrame> for PyClassImplCollector<PyDataFrame>
impl PyClassNewTextSignature<PyDataFrame> for PyClassImplCollector<PyDataFrame>
fn new_text_signature(self) -> Option<&'static str>
Source§impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a PyDataFrame
impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a PyDataFrame
Source§impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a mut PyDataFrame
impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a mut PyDataFrame
Source§impl PyTypeInfo for PyDataFrame
impl PyTypeInfo for PyDataFrame
Source§fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
Returns the PyTypeObject instance for this type.
Source§fn type_object(py: Python<'_>) -> Bound<'_, PyType>
fn type_object(py: Python<'_>) -> Bound<'_, PyType>
Returns the safe abstraction over the type object.
Source§fn type_object_bound(py: Python<'_>) -> Bound<'_, PyType>
fn type_object_bound(py: Python<'_>) -> Bound<'_, PyType>
👎Deprecated since 0.23.0: renamed to
PyTypeInfo::type_object
Deprecated name for
PyTypeInfo::type_object
.Source§fn is_type_of(object: &Bound<'_, PyAny>) -> bool
fn is_type_of(object: &Bound<'_, PyAny>) -> bool
Checks if
object
is an instance of this type or a subclass of this type.Source§fn is_type_of_bound(object: &Bound<'_, PyAny>) -> bool
fn is_type_of_bound(object: &Bound<'_, PyAny>) -> bool
👎Deprecated since 0.23.0: renamed to
PyTypeInfo::is_type_of
Deprecated name for
PyTypeInfo::is_type_of
.Source§fn is_exact_type_of(object: &Bound<'_, PyAny>) -> bool
fn is_exact_type_of(object: &Bound<'_, PyAny>) -> bool
Checks if
object
is an instance of this type.Source§fn is_exact_type_of_bound(object: &Bound<'_, PyAny>) -> bool
fn is_exact_type_of_bound(object: &Bound<'_, PyAny>) -> bool
👎Deprecated since 0.23.0: renamed to
PyTypeInfo::is_exact_type_of
Deprecated name for
PyTypeInfo::is_exact_type_of
.impl DerefToPyAny for PyDataFrame
Auto Trait Implementations§
impl !Freeze for PyDataFrame
impl !RefUnwindSafe for PyDataFrame
impl Send for PyDataFrame
impl Sync for PyDataFrame
impl Unpin for PyDataFrame
impl !UnwindSafe for PyDataFrame
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FromPyObject<'_> for T
impl<T> FromPyObject<'_> for T
Source§impl<'py, T> FromPyObjectBound<'_, 'py> for Twhere
T: FromPyObject<'py>,
impl<'py, T> FromPyObjectBound<'_, 'py> for Twhere
T: FromPyObject<'py>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
impl<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
Source§fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>
fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>
Converts
self
into an owned Python object, dropping type information.