Path: blob/main/crates/polars-python/src/dataframe/mod.rs
7889 views
#[cfg(feature = "pymethods")]1mod construction;2#[cfg(feature = "pymethods")]3mod export;4#[cfg(feature = "pymethods")]5mod general;6#[cfg(feature = "pymethods")]7mod io;8#[cfg(feature = "pymethods")]9mod map;10#[cfg(feature = "pymethods")]11mod serde;1213use parking_lot::RwLock;14use polars::prelude::DataFrame;15use pyo3::pyclass;1617#[pyclass(frozen)]18#[repr(transparent)]19pub struct PyDataFrame {20pub df: RwLock<DataFrame>,21}2223impl Clone for PyDataFrame {24fn clone(&self) -> Self {25PyDataFrame {26df: RwLock::new(self.df.read().clone()),27}28}29}3031impl From<DataFrame> for PyDataFrame {32fn from(df: DataFrame) -> Self {33Self::new(df)34}35}3637impl From<PyDataFrame> for DataFrame {38fn from(pdf: PyDataFrame) -> Self {39pdf.df.into_inner()40}41}4243impl PyDataFrame {44pub(crate) fn new(df: DataFrame) -> Self {45PyDataFrame {46df: RwLock::new(df),47}48}49}505152