pub struct DataFrame {
pub constants: HashMap<Key, DataValue>,
pub dataframe: ColumnFrame,
pub metadata: HashMap<String, DataValue>,
}Expand description
DataFrame holds information about ColumnFrame.
This is used to store the data and the metadata for the candidates.
§Columns Storage
The underlying data is stored in row-major order using ndarray’s Array2.
Use select() for row-oriented access and select_transposed() for column-oriented access.
§Example
use trs_dataframe::{DataFrame, column_frame};
let df = DataFrame::new(column_frame! {
"a" => [1, 2, 3],
"b" => [4, 5, 6]
});
// Get all data as 2D array (rows x columns)
let all_data = df.select(None);
// Get specific columns
let keys = vec!["a".into(), "b".into()];
let selected = df.select(Some(&keys));Fields§
§constants: HashMap<Key, DataValue>Constants for the dataframe - mikro optimization for the data Values which is constant for the whole dataframe are stored here These values are applied to all rows without storing them per-row
dataframe: ColumnFrameInternal columnar storage for row data
metadata: HashMap<String, DataValue>Metadata for the dataframe. Here you can store the information about the dataframe This is user-defined key-value metadata that doesn’t affect data operations
Implementations§
Source§impl DataFrame
impl DataFrame
Sourcepub fn from_dict(df: HashMap<String, Vec<DataValue>>) -> Self
pub fn from_dict(df: HashMap<String, Vec<DataValue>>) -> Self
Create a DataFrame from a dictionary.
df = tdf.DataFrame.from_dict({"a": [1, 2, 3], "b": [4, 5, 6]})Sourcepub fn set_dtype_for_column(
&mut self,
key: String,
dtype: DataType,
) -> PyResult<()>
pub fn set_dtype_for_column( &mut self, key: String, dtype: DataType, ) -> PyResult<()>
Convert the DataFrame to polars DataFrame.
df = tdf.DataFrame.from_dict({"a": [1, 2, 3], "b": [4, 5, 6]});
df.set_dtype_for_column("a", trs.DataType.I32)Sourcepub fn apply(&mut self, function: Bound<'_, PyAny>) -> Result<(), PyErr>
pub fn apply(&mut self, function: Bound<'_, PyAny>) -> Result<(), PyErr>
Apply a function to the DataFrame. The function should accept a DataFrame and return a DataFrame.
def my_function(df):
# Perform some operations on the DataFrame
return df
/// df = tdf.DataFrame.init()
df.apply(my_function)Sourcepub fn as_numpy_u32<'py>(
&self,
keys: Option<Vec<String>>,
transposed: Option<bool>,
py: Python<'py>,
) -> PyResult<Bound<'py, PyArray2<u32>>>
pub fn as_numpy_u32<'py>( &self, keys: Option<Vec<String>>, transposed: Option<bool>, py: Python<'py>, ) -> PyResult<Bound<'py, PyArray2<u32>>>
Returns slice from dataframe as numpy.array of uint32 of the given keys.
If transposed is true, the keys will be transposed.
If keys is None, all keys will be used.
import numpy as np
df = tdf.DataFrame.init()
df.push({"key1": 1, "key2": 2})
df.push({"key1": 11, "key2": 21})
a_np = df.as_numpy_u32(['key1', 'key2'])
assert np.array_equal(a_np, np.array([[1, 11], [2, 21]], dtype=np.uint32))Sourcepub fn as_numpy_u64<'py>(
&self,
keys: Option<Vec<String>>,
transposed: Option<bool>,
py: Python<'py>,
) -> PyResult<Bound<'py, PyArray2<u64>>>
pub fn as_numpy_u64<'py>( &self, keys: Option<Vec<String>>, transposed: Option<bool>, py: Python<'py>, ) -> PyResult<Bound<'py, PyArray2<u64>>>
Returns slice from dataframe as numpy.array of uint64 of the given keys.
If transposed is true, the keys will be transposed.
If keys is None, all keys will be used.
import numpy as np
df = tdf.DataFrame.init()
df.push({"key1": 1, "key2": 2})
df.push({"key1": 11, "key2": 21})
a_np = df.as_numpy_u64(['key1', 'key2'])
assert np.array_equal(a_np, np.array([[1, 11], [2, 21]], dtype=np.uint64))Sourcepub fn as_numpy_i32<'py>(
&self,
keys: Option<Vec<String>>,
transposed: Option<bool>,
py: Python<'py>,
) -> PyResult<Bound<'py, PyArray2<i32>>>
pub fn as_numpy_i32<'py>( &self, keys: Option<Vec<String>>, transposed: Option<bool>, py: Python<'py>, ) -> PyResult<Bound<'py, PyArray2<i32>>>
Returns slice from dataframe as numpy.array of int32 of the given keys.
If transposed is true, the keys will be transposed.
If keys is None, all keys will be used.
import numpy as np
df = tdf.DataFrame.init()
df.push({"key1": 1, "key2": 2})
df.push({"key1": 11, "key2": 21})
a_np = df.as_numpy_i32(['key1', 'key2'])
assert np.array_equal(a_np, np.array([[1, 11], [2, 21]], dtype=np.int32))Sourcepub fn as_numpy_i64<'py>(
&self,
keys: Option<Vec<String>>,
transposed: Option<bool>,
py: Python<'py>,
) -> PyResult<Bound<'py, PyArray2<i64>>>
pub fn as_numpy_i64<'py>( &self, keys: Option<Vec<String>>, transposed: Option<bool>, py: Python<'py>, ) -> PyResult<Bound<'py, PyArray2<i64>>>
Returns slice from dataframe as numpy.array of int64 of the given keys.
If transposed is true, the keys will be transposed.
If keys is None, all keys will be used.
import numpy as np
df = tdf.DataFrame.init()
df.push({"key1": 1, "key2": 2})
df.push({"key1": 11, "key2": 21})
a_np = df.as_numpy_i64(['key1', 'key2'])
assert np.array_equal(a_np, np.array([[1, 11], [2, 21]], dtype=np.int64))Sourcepub fn as_numpy_f32<'py>(
&self,
keys: Option<Vec<String>>,
transposed: Option<bool>,
py: Python<'py>,
) -> PyResult<Bound<'py, PyArray2<f32>>>
pub fn as_numpy_f32<'py>( &self, keys: Option<Vec<String>>, transposed: Option<bool>, py: Python<'py>, ) -> PyResult<Bound<'py, PyArray2<f32>>>
Returns slice from dataframe as numpy.array of float32 of the given keys.
If transposed is true, the keys will be transposed.
If keys is None, all keys will be used.
import numpy as np
df = tdf.DataFrame.init()
df.push({"key1": 1, "key2": 2})
df.push({"key1": 11, "key2": 21})
a_np = df.as_numpy_f32(['key1', 'key2'])
assert np.array_equal(a_np, np.array([[1, 11], [2, 21]], dtype=np.float32))Sourcepub fn as_numpy_f64<'py>(
&self,
keys: Option<Vec<String>>,
transposed: Option<bool>,
py: Python<'py>,
) -> PyResult<Bound<'py, PyArray2<f64>>>
pub fn as_numpy_f64<'py>( &self, keys: Option<Vec<String>>, transposed: Option<bool>, py: Python<'py>, ) -> PyResult<Bound<'py, PyArray2<f64>>>
Returns slice from dataframe as numpy.array of float64 of the given keys.
If transposed is true, the keys will be transposed.
If keys is None, all keys will be used.
import numpy as np
df = tdf.DataFrame.init()
df.push({"key1": 1, "key2": 2})
df.push({"key1": 11, "key2": 21})
a_np = df.as_numpy_f64(['key1', 'key2'])
assert np.array_equal(a_np, np.array([[1, 11], [2, 21]], dtype=np.float64))Sourcepub fn as_numpy_str<'py>(
&self,
keys: Option<Vec<String>>,
transposed: Option<bool>,
py: Python<'py>,
) -> PyResult<Bound<'py, PyArray2<Py<PyAny>>>>
pub fn as_numpy_str<'py>( &self, keys: Option<Vec<String>>, transposed: Option<bool>, py: Python<'py>, ) -> PyResult<Bound<'py, PyArray2<Py<PyAny>>>>
Returns slice from dataframe as numpy.array of objects of the given keys.
If transposed is true, the keys will be transposed.
If keys is None, all keys will be used.
import numpy as np
df = tdf.DataFrame.init()
df.push({"key1": "a", "key2": "b"})
df.push({"key1": "d", "key2": "c"})
a_np = df.as_numpy_f64(['key1', 'key2'])
assert np.array_equal(a_np, np.array([["a", d""], ["b", "c"]], dtype=np.object))Sourcepub fn as_numpy<'py>(
&self,
keys: Option<Vec<String>>,
transposed: Option<bool>,
py: Python<'py>,
) -> PyResult<Bound<'py, PyArray2<Py<PyAny>>>>
pub fn as_numpy<'py>( &self, keys: Option<Vec<String>>, transposed: Option<bool>, py: Python<'py>, ) -> PyResult<Bound<'py, PyArray2<Py<PyAny>>>>
Returns slice from dataframe as numpy.array of float64 of the given keys.
If transposed is true, the keys will be transposed.
If keys is None, all keys will be used.
import numpy as np
df = tdf.DataFrame.init()
df.push({"key1": "a", "key2": 1})
df.push({"key1": "d", "key2": 2})
a_np = df.as_numpy_f64(['key1', 'key2'])
assert np.array_equal(a_np, np.array([["a", d""], [1, 2]], dtype=np.object))pub fn py_shrink(&mut self)
pub fn py_add_metadata(&mut self, key: String, value: DataValue)
pub fn py_get_metadata(&self, key: &str) -> Option<DataValue>
pub fn py_rename_key(&mut self, key: &str, new_name: &str) -> Result<(), PyErr>
pub fn py_add_alias(&mut self, key: &str, new_name: &str) -> Result<(), PyErr>
Sourcepub fn py_select<'py>(
&self,
py: Python<'py>,
keys: Option<Vec<String>>,
transposed: Option<bool>,
) -> Result<Bound<'py, PyList>, PyErr>
pub fn py_select<'py>( &self, py: Python<'py>, keys: Option<Vec<String>>, transposed: Option<bool>, ) -> Result<Bound<'py, PyList>, PyErr>
Selects data from the DataFrame.
If keys is None, all keys will be used.
If keys is provided, only the specified keys will be selected.
Returns a list of lists, where each inner list represents a row of data.
import trs_dataframe as tdf
df = tdf.DataFrame.init()
df.push({"key1": 1, "key2": 2})
df.push({"key1": 11, "key2": 21})
# selected = df.select(["key1", "key2"])
# assert selected == [[1, 2], [11, 21]]
# selected = df.select()Sourcepub fn py_select_column<'py>(
&self,
py: Python<'py>,
key: String,
) -> Result<Bound<'py, PyList>, PyErr>
pub fn py_select_column<'py>( &self, py: Python<'py>, key: String, ) -> Result<Bound<'py, PyList>, PyErr>
Selects a column from the DataFrame. If the column does not exist, it will raise a TypeError. Returns a list of values in the selected column.
import trs_dataframe as tdf
df = tdf.DataFrame.init()
df.push({"key1": 1, "key2": 2})
df.push({"key1": 11, "key2": 21})
# selected = df.select_column("key1")
# assert selected == [1, 11]
# selected = df.select_column("key2")
# assert selected == [2, 21]
# selected = df.select_column("non_existing_key") # Raises TypeErrorSourcepub fn py_join(
&mut self,
other: DataFrame,
join_type: JoinRelation,
) -> Result<(), PyErr>
pub fn py_join( &mut self, other: DataFrame, join_type: JoinRelation, ) -> Result<(), PyErr>
Joins the current DataFrame with another DataFrame.
The join type is specified by the join_type parameter.
see JoinRelation for available join types.
import trs_dataframe as tdf
df1 = tdf.DataFrame.init()
df1.push({"key1": 1, "key2": 2})
df1.push({"key1": 11, "key2": 21})
df2 = tdf.DataFrame.init()
df2.push({"key1": 1, "key2": 3})
df2.push({"key1": 11, "key2": 23})
df1.join(df2, tei.JoinRelation.extend())
assert df1.select(["key1", "key2"]) == [[1, 2], [11, 21], [1, 3], [11, 23]]Sourcepub fn py_push(&mut self, data: HashMap<Key, DataValue>) -> Result<(), PyErr>
pub fn py_push(&mut self, data: HashMap<Key, DataValue>) -> Result<(), PyErr>
Pushes a new row of data into the DataFrame. The data should be provided as a dictionary where keys are column names and values are the corresponding data values.
import trs_dataframe as tdf
df = tdf.DataFrame.init()
df.push({"key1": 1, "key2": 2})
df.push({"key1": 11, "key2": 21})Sourcepub fn py_add_column(
&mut self,
key: Key,
data: Vec<DataValue>,
) -> Result<(), PyErr>
pub fn py_add_column( &mut self, key: Key, data: Vec<DataValue>, ) -> Result<(), PyErr>
Adds a new column to the DataFrame. The column is specified by a key and a vector of data values. If the length of the data vector does not match the number of rows in the DataFrame, it will raise a TypeError.
import trs_dataframe as tdf
df = tdf.DataFrame.init()
df.push({"key1": 1, "key2": 2})
df.push({"key1": 11, "key2": 21})
df.add_column("key3", [3, 4])
assert df.select(["key1", "key2", "key3"]) == [[1, 2, 3], [11, 21, 4]]pub fn add_constant( &mut self, key: Key, feature: DataValue, ) -> Result<(), PyErr>
Sourcepub fn filter_by_expression(
&mut self,
expression: String,
) -> Result<Self, PyErr>
pub fn filter_by_expression( &mut self, expression: String, ) -> Result<Self, PyErr>
Filters the DataFrame by a given expression. The expression should be a string that can be parsed by the DataFrame’s filter method
import trs_dataframe as tdf
df = tdf.DataFrame.init()
df.push({"key1": 1, "key2": 2})
df.push({"key1": 11, "key2": 21})
df.filter_by_expression("key1 > 5")
assert df.select(["key1", "key2"]) == [[11, 21 ]]pub fn __iadd__(&mut self, object: Bound<'_, PyAny>) -> Result<(), PyErr>
pub fn __isub__(&mut self, object: Bound<'_, PyAny>) -> Result<(), PyErr>
pub fn __imul__(&mut self, object: Bound<'_, PyAny>) -> Result<(), PyErr>
pub fn __itruediv__(&mut self, object: Bound<'_, PyAny>) -> Result<(), PyErr>
pub fn __len__(&mut self) -> Result<usize, PyErr>
pub fn serialize_to_json_string(&self) -> String
pub fn deserialize_from_json_string(json_df: String) -> Self
pub fn __setstate__(&mut self, state: Bound<'_, PyBytes>) -> PyResult<()>
pub fn __getstate__<'py>( &self, py: Python<'py>, ) -> PyResult<Bound<'py, PyBytes>>
pub fn __del__(&mut self)
Source§impl DataFrame
impl DataFrame
Sourcepub fn new<C: Into<ColumnFrame>>(dataframe: C) -> Self
pub fn new<C: Into<ColumnFrame>>(dataframe: C) -> Self
Creates a new DataFrame from anything that can be converted into a ColumnFrame.
§Examples
use trs_dataframe::{DataFrame, column_frame};
let df = DataFrame::new(column_frame! {
"a" => [1, 2, 3],
"b" => [4, 5, 6]
});
assert_eq!(df.n_rows(), 3);
assert_eq!(df.n_columns(), 2);Sourcepub fn shrink(&mut self)
pub fn shrink(&mut self)
Compacts the internal storage to reclaim memory after row deletions or filter operations that may leave excess capacity allocated.
Sourcepub fn add_metadata(&mut self, key: String, value: DataValue)
pub fn add_metadata(&mut self, key: String, value: DataValue)
Attaches a key-value metadata entry to this dataframe.
Metadata does not participate in data operations (select, join, filter, etc.) and is intended for user-defined annotations such as source info or timestamps.
Sourcepub fn get_metadata(&self, key: &str) -> Option<&DataValue>
pub fn get_metadata(&self, key: &str) -> Option<&DataValue>
Returns a reference to the metadata value for the given key, or None if absent.
Sourcepub fn join(
&mut self,
other: Self,
join_type: &JoinRelation,
) -> Result<(), Error>
pub fn join( &mut self, other: Self, join_type: &JoinRelation, ) -> Result<(), Error>
Joins another dataframe into this one according to the given JoinRelation.
The join strategy is determined by the variant inside join_type:
crate::dataframe::join::JoinBy::AddColumns— adds non-existing columns fromothercrate::dataframe::join::JoinBy::Replace— replaces the entire frame withothercrate::dataframe::join::JoinBy::Extend— appends rows fromothercrate::dataframe::join::JoinBy::Broadcast— replicates a single-rowotheracross all rowscrate::dataframe::join::JoinBy::CartesianProduct— produces all row combinationscrate::dataframe::join::JoinBy::JoinById— hash-based join on shared key columns
Constants from other are merged into this dataframe’s constants map.
Sourcepub fn apply_function<F>(&mut self, keys: &[Key], func: F) -> Result<(), Error>
pub fn apply_function<F>(&mut self, keys: &[Key], func: F) -> Result<(), Error>
Applies a user-defined function to the underlying ColumnFrame.
The closure receives the provided keys and a mutable reference to the
internal ColumnFrame, allowing arbitrary in-place transformations.
Sourcepub fn select(&self, keys: Option<&[Key]>) -> Result<Array2<DataValue>, Error>
pub fn select(&self, keys: Option<&[Key]>) -> Result<Array2<DataValue>, Error>
Selects columns and returns their data as a 2D array of DataValue in row-major order.
If keys is None, all columns are returned. If a requested key does not
exist, its cells are filled with DataValue::Null.
§Examples
use trs_dataframe::{df, Key};
let df = df! { "a" => [1, 2], "b" => [3, 4] };
let data = df.select(None).unwrap();
assert_eq!(data.nrows(), 2);Sourcepub fn select_typed<T: Extract>(
&self,
keys: Option<&[Key]>,
) -> Result<Array2<T>, Error>
pub fn select_typed<T: Extract>( &self, keys: Option<&[Key]>, ) -> Result<Array2<T>, Error>
Returns selected columns as a typed 2D array, converting each DataValue
via the Extract trait.
This is the typed counterpart of select. If keys is None,
all columns are returned. The data is in row-major order (rows × columns).
§Type coercion
The Extract trait performs best-effort numeric coercion (e.g. I32 -> f64).
Values that cannot be meaningfully converted yield the type’s default
(0 for numbers, false for bool, empty string for String).
§Examples
use trs_dataframe::{df, Key};
let df = df! {
"a" => [1i32, 2i32, 3i32],
"b" => [4i32, 5i32, 6i32]
};
let keys = vec![Key::from("a"), Key::from("b")];
let arr = df.select_typed::<f64>(Some(&keys)).unwrap();
assert_eq!(arr[[0, 0]], 1.0);
assert_eq!(arr[[1, 1]], 5.0);Sourcepub fn select_column(&self, key: Key) -> Option<ArrayView1<'_, DataValue>>
pub fn select_column(&self, key: Key) -> Option<ArrayView1<'_, DataValue>>
Returns a read-only view of a single column, or None if the key is absent.
This is a zero-copy operation — the returned ArrayView1 borrows directly
from the underlying storage.
Sourcepub fn select_transposed(
&self,
keys: Option<&[Key]>,
) -> Result<Array2<DataValue>, Error>
pub fn select_transposed( &self, keys: Option<&[Key]>, ) -> Result<Array2<DataValue>, Error>
Selects columns and returns them in column-major layout (transposed).
If keys is None, all columns are included. Each column becomes a row
in the returned Array2.
Sourcepub fn insert_constant(&mut self, key: Key, value: DataValue)
pub fn insert_constant(&mut self, key: Key, value: DataValue)
Stores a constant value that logically applies to every row without being physically stored per-row.
Constants are carried through joins but do not appear in
select results.
Sourcepub fn push<C: CandidateData>(&mut self, item: C) -> Result<(), Error>
pub fn push<C: CandidateData>(&mut self, item: C) -> Result<(), Error>
Appends a single row to the dataframe.
The row is supplied as any type implementing CandidateData
(e.g. HashMap<Key, DataValue>). New columns are added automatically
if the row contains keys not yet present in the frame.
Sourcepub fn remove_column(&mut self, keys: &[Key]) -> Result<Self, Error>
pub fn remove_column(&mut self, keys: &[Key]) -> Result<Self, Error>
Removes the specified columns from this dataframe and returns them as a
new DataFrame.
Sourcepub fn extend(&mut self, items: Self) -> Result<(), Error>
pub fn extend(&mut self, items: Self) -> Result<(), Error>
Appends all rows from items to this dataframe.
If the two frames have different column sets, missing columns are filled
with DataValue::Null.
Sourcepub fn add_single_column<K: Into<Key>>(
&mut self,
key: K,
values: Array1<DataValue>,
) -> Result<(), Error>
pub fn add_single_column<K: Into<Key>>( &mut self, key: K, values: Array1<DataValue>, ) -> Result<(), Error>
Adds a new column to the dataframe.
Returns an error if the column key already exists or if the length of
values does not match the current row count.
Sourcepub fn get_single_column(&self, key: &Key) -> Option<ArrayView1<'_, DataValue>>
pub fn get_single_column(&self, key: &Key) -> Option<ArrayView1<'_, DataValue>>
Returns a read-only view of a single column, or None if the key is absent.
This is a zero-copy operation — the returned ArrayView1 borrows directly
from the underlying storage.
Sourcepub fn get_single_column_typed<T: Extract>(
&self,
key: &Key,
) -> Option<Array1<T>>
pub fn get_single_column_typed<T: Extract>( &self, key: &Key, ) -> Option<Array1<T>>
Returns a column extracted into a typed Array1<T>, where each DataValue
is converted via the Extract trait.
This is a convenience wrapper around get_single_column
that maps every element through T::extract, producing an owned array of the
target type. Returns None if the key does not exist in the dataframe.
§Type coercion
The Extract trait performs best-effort numeric coercion (e.g. I32 -> f64).
Values that cannot be meaningfully converted yield the type’s default
(0 for numbers, false for bool, empty string for String).
§Examples
use trs_dataframe::{df, Key};
let df = df! {
"score" => [1.5f64, 2.5f64, 3.5f64]
};
let key: Key = "score".into();
let col = df.get_single_column_typed::<f64>(&key).unwrap();
assert_eq!(col.len(), 3);
assert_eq!(col[0], 1.5);Sourcepub fn sorted(&self, key: &Key) -> Result<SortedDataFrame<'_>, Error>
pub fn sorted(&self, key: &Key) -> Result<SortedDataFrame<'_>, Error>
Returns a SortedDataFrame view sorted by the given column key.
The sort is ascending with Null values pushed to the end.
Use SortedDataFrame::topn to efficiently extract the first/last N rows.
Sourcepub fn filter(&self, filter: &FilterRules) -> Result<Self, Error>
pub fn filter(&self, filter: &FilterRules) -> Result<Self, Error>
Returns a new dataframe containing only rows that satisfy the filter expression.
Filter expressions are parsed from strings — see FilterRules
for the supported grammar (comparison, regex, set membership, logical combinators).
Constants and metadata are cloned into the result.
Sourcepub fn load_from_messagepack(bytes: &[u8]) -> Result<Self, Error>
pub fn load_from_messagepack(bytes: &[u8]) -> Result<Self, Error>
Deserializes a dataframe from MessagePack bytes.
This is the inverse of store_into_messagepack
and is useful for compact binary serialization in IPC or storage scenarios.
Sourcepub fn store_into_messagepack(&self) -> Result<Vec<u8>, Error>
pub fn store_into_messagepack(&self) -> Result<Vec<u8>, Error>
Serializes this dataframe into MessagePack bytes.
The resulting bytes can be deserialized back with
load_from_messagepack.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for DataFrame
impl<'de> Deserialize<'de> for DataFrame
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl From<ColumnFrame> for DataFrame
impl From<ColumnFrame> for DataFrame
Source§fn from(dataframe: ColumnFrame) -> Self
fn from(dataframe: ColumnFrame) -> Self
Source§impl From<SizedHashMap<SmartString<LazyCompact>, Vec<DataValue>>> for DataFrame
impl From<SizedHashMap<SmartString<LazyCompact>, Vec<DataValue>>> for DataFrame
Source§impl<'py> IntoPyObject<'py> for DataFrame
impl<'py> IntoPyObject<'py> for DataFrame
Source§type Output = Bound<'py, <DataFrame as IntoPyObject<'py>>::Target>
type Output = Bound<'py, <DataFrame as IntoPyObject<'py>>::Target>
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>
Source§impl PyClassImpl for DataFrame
impl PyClassImpl for DataFrame
Source§const IS_BASETYPE: bool = false
const IS_BASETYPE: bool = false
Source§const IS_SUBCLASS: bool = false
const IS_SUBCLASS: bool = false
Source§const IS_MAPPING: bool = false
const IS_MAPPING: bool = false
Source§const IS_SEQUENCE: bool = false
const IS_SEQUENCE: bool = false
Source§const IS_IMMUTABLE_TYPE: bool = false
const IS_IMMUTABLE_TYPE: bool = false
Source§const RAW_DOC: &'static CStr = /// DataFrame holds information about [`ColumnFrame`].
/// This is used to store the data and the metadata for the candidates.
///
/// # Columns Storage
/// The underlying data is stored in row-major order using ndarray's Array2.
/// Use `select()` for row-oriented access and `select_transposed()` for column-oriented access.
///
/// # Example
/// ```
/// use trs_dataframe::{DataFrame, column_frame};
///
/// let df = DataFrame::new(column_frame! {
/// "a" => [1, 2, 3],
/// "b" => [4, 5, 6]
/// });
///
/// // Get all data as 2D array (rows x columns)
/// let all_data = df.select(None);
///
/// // Get specific columns
/// let keys = vec!["a".into(), "b".into()];
/// let selected = df.select(Some(&keys));
/// ```
const RAW_DOC: &'static CStr = /// DataFrame holds information about [`ColumnFrame`]. /// This is used to store the data and the metadata for the candidates. /// /// # Columns Storage /// The underlying data is stored in row-major order using ndarray's Array2. /// Use `select()` for row-oriented access and `select_transposed()` for column-oriented access. /// /// # Example /// ``` /// use trs_dataframe::{DataFrame, column_frame}; /// /// let df = DataFrame::new(column_frame! { /// "a" => [1, 2, 3], /// "b" => [4, 5, 6] /// }); /// /// // Get all data as 2D array (rows x columns) /// let all_data = df.select(None); /// /// // Get specific columns /// let keys = vec!["a".into(), "b".into()]; /// let selected = df.select(Some(&keys)); /// ```
Source§const DOC: &'static CStr
const DOC: &'static CStr
text_signature if a constructor is defined. Read moreSource§type ThreadChecker = SendablePyClass<DataFrame>
type ThreadChecker = SendablePyClass<DataFrame>
Source§type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
Source§type BaseNativeType = PyAny
type BaseNativeType = PyAny
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<'a, 'holder, 'py> PyFunctionArgument<'a, 'holder, 'py, false> for &'holder mut DataFrame
impl<'a, 'holder, 'py> PyFunctionArgument<'a, 'holder, 'py, false> for &'holder mut DataFrame
Source§impl PyMethods<DataFrame> for PyClassImplCollector<DataFrame>
impl PyMethods<DataFrame> for PyClassImplCollector<DataFrame>
fn py_methods(self) -> &'static PyClassItems
Source§impl PyTypeInfo for DataFrame
impl PyTypeInfo for DataFrame
Source§fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
Source§fn type_object(py: Python<'_>) -> Bound<'_, PyType>
fn type_object(py: Python<'_>) -> Bound<'_, PyType>
impl DerefToPyAny for DataFrame
impl Eq for DataFrame
impl StructuralPartialEq for DataFrame
Auto Trait Implementations§
impl Freeze for DataFrame
impl RefUnwindSafe for DataFrame
impl Send for DataFrame
impl Sync for DataFrame
impl Unpin for DataFrame
impl UnsafeUnpin for DataFrame
impl UnwindSafe for DataFrame
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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<'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>
self into an owned Python object, dropping type information.