pub struct DataFrame { /* private fields */ }Implementations§
Source§impl DataFrame
impl DataFrame
pub fn new( index: Index, columns: impl Into<ColumnStore>, ) -> Result<Self, FrameError>
Sourcepub fn from_f64_block_columns(
index: Index,
names: Vec<String>,
block: Vec<f64>,
) -> Result<Self, FrameError>
pub fn from_f64_block_columns( index: Index, names: Vec<String>, block: Vec<f64>, ) -> Result<Self, FrameError>
Build a block-backed all-valid-Float64 DataFrame from a single
column-major block (block[col * rows + row], rows == index.len()).
The frame exposes an O(1) DataFrame::to_numpy_block_view (pandas’
zero-copy df.values on a homogeneous-float frame) and each column
borrows the shared block with no f64 data copy. block.len() must equal
index.len() * names.len().
§Errors
Returns FrameError::CompatibilityRejected when block.len() does not
match index.len() * names.len() or on dimension overflow.
Sourcepub fn to_numpy_block_view(&self) -> Option<Float64BlockView>
pub fn to_numpy_block_view(&self) -> Option<Float64BlockView>
O(1) zero-copy view of a block-backed frame’s data — pandas’ df.values
on a homogeneous-float frame (an F-contiguous (rows, cols) array
sharing the frame’s memory). Obtaining it is an Arc refcount bump.
Returns None unless this frame is block-backed (built via
DataFrame::from_f64_block_columns); callers then fall back to
DataFrame::to_numpy_flat for a materialized copy.
pub fn new_with_column_order<C, O>( index: Index, columns: C, column_order: O, ) -> Result<Self, FrameError>
pub fn new_with_row_multiindex( index: Index, row_multiindex: MultiIndex, columns: impl Into<ColumnStore>, ) -> Result<Self, FrameError>
Sourcepub fn with_row_multiindex(
self,
row_multiindex: MultiIndex,
) -> Result<Self, FrameError>
pub fn with_row_multiindex( self, row_multiindex: MultiIndex, ) -> Result<Self, FrameError>
Attach a row MultiIndex to an existing frame, keeping its column
order, column MultiIndex and duplicate-label flag.
Self::new_with_row_multiindex takes a ColumnStore, whose key order
is alphabetical, so rebuilding a frame through it silently reorders the
columns. The conformance harness did exactly that to every fixture that
declares a row MultiIndex, and seven live-oracle tests failed on
actual=["cost","sales"] expected=["sales","cost"] the day the oracle
first ran (br-frankenpandas-wfkzm). Use this when the frame already
exists.
Sourcepub fn plot(&self) -> Result<PlotSpec, FrameError>
pub fn plot(&self) -> Result<PlotSpec, FrameError>
Return a backend-neutral pandas-style plotting request.
Sourcepub fn plot_to_svg(&self) -> Result<String, FrameError>
pub fn plot_to_svg(&self) -> Result<String, FrameError>
Convenience helper: render dataframe plot directly to deterministic SVG string.
Sourcepub fn plot_to_html(&self) -> Result<String, FrameError>
pub fn plot_to_html(&self) -> Result<String, FrameError>
Convenience helper: render dataframe plot directly to HTML figure snippet.
Sourcepub fn plot_to_file<P: AsRef<Path>>(&self, path: P) -> Result<(), FrameError>
pub fn plot_to_file<P: AsRef<Path>>(&self, path: P) -> Result<(), FrameError>
Convenience helper: save rendered dataframe plot directly to disk.
Sourcepub fn line(&self) -> Result<PlotSpec, FrameError>
pub fn line(&self) -> Result<PlotSpec, FrameError>
Return a backend-neutral pandas-style line plot request.
Sourcepub fn line_to_svg(&self) -> Result<String, FrameError>
pub fn line_to_svg(&self) -> Result<String, FrameError>
Convenience helper: render dataframe line plot directly to deterministic SVG string.
Sourcepub fn line_to_html(&self) -> Result<String, FrameError>
pub fn line_to_html(&self) -> Result<String, FrameError>
Convenience helper: render dataframe line plot directly to HTML figure snippet.
Sourcepub fn line_to_file<P: AsRef<Path>>(&self, path: P) -> Result<(), FrameError>
pub fn line_to_file<P: AsRef<Path>>(&self, path: P) -> Result<(), FrameError>
Convenience helper: save rendered dataframe line plot directly to disk.
Sourcepub fn bar(&self) -> Result<PlotSpec, FrameError>
pub fn bar(&self) -> Result<PlotSpec, FrameError>
Return a backend-neutral pandas-style bar plot request.
Sourcepub fn bar_to_svg(&self) -> Result<String, FrameError>
pub fn bar_to_svg(&self) -> Result<String, FrameError>
Convenience helper: render dataframe bar plot directly to deterministic SVG string.
Sourcepub fn bar_to_html(&self) -> Result<String, FrameError>
pub fn bar_to_html(&self) -> Result<String, FrameError>
Convenience helper: render dataframe bar plot directly to HTML figure snippet.
Sourcepub fn bar_to_file<P: AsRef<Path>>(&self, path: P) -> Result<(), FrameError>
pub fn bar_to_file<P: AsRef<Path>>(&self, path: P) -> Result<(), FrameError>
Convenience helper: save rendered dataframe bar plot directly to disk.
Sourcepub fn barh(&self) -> Result<PlotSpec, FrameError>
pub fn barh(&self) -> Result<PlotSpec, FrameError>
Return a backend-neutral pandas-style horizontal bar plot request.
Sourcepub fn barh_to_svg(&self) -> Result<String, FrameError>
pub fn barh_to_svg(&self) -> Result<String, FrameError>
Convenience helper: render dataframe horizontal bar plot directly to deterministic SVG string.
Sourcepub fn barh_to_html(&self) -> Result<String, FrameError>
pub fn barh_to_html(&self) -> Result<String, FrameError>
Convenience helper: render dataframe horizontal bar plot directly to HTML figure snippet.
Sourcepub fn barh_to_file<P: AsRef<Path>>(&self, path: P) -> Result<(), FrameError>
pub fn barh_to_file<P: AsRef<Path>>(&self, path: P) -> Result<(), FrameError>
Convenience helper: save rendered dataframe horizontal bar plot directly to disk.
Sourcepub fn area(&self) -> Result<PlotSpec, FrameError>
pub fn area(&self) -> Result<PlotSpec, FrameError>
Return a backend-neutral pandas-style area plot request.
Sourcepub fn area_to_svg(&self) -> Result<String, FrameError>
pub fn area_to_svg(&self) -> Result<String, FrameError>
Convenience helper: render dataframe area plot directly to deterministic SVG string.
Sourcepub fn area_to_html(&self) -> Result<String, FrameError>
pub fn area_to_html(&self) -> Result<String, FrameError>
Convenience helper: render dataframe area plot directly to HTML figure snippet.
Sourcepub fn area_to_file<P: AsRef<Path>>(&self, path: P) -> Result<(), FrameError>
pub fn area_to_file<P: AsRef<Path>>(&self, path: P) -> Result<(), FrameError>
Convenience helper: save rendered dataframe area plot directly to disk.
Sourcepub fn scatter(&self) -> Result<PlotSpec, FrameError>
pub fn scatter(&self) -> Result<PlotSpec, FrameError>
Return a backend-neutral pandas-style scatter plot request.
Sourcepub fn scatter_to_svg(&self) -> Result<String, FrameError>
pub fn scatter_to_svg(&self) -> Result<String, FrameError>
Convenience helper: render dataframe scatter plot directly to deterministic SVG string.
Sourcepub fn scatter_to_html(&self) -> Result<String, FrameError>
pub fn scatter_to_html(&self) -> Result<String, FrameError>
Convenience helper: render dataframe scatter plot directly to HTML figure snippet.
Sourcepub fn scatter_to_file<P: AsRef<Path>>(&self, path: P) -> Result<(), FrameError>
pub fn scatter_to_file<P: AsRef<Path>>(&self, path: P) -> Result<(), FrameError>
Convenience helper: save rendered dataframe scatter plot directly to disk.
Sourcepub fn scatter_columns(&self, x: &str, y: &str) -> Result<PlotSpec, FrameError>
pub fn scatter_columns(&self, x: &str, y: &str) -> Result<PlotSpec, FrameError>
Return a backend-neutral pandas-style scatter plot request for the specified (x, y) column pair.
Sourcepub fn scatter_xy(&self, x: &str, y: &str) -> Result<PlotSpec, FrameError>
pub fn scatter_xy(&self, x: &str, y: &str) -> Result<PlotSpec, FrameError>
Return a backend-neutral pandas-style scatter plot request for the specified (x, y) column pair (alias for DataFrame::scatter_columns).
Sourcepub fn scatter_columns_to_svg(
&self,
x: &str,
y: &str,
) -> Result<String, FrameError>
pub fn scatter_columns_to_svg( &self, x: &str, y: &str, ) -> Result<String, FrameError>
Convenience helper: render dataframe (x, y) scatter plot directly to deterministic SVG string.
Sourcepub fn scatter_xy_to_svg(&self, x: &str, y: &str) -> Result<String, FrameError>
pub fn scatter_xy_to_svg(&self, x: &str, y: &str) -> Result<String, FrameError>
Convenience helper: render dataframe (x, y) scatter plot directly to deterministic SVG string (alias for DataFrame::scatter_columns_to_svg).
Sourcepub fn scatter_columns_to_html(
&self,
x: &str,
y: &str,
) -> Result<String, FrameError>
pub fn scatter_columns_to_html( &self, x: &str, y: &str, ) -> Result<String, FrameError>
Convenience helper: render dataframe (x, y) scatter plot directly to HTML figure snippet.
Sourcepub fn scatter_xy_to_html(&self, x: &str, y: &str) -> Result<String, FrameError>
pub fn scatter_xy_to_html(&self, x: &str, y: &str) -> Result<String, FrameError>
Convenience helper: render dataframe (x, y) scatter plot directly to HTML figure snippet (alias for DataFrame::scatter_columns_to_html).
Sourcepub fn scatter_columns_to_file<P: AsRef<Path>>(
&self,
x: &str,
y: &str,
path: P,
) -> Result<(), FrameError>
pub fn scatter_columns_to_file<P: AsRef<Path>>( &self, x: &str, y: &str, path: P, ) -> Result<(), FrameError>
Convenience helper: save rendered dataframe (x, y) scatter plot directly to disk.
Sourcepub fn scatter_xy_to_file<P: AsRef<Path>>(
&self,
x: &str,
y: &str,
path: P,
) -> Result<(), FrameError>
pub fn scatter_xy_to_file<P: AsRef<Path>>( &self, x: &str, y: &str, path: P, ) -> Result<(), FrameError>
Convenience helper: save rendered dataframe (x, y) scatter plot directly to disk (alias for DataFrame::scatter_columns_to_file).
Sourcepub fn pie(&self) -> Result<PlotSpec, FrameError>
pub fn pie(&self) -> Result<PlotSpec, FrameError>
Return a backend-neutral pandas-style pie plot request.
Sourcepub fn pie_to_svg(&self) -> Result<String, FrameError>
pub fn pie_to_svg(&self) -> Result<String, FrameError>
Convenience helper: render dataframe pie plot directly to deterministic SVG string.
Sourcepub fn pie_to_html(&self) -> Result<String, FrameError>
pub fn pie_to_html(&self) -> Result<String, FrameError>
Convenience helper: render dataframe pie plot directly to HTML figure snippet.
Sourcepub fn pie_to_file<P: AsRef<Path>>(&self, path: P) -> Result<(), FrameError>
pub fn pie_to_file<P: AsRef<Path>>(&self, path: P) -> Result<(), FrameError>
Convenience helper: save rendered dataframe pie plot directly to disk.
Sourcepub fn kde(&self) -> Result<PlotSpec, FrameError>
pub fn kde(&self) -> Result<PlotSpec, FrameError>
Return a backend-neutral pandas-style kernel density estimation plot request.
Sourcepub fn kde_to_svg(&self) -> Result<String, FrameError>
pub fn kde_to_svg(&self) -> Result<String, FrameError>
Convenience helper: render dataframe KDE plot directly to deterministic SVG string.
Sourcepub fn kde_to_html(&self) -> Result<String, FrameError>
pub fn kde_to_html(&self) -> Result<String, FrameError>
Convenience helper: render dataframe KDE plot directly to HTML figure snippet.
Sourcepub fn kde_to_file<P: AsRef<Path>>(&self, path: P) -> Result<(), FrameError>
pub fn kde_to_file<P: AsRef<Path>>(&self, path: P) -> Result<(), FrameError>
Convenience helper: save rendered dataframe KDE plot directly to disk.
Sourcepub fn density(&self) -> Result<PlotSpec, FrameError>
pub fn density(&self) -> Result<PlotSpec, FrameError>
Return a backend-neutral pandas-style density plot request (alias for DataFrame::kde).
Sourcepub fn density_to_svg(&self) -> Result<String, FrameError>
pub fn density_to_svg(&self) -> Result<String, FrameError>
Convenience helper: render dataframe density plot directly to deterministic SVG string.
Sourcepub fn density_to_html(&self) -> Result<String, FrameError>
pub fn density_to_html(&self) -> Result<String, FrameError>
Convenience helper: render dataframe density plot directly to HTML figure snippet.
Sourcepub fn density_to_file<P: AsRef<Path>>(&self, path: P) -> Result<(), FrameError>
pub fn density_to_file<P: AsRef<Path>>(&self, path: P) -> Result<(), FrameError>
Convenience helper: save rendered dataframe density plot directly to disk.
Sourcepub fn hexbin(&self) -> Result<PlotSpec, FrameError>
pub fn hexbin(&self) -> Result<PlotSpec, FrameError>
Return a backend-neutral pandas-style hexbin plot request.
Sourcepub fn hexbin_to_svg(&self) -> Result<String, FrameError>
pub fn hexbin_to_svg(&self) -> Result<String, FrameError>
Convenience helper: render dataframe hexbin plot directly to deterministic SVG string.
Sourcepub fn hexbin_to_html(&self) -> Result<String, FrameError>
pub fn hexbin_to_html(&self) -> Result<String, FrameError>
Convenience helper: render dataframe hexbin plot directly to HTML figure snippet.
Sourcepub fn hexbin_to_file<P: AsRef<Path>>(&self, path: P) -> Result<(), FrameError>
pub fn hexbin_to_file<P: AsRef<Path>>(&self, path: P) -> Result<(), FrameError>
Convenience helper: save rendered dataframe hexbin plot directly to disk.
Sourcepub fn hexbin_columns(&self, x: &str, y: &str) -> Result<PlotSpec, FrameError>
pub fn hexbin_columns(&self, x: &str, y: &str) -> Result<PlotSpec, FrameError>
Return a backend-neutral pandas-style hexbin plot request for the specified (x, y) column pair.
Sourcepub fn hexbin_xy(&self, x: &str, y: &str) -> Result<PlotSpec, FrameError>
pub fn hexbin_xy(&self, x: &str, y: &str) -> Result<PlotSpec, FrameError>
Return a backend-neutral pandas-style hexbin plot request for the specified (x, y) column pair (alias for DataFrame::hexbin_columns).
Sourcepub fn hexbin_columns_to_svg(
&self,
x: &str,
y: &str,
) -> Result<String, FrameError>
pub fn hexbin_columns_to_svg( &self, x: &str, y: &str, ) -> Result<String, FrameError>
Convenience helper: render dataframe (x, y) hexbin plot directly to deterministic SVG string.
Sourcepub fn hexbin_xy_to_svg(&self, x: &str, y: &str) -> Result<String, FrameError>
pub fn hexbin_xy_to_svg(&self, x: &str, y: &str) -> Result<String, FrameError>
Convenience helper: render dataframe (x, y) hexbin plot directly to deterministic SVG string (alias for DataFrame::hexbin_columns_to_svg).
Sourcepub fn hexbin_columns_to_html(
&self,
x: &str,
y: &str,
) -> Result<String, FrameError>
pub fn hexbin_columns_to_html( &self, x: &str, y: &str, ) -> Result<String, FrameError>
Convenience helper: render dataframe (x, y) hexbin plot directly to HTML figure snippet.
Sourcepub fn hexbin_xy_to_html(&self, x: &str, y: &str) -> Result<String, FrameError>
pub fn hexbin_xy_to_html(&self, x: &str, y: &str) -> Result<String, FrameError>
Convenience helper: render dataframe (x, y) hexbin plot directly to HTML figure snippet (alias for DataFrame::hexbin_columns_to_html).
Sourcepub fn hexbin_columns_to_file<P: AsRef<Path>>(
&self,
x: &str,
y: &str,
path: P,
) -> Result<(), FrameError>
pub fn hexbin_columns_to_file<P: AsRef<Path>>( &self, x: &str, y: &str, path: P, ) -> Result<(), FrameError>
Convenience helper: save rendered dataframe (x, y) hexbin plot directly to disk.
Sourcepub fn hexbin_xy_to_file<P: AsRef<Path>>(
&self,
x: &str,
y: &str,
path: P,
) -> Result<(), FrameError>
pub fn hexbin_xy_to_file<P: AsRef<Path>>( &self, x: &str, y: &str, path: P, ) -> Result<(), FrameError>
Convenience helper: save rendered dataframe (x, y) hexbin plot directly to disk (alias for DataFrame::hexbin_columns_to_file).
Sourcepub fn plot_with_kind(&self, kind: PlotKind) -> Result<PlotSpec, FrameError>
pub fn plot_with_kind(&self, kind: PlotKind) -> Result<PlotSpec, FrameError>
Return a backend-neutral plot request for the specified plot kind.
Sourcepub fn plot_xy(
&self,
kind: PlotKind,
x: &str,
y: &str,
) -> Result<PlotSpec, FrameError>
pub fn plot_xy( &self, kind: PlotKind, x: &str, y: &str, ) -> Result<PlotSpec, FrameError>
Return a backend-neutral plot request for the specified plot kind and (x, y) column pair.
Sourcepub fn hist(&self) -> Result<HistogramSpec, FrameError>
pub fn hist(&self) -> Result<HistogramSpec, FrameError>
Return a backend-neutral pandas-style histogram request.
Sourcepub fn hist_to_svg(&self) -> Result<String, FrameError>
pub fn hist_to_svg(&self) -> Result<String, FrameError>
Convenience helper: render dataframe histogram directly to deterministic SVG string.
Sourcepub fn hist_to_html(&self) -> Result<String, FrameError>
pub fn hist_to_html(&self) -> Result<String, FrameError>
Convenience helper: render dataframe histogram directly to HTML figure snippet.
Sourcepub fn hist_to_file<P: AsRef<Path>>(&self, path: P) -> Result<(), FrameError>
pub fn hist_to_file<P: AsRef<Path>>(&self, path: P) -> Result<(), FrameError>
Convenience helper: save rendered dataframe histogram directly to disk.
Sourcepub fn hist_with_bins(&self, bins: usize) -> Result<HistogramSpec, FrameError>
pub fn hist_with_bins(&self, bins: usize) -> Result<HistogramSpec, FrameError>
Return a backend-neutral histogram request with a custom number of bins across all numerical columns.
Sourcepub fn hist_with_bins_to_svg(&self, bins: usize) -> Result<String, FrameError>
pub fn hist_with_bins_to_svg(&self, bins: usize) -> Result<String, FrameError>
Convenience helper: render dataframe histogram with custom bins directly to deterministic SVG string.
Sourcepub fn hist_with_bins_to_html(&self, bins: usize) -> Result<String, FrameError>
pub fn hist_with_bins_to_html(&self, bins: usize) -> Result<String, FrameError>
Convenience helper: render dataframe histogram with custom bins directly to HTML figure snippet.
Sourcepub fn hist_with_bins_to_file<P: AsRef<Path>>(
&self,
bins: usize,
path: P,
) -> Result<(), FrameError>
pub fn hist_with_bins_to_file<P: AsRef<Path>>( &self, bins: usize, path: P, ) -> Result<(), FrameError>
Convenience helper: save rendered dataframe histogram with custom bins directly to disk.
Sourcepub fn hist_columns(
&self,
columns: &[&str],
bins: usize,
) -> Result<HistogramSpec, FrameError>
pub fn hist_columns( &self, columns: &[&str], bins: usize, ) -> Result<HistogramSpec, FrameError>
Return a backend-neutral histogram request restricted to the specified columns with custom bin count.
Sourcepub fn hist_columns_to_svg(
&self,
columns: &[&str],
bins: usize,
) -> Result<String, FrameError>
pub fn hist_columns_to_svg( &self, columns: &[&str], bins: usize, ) -> Result<String, FrameError>
Convenience helper: render dataframe histogram for specified columns directly to deterministic SVG string.
Sourcepub fn hist_columns_to_html(
&self,
columns: &[&str],
bins: usize,
) -> Result<String, FrameError>
pub fn hist_columns_to_html( &self, columns: &[&str], bins: usize, ) -> Result<String, FrameError>
Convenience helper: render dataframe histogram for specified columns directly to HTML figure snippet.
Sourcepub fn hist_columns_to_file<P: AsRef<Path>>(
&self,
columns: &[&str],
bins: usize,
path: P,
) -> Result<(), FrameError>
pub fn hist_columns_to_file<P: AsRef<Path>>( &self, columns: &[&str], bins: usize, path: P, ) -> Result<(), FrameError>
Convenience helper: save rendered dataframe histogram for specified columns directly to disk.
Sourcepub fn hist_by(
&self,
column: &str,
by: &str,
bins: usize,
) -> Result<HistogramSpec, FrameError>
pub fn hist_by( &self, column: &str, by: &str, bins: usize, ) -> Result<HistogramSpec, FrameError>
Return a backend-neutral histogram request grouping a numeric column by values of another column (pandas df.hist(column=..., by=...)).
Sourcepub fn hist_by_to_svg(
&self,
column: &str,
by: &str,
bins: usize,
) -> Result<String, FrameError>
pub fn hist_by_to_svg( &self, column: &str, by: &str, bins: usize, ) -> Result<String, FrameError>
Convenience helper: render dataframe grouped histogram directly to deterministic SVG string.
Sourcepub fn hist_by_to_html(
&self,
column: &str,
by: &str,
bins: usize,
) -> Result<String, FrameError>
pub fn hist_by_to_html( &self, column: &str, by: &str, bins: usize, ) -> Result<String, FrameError>
Convenience helper: render dataframe grouped histogram directly to HTML figure snippet.
Sourcepub fn hist_by_to_file<P: AsRef<Path>>(
&self,
column: &str,
by: &str,
bins: usize,
path: P,
) -> Result<(), FrameError>
pub fn hist_by_to_file<P: AsRef<Path>>( &self, column: &str, by: &str, bins: usize, path: P, ) -> Result<(), FrameError>
Convenience helper: save rendered dataframe grouped histogram directly to disk.
Sourcepub fn hist_columns_by(
&self,
columns: &[&str],
by: &str,
bins: usize,
) -> Result<HistogramSpec, FrameError>
pub fn hist_columns_by( &self, columns: &[&str], by: &str, bins: usize, ) -> Result<HistogramSpec, FrameError>
Return a backend-neutral histogram request grouping multiple numeric columns by values of another column (pandas df.hist(column=[...], by=...)).
Sourcepub fn hist_columns_by_to_svg(
&self,
columns: &[&str],
by: &str,
bins: usize,
) -> Result<String, FrameError>
pub fn hist_columns_by_to_svg( &self, columns: &[&str], by: &str, bins: usize, ) -> Result<String, FrameError>
Convenience helper: render dataframe multi-column grouped histogram directly to deterministic SVG string.
Sourcepub fn hist_columns_by_to_html(
&self,
columns: &[&str],
by: &str,
bins: usize,
) -> Result<String, FrameError>
pub fn hist_columns_by_to_html( &self, columns: &[&str], by: &str, bins: usize, ) -> Result<String, FrameError>
Convenience helper: render dataframe multi-column grouped histogram directly to HTML figure snippet.
Sourcepub fn hist_columns_by_to_file<P: AsRef<Path>>(
&self,
columns: &[&str],
by: &str,
bins: usize,
path: P,
) -> Result<(), FrameError>
pub fn hist_columns_by_to_file<P: AsRef<Path>>( &self, columns: &[&str], by: &str, bins: usize, path: P, ) -> Result<(), FrameError>
Convenience helper: save rendered dataframe multi-column grouped histogram directly to disk.
Sourcepub fn hist_by_all(
&self,
by: &str,
bins: usize,
) -> Result<HistogramSpec, FrameError>
pub fn hist_by_all( &self, by: &str, bins: usize, ) -> Result<HistogramSpec, FrameError>
Return a backend-neutral histogram request grouping all numeric columns (excluding by) by values of by (pandas df.hist(by=...)).
Sourcepub fn hist_by_all_to_svg(
&self,
by: &str,
bins: usize,
) -> Result<String, FrameError>
pub fn hist_by_all_to_svg( &self, by: &str, bins: usize, ) -> Result<String, FrameError>
Convenience helper: render all-numeric-columns grouped histogram directly to deterministic SVG string.
Sourcepub fn hist_by_all_to_html(
&self,
by: &str,
bins: usize,
) -> Result<String, FrameError>
pub fn hist_by_all_to_html( &self, by: &str, bins: usize, ) -> Result<String, FrameError>
Convenience helper: render all-numeric-columns grouped histogram directly to HTML figure snippet.
Sourcepub fn hist_by_all_to_file<P: AsRef<Path>>(
&self,
by: &str,
bins: usize,
path: P,
) -> Result<(), FrameError>
pub fn hist_by_all_to_file<P: AsRef<Path>>( &self, by: &str, bins: usize, path: P, ) -> Result<(), FrameError>
Convenience helper: save rendered all-numeric-columns grouped histogram directly to disk.
Sourcepub fn boxplot(&self) -> Result<BoxPlotSpec, FrameError>
pub fn boxplot(&self) -> Result<BoxPlotSpec, FrameError>
Return a backend-neutral pandas-style boxplot request.
Sourcepub fn box_plot(&self) -> Result<BoxPlotSpec, FrameError>
pub fn box_plot(&self) -> Result<BoxPlotSpec, FrameError>
Return a backend-neutral pandas-style boxplot request (alias for DataFrame::boxplot).
Sourcepub fn box(&self) -> Result<BoxPlotSpec, FrameError>
pub fn box(&self) -> Result<BoxPlotSpec, FrameError>
Return a backend-neutral pandas-style boxplot request (alias for DataFrame::boxplot).
Sourcepub fn boxplot_to_svg(&self) -> Result<String, FrameError>
pub fn boxplot_to_svg(&self) -> Result<String, FrameError>
Convenience helper: render dataframe boxplot directly to deterministic SVG string.
Sourcepub fn boxplot_to_html(&self) -> Result<String, FrameError>
pub fn boxplot_to_html(&self) -> Result<String, FrameError>
Convenience helper: render dataframe boxplot directly to HTML figure snippet.
Sourcepub fn boxplot_to_file<P: AsRef<Path>>(&self, path: P) -> Result<(), FrameError>
pub fn boxplot_to_file<P: AsRef<Path>>(&self, path: P) -> Result<(), FrameError>
Convenience helper: save rendered dataframe boxplot directly to disk.
Sourcepub fn boxplot_columns(
&self,
columns: &[&str],
) -> Result<BoxPlotSpec, FrameError>
pub fn boxplot_columns( &self, columns: &[&str], ) -> Result<BoxPlotSpec, FrameError>
Return a backend-neutral boxplot request restricted to the specified columns.
Sourcepub fn boxplot_columns_to_svg(
&self,
columns: &[&str],
) -> Result<String, FrameError>
pub fn boxplot_columns_to_svg( &self, columns: &[&str], ) -> Result<String, FrameError>
Convenience helper: render dataframe boxplot for specified columns directly to deterministic SVG string.
Sourcepub fn boxplot_columns_to_html(
&self,
columns: &[&str],
) -> Result<String, FrameError>
pub fn boxplot_columns_to_html( &self, columns: &[&str], ) -> Result<String, FrameError>
Convenience helper: render dataframe boxplot for specified columns directly to HTML figure snippet.
Sourcepub fn boxplot_columns_to_file<P: AsRef<Path>>(
&self,
columns: &[&str],
path: P,
) -> Result<(), FrameError>
pub fn boxplot_columns_to_file<P: AsRef<Path>>( &self, columns: &[&str], path: P, ) -> Result<(), FrameError>
Convenience helper: save rendered dataframe boxplot for specified columns directly to disk.
Sourcepub fn boxplot_by(
&self,
column: &str,
by: &str,
) -> Result<BoxPlotSpec, FrameError>
pub fn boxplot_by( &self, column: &str, by: &str, ) -> Result<BoxPlotSpec, FrameError>
Return a backend-neutral boxplot request grouping a numeric column by values of another column (pandas df.boxplot(column=..., by=...)).
Sourcepub fn boxplot_by_to_svg(
&self,
column: &str,
by: &str,
) -> Result<String, FrameError>
pub fn boxplot_by_to_svg( &self, column: &str, by: &str, ) -> Result<String, FrameError>
Convenience helper: render dataframe grouped boxplot directly to deterministic SVG string.
Sourcepub fn boxplot_by_to_html(
&self,
column: &str,
by: &str,
) -> Result<String, FrameError>
pub fn boxplot_by_to_html( &self, column: &str, by: &str, ) -> Result<String, FrameError>
Convenience helper: render dataframe grouped boxplot directly to HTML figure snippet.
Sourcepub fn boxplot_by_to_file<P: AsRef<Path>>(
&self,
column: &str,
by: &str,
path: P,
) -> Result<(), FrameError>
pub fn boxplot_by_to_file<P: AsRef<Path>>( &self, column: &str, by: &str, path: P, ) -> Result<(), FrameError>
Convenience helper: save rendered dataframe grouped boxplot directly to disk.
Sourcepub fn boxplot_columns_by(
&self,
columns: &[&str],
by: &str,
) -> Result<BoxPlotSpec, FrameError>
pub fn boxplot_columns_by( &self, columns: &[&str], by: &str, ) -> Result<BoxPlotSpec, FrameError>
Return a backend-neutral boxplot request grouping multiple numeric columns by values of another column (pandas df.boxplot(column=[...], by=...)).
Sourcepub fn boxplot_columns_by_to_svg(
&self,
columns: &[&str],
by: &str,
) -> Result<String, FrameError>
pub fn boxplot_columns_by_to_svg( &self, columns: &[&str], by: &str, ) -> Result<String, FrameError>
Convenience helper: render dataframe multi-column grouped boxplot directly to deterministic SVG string.
Sourcepub fn boxplot_columns_by_to_html(
&self,
columns: &[&str],
by: &str,
) -> Result<String, FrameError>
pub fn boxplot_columns_by_to_html( &self, columns: &[&str], by: &str, ) -> Result<String, FrameError>
Convenience helper: render dataframe multi-column grouped boxplot directly to HTML figure snippet.
Sourcepub fn boxplot_columns_by_to_file<P: AsRef<Path>>(
&self,
columns: &[&str],
by: &str,
path: P,
) -> Result<(), FrameError>
pub fn boxplot_columns_by_to_file<P: AsRef<Path>>( &self, columns: &[&str], by: &str, path: P, ) -> Result<(), FrameError>
Convenience helper: save rendered dataframe multi-column grouped boxplot directly to disk.
Sourcepub fn boxplot_by_all(&self, by: &str) -> Result<BoxPlotSpec, FrameError>
pub fn boxplot_by_all(&self, by: &str) -> Result<BoxPlotSpec, FrameError>
Return a backend-neutral boxplot request grouping all numeric columns (excluding by) by values of by (pandas df.boxplot(by=...)).
Sourcepub fn boxplot_by_all_to_svg(&self, by: &str) -> Result<String, FrameError>
pub fn boxplot_by_all_to_svg(&self, by: &str) -> Result<String, FrameError>
Convenience helper: render all-numeric-columns grouped boxplot directly to deterministic SVG string.
Sourcepub fn boxplot_by_all_to_html(&self, by: &str) -> Result<String, FrameError>
pub fn boxplot_by_all_to_html(&self, by: &str) -> Result<String, FrameError>
Convenience helper: render all-numeric-columns grouped boxplot directly to HTML figure snippet.
Sourcepub fn boxplot_by_all_to_file<P: AsRef<Path>>(
&self,
by: &str,
path: P,
) -> Result<(), FrameError>
pub fn boxplot_by_all_to_file<P: AsRef<Path>>( &self, by: &str, path: P, ) -> Result<(), FrameError>
Convenience helper: save rendered all-numeric-columns grouped boxplot directly to disk.
Sourcepub fn parallel_coordinates(
&self,
class_column: &str,
cols: Option<&[&str]>,
) -> Result<PlotSpec, FrameError>
pub fn parallel_coordinates( &self, class_column: &str, cols: Option<&[&str]>, ) -> Result<PlotSpec, FrameError>
Return a backend-neutral parallel coordinates plot request (pandas pandas.plotting.parallel_coordinates(frame, class_column, cols=...)).
Sourcepub fn parallel_coordinates_to_svg(
&self,
class_column: &str,
cols: Option<&[&str]>,
) -> Result<String, FrameError>
pub fn parallel_coordinates_to_svg( &self, class_column: &str, cols: Option<&[&str]>, ) -> Result<String, FrameError>
Convenience helper: render parallel coordinates plot directly to deterministic SVG string.
Sourcepub fn parallel_coordinates_to_html(
&self,
class_column: &str,
cols: Option<&[&str]>,
) -> Result<String, FrameError>
pub fn parallel_coordinates_to_html( &self, class_column: &str, cols: Option<&[&str]>, ) -> Result<String, FrameError>
Convenience helper: render parallel coordinates plot directly to HTML figure snippet.
Sourcepub fn parallel_coordinates_to_file<P: AsRef<Path>>(
&self,
class_column: &str,
cols: Option<&[&str]>,
path: P,
) -> Result<(), FrameError>
pub fn parallel_coordinates_to_file<P: AsRef<Path>>( &self, class_column: &str, cols: Option<&[&str]>, path: P, ) -> Result<(), FrameError>
Convenience helper: save rendered parallel coordinates plot directly to disk.
Sourcepub fn andrews_curves(
&self,
class_column: &str,
samples: usize,
) -> Result<PlotSpec, FrameError>
pub fn andrews_curves( &self, class_column: &str, samples: usize, ) -> Result<PlotSpec, FrameError>
Return a backend-neutral Andrews curves plot request (pandas pandas.plotting.andrews_curves(frame, class_column, samples=...)).
Sourcepub fn andrews_curves_to_svg(
&self,
class_column: &str,
samples: usize,
) -> Result<String, FrameError>
pub fn andrews_curves_to_svg( &self, class_column: &str, samples: usize, ) -> Result<String, FrameError>
Convenience helper: render Andrews curves plot directly to deterministic SVG string.
Sourcepub fn andrews_curves_to_html(
&self,
class_column: &str,
samples: usize,
) -> Result<String, FrameError>
pub fn andrews_curves_to_html( &self, class_column: &str, samples: usize, ) -> Result<String, FrameError>
Convenience helper: render Andrews curves plot directly to HTML figure snippet.
Sourcepub fn andrews_curves_to_file<P: AsRef<Path>>(
&self,
class_column: &str,
samples: usize,
path: P,
) -> Result<(), FrameError>
pub fn andrews_curves_to_file<P: AsRef<Path>>( &self, class_column: &str, samples: usize, path: P, ) -> Result<(), FrameError>
Convenience helper: save rendered Andrews curves plot directly to disk.
Sourcepub fn radviz(
&self,
class_column: &str,
cols: Option<&[&str]>,
) -> Result<PlotSpec, FrameError>
pub fn radviz( &self, class_column: &str, cols: Option<&[&str]>, ) -> Result<PlotSpec, FrameError>
Return a backend-neutral RadViz plot request (pandas pandas.plotting.radviz(frame, class_column, cols=...)).
Sourcepub fn radviz_to_svg(
&self,
class_column: &str,
cols: Option<&[&str]>,
) -> Result<String, FrameError>
pub fn radviz_to_svg( &self, class_column: &str, cols: Option<&[&str]>, ) -> Result<String, FrameError>
Convenience helper: render RadViz plot directly to deterministic SVG string.
Sourcepub fn radviz_to_html(
&self,
class_column: &str,
cols: Option<&[&str]>,
) -> Result<String, FrameError>
pub fn radviz_to_html( &self, class_column: &str, cols: Option<&[&str]>, ) -> Result<String, FrameError>
Convenience helper: render RadViz plot directly to HTML figure snippet.
Sourcepub fn radviz_to_file<P: AsRef<Path>>(
&self,
class_column: &str,
cols: Option<&[&str]>,
path: P,
) -> Result<(), FrameError>
pub fn radviz_to_file<P: AsRef<Path>>( &self, class_column: &str, cols: Option<&[&str]>, path: P, ) -> Result<(), FrameError>
Convenience helper: save rendered RadViz plot directly to disk.
Sourcepub fn scatter_matrix(
&self,
alpha: Option<f64>,
diagonal: Option<&str>,
range_padding: Option<f64>,
) -> Result<ScatterMatrixSpec, FrameError>
pub fn scatter_matrix( &self, alpha: Option<f64>, diagonal: Option<&str>, range_padding: Option<f64>, ) -> Result<ScatterMatrixSpec, FrameError>
Return a backend-neutral scatter matrix plot request (pandas pandas.plotting.scatter_matrix(frame, ...)).
Sourcepub fn scatter_matrix_with_cols(
&self,
cols: Option<&[&str]>,
alpha: Option<f64>,
diagonal: Option<&str>,
range_padding: Option<f64>,
) -> Result<ScatterMatrixSpec, FrameError>
pub fn scatter_matrix_with_cols( &self, cols: Option<&[&str]>, alpha: Option<f64>, diagonal: Option<&str>, range_padding: Option<f64>, ) -> Result<ScatterMatrixSpec, FrameError>
Return a backend-neutral scatter matrix plot request selecting explicit columns.
Sourcepub fn scatter_matrix_to_svg(
&self,
alpha: Option<f64>,
diagonal: Option<&str>,
range_padding: Option<f64>,
) -> Result<String, FrameError>
pub fn scatter_matrix_to_svg( &self, alpha: Option<f64>, diagonal: Option<&str>, range_padding: Option<f64>, ) -> Result<String, FrameError>
Convenience helper: render scatter matrix directly to deterministic SVG string.
Sourcepub fn scatter_matrix_to_html(
&self,
alpha: Option<f64>,
diagonal: Option<&str>,
range_padding: Option<f64>,
) -> Result<String, FrameError>
pub fn scatter_matrix_to_html( &self, alpha: Option<f64>, diagonal: Option<&str>, range_padding: Option<f64>, ) -> Result<String, FrameError>
Convenience helper: render scatter matrix directly to HTML figure snippet.
Sourcepub fn scatter_matrix_to_file<P: AsRef<Path>>(
&self,
path: P,
alpha: Option<f64>,
diagonal: Option<&str>,
range_padding: Option<f64>,
) -> Result<(), FrameError>
pub fn scatter_matrix_to_file<P: AsRef<Path>>( &self, path: P, alpha: Option<f64>, diagonal: Option<&str>, range_padding: Option<f64>, ) -> Result<(), FrameError>
Convenience helper: save rendered scatter matrix plot directly to disk.
Sourcepub fn scatter_matrix_with_cols_to_svg(
&self,
cols: Option<&[&str]>,
alpha: Option<f64>,
diagonal: Option<&str>,
range_padding: Option<f64>,
) -> Result<String, FrameError>
pub fn scatter_matrix_with_cols_to_svg( &self, cols: Option<&[&str]>, alpha: Option<f64>, diagonal: Option<&str>, range_padding: Option<f64>, ) -> Result<String, FrameError>
Convenience helper: render scatter matrix with explicit columns directly to deterministic SVG string.
Sourcepub fn scatter_matrix_with_cols_to_html(
&self,
cols: Option<&[&str]>,
alpha: Option<f64>,
diagonal: Option<&str>,
range_padding: Option<f64>,
) -> Result<String, FrameError>
pub fn scatter_matrix_with_cols_to_html( &self, cols: Option<&[&str]>, alpha: Option<f64>, diagonal: Option<&str>, range_padding: Option<f64>, ) -> Result<String, FrameError>
Convenience helper: render scatter matrix with explicit columns directly to HTML figure snippet.
Sourcepub fn scatter_matrix_with_cols_to_file<P: AsRef<Path>>(
&self,
cols: Option<&[&str]>,
path: P,
alpha: Option<f64>,
diagonal: Option<&str>,
range_padding: Option<f64>,
) -> Result<(), FrameError>
pub fn scatter_matrix_with_cols_to_file<P: AsRef<Path>>( &self, cols: Option<&[&str]>, path: P, alpha: Option<f64>, diagonal: Option<&str>, range_padding: Option<f64>, ) -> Result<(), FrameError>
Convenience helper: save rendered scatter matrix with explicit columns directly to disk.
Sourcepub fn table(&self) -> Result<TablePlotSpec, FrameError>
pub fn table(&self) -> Result<TablePlotSpec, FrameError>
Return a backend-neutral table plot request (pandas pandas.plotting.table(ax, frame, ...)).
Sourcepub fn table_with_labels(
&self,
row_labels: Option<&[&str]>,
col_labels: Option<&[&str]>,
) -> Result<TablePlotSpec, FrameError>
pub fn table_with_labels( &self, row_labels: Option<&[&str]>, col_labels: Option<&[&str]>, ) -> Result<TablePlotSpec, FrameError>
Return a backend-neutral table plot request with optional custom row and column labels.
Sourcepub fn table_to_svg(
&self,
row_labels: Option<&[&str]>,
col_labels: Option<&[&str]>,
) -> Result<String, FrameError>
pub fn table_to_svg( &self, row_labels: Option<&[&str]>, col_labels: Option<&[&str]>, ) -> Result<String, FrameError>
Convenience helper: render DataFrame table directly to deterministic SVG string.
Sourcepub fn table_to_html(
&self,
row_labels: Option<&[&str]>,
col_labels: Option<&[&str]>,
) -> Result<String, FrameError>
pub fn table_to_html( &self, row_labels: Option<&[&str]>, col_labels: Option<&[&str]>, ) -> Result<String, FrameError>
Convenience helper: render DataFrame table directly to HTML figure snippet.
Sourcepub fn table_to_file<P: AsRef<Path>>(
&self,
path: P,
row_labels: Option<&[&str]>,
col_labels: Option<&[&str]>,
) -> Result<(), FrameError>
pub fn table_to_file<P: AsRef<Path>>( &self, path: P, row_labels: Option<&[&str]>, col_labels: Option<&[&str]>, ) -> Result<(), FrameError>
Convenience helper: save rendered DataFrame table directly to disk.
Sourcepub fn from_series_with_columns(
series_list: Vec<Series>,
columns: Option<&[String]>,
) -> Result<Self, FrameError>
pub fn from_series_with_columns( series_list: Vec<Series>, columns: Option<&[String]>, ) -> Result<Self, FrameError>
pd.DataFrame(dict_of_series, columns=[...]) — SELECT the named columns
first, then align only those.
The order matters and is observable in the ROW COUNT. MEASURED, live
pandas 2.2.3, with a indexed [1,2] and b indexed [2,3]:
pd.DataFrame({'a': a, 'b': b}) index [1, 2, 3] the union
pd.DataFrame({'a': a, 'b': b}, columns=['b']) index [2, 3] b's index ALONE
b -> [30, 40] int64, no gap invented, so no widening
pd.DataFrame({'a': a, 'b': b}, columns=['a','z'])
index [1, 2] a's index alone
a -> [10, 20] int64
z -> [nan, nan] OBJECT, an all-missing column for the absent nameBuilding the full union and projecting afterwards gives three rows where pandas gives two, and null-fills columns that pandas leaves intact. A name absent from the data contributes NO index labels — it becomes an all-missing column over whatever the present names span.
columns = None is the plain union, i.e. Self::from_series.
(br-frankenpandas-oxodo, br-frankenpandas-fixture-divergence-triage-9s0c4)
Sourcepub fn from_series(series_list: Vec<Series>) -> Result<Self, FrameError>
pub fn from_series(series_list: Vec<Series>) -> Result<Self, FrameError>
AG-05: Pre-compute N-way union index across all series first, then reindex each column exactly once. Eliminates O(N²) iterative realignment where N = number of series.
Sourcepub fn from_dict(
column_order: &[&str],
data: Vec<(&str, Vec<Scalar>)>,
) -> Result<Self, FrameError>
pub fn from_dict( column_order: &[&str], data: Vec<(&str, Vec<Scalar>)>, ) -> Result<Self, FrameError>
Construct a DataFrame from a dict of column vectors.
Matches pd.DataFrame({"a": [1, 2], "b": [3, 4]}).
All vectors must have the same length. Index is auto-generated
as 0..n (RangeIndex-style).
column_order controls observable column label order.
Sourcepub fn from_dict_with_columns(
data: Vec<(&str, Vec<Scalar>)>,
columns: Option<&[String]>,
index_labels: Option<Vec<IndexLabel>>,
) -> Result<Self, FrameError>
pub fn from_dict_with_columns( data: Vec<(&str, Vec<Scalar>)>, columns: Option<&[String]>, index_labels: Option<Vec<IndexLabel>>, ) -> Result<Self, FrameError>
Construct a DataFrame from dict-of-columns data under pandas’ columns=
contract, with an optional explicit index.
Matches pd.DataFrame(dict, columns=..., index=...). This is NOT
from_dict’s column_order, which is an ORDERING
hint over columns that are all expected to exist: that one appends any
dict key the caller did not list, and REJECTS a listed name that is
absent. pandas’ columns= is a SELECTOR. Measured on live pandas 2.2.3
with d = {"a": [1, 2], "b": [3, 4]}:
pd.DataFrame(d, columns=["a", "z"]) -> a=[1,2], z=[nan,nan] (object)
pd.DataFrame(d, columns=["b"]) -> ONLY b; 'a' is DROPPED
pd.DataFrame(d, columns=["z", "y"]) -> shape (0, 2): no requested name
exists, so there is no index to
take a length from
pd.DataFrame(d, columns=[]) -> shape (0, 0)
pd.DataFrame(d, columns=[], index=[10, 20]) -> shape (2, 0)
pd.DataFrame(d, columns=["a"], index=[1,2,3]) -> ValueError (length)
pd.DataFrame({"a":[1,2],"b":[3]}, columns=["a"]) -> OK: an unselected
ragged column is dropped BEFORE the equal-length check, while the
same dict with no `columns=` raises "All arrays must be of the same
length"br-frankenpandas-oxodo: this contract had no owner in FrankenPandas.
The conformance harness held a private copy of it
(collect_dict_constructor_payloads) and got the first line wrong — it
raised “column ‘z’ not found in data”, which pandas does not do — and
the oracle carried the same invented rejection, so all three layers
agreed on an error and fp_p2d_018 pinned it as truth. A user calling
FrankenPandas could not express the operation the packet certified.
A repeated name in columns is preserved: pandas returns the column
repeatedly, and ColumnStore preserves duplicate column labels.
Sourcepub fn from_dict_index(
data: Vec<(&str, Vec<Scalar>)>,
) -> Result<Self, FrameError>
pub fn from_dict_index( data: Vec<(&str, Vec<Scalar>)>, ) -> Result<Self, FrameError>
Construct a DataFrame from a dict with orient='index'.
Matches pd.DataFrame.from_dict(data, orient='index').
Each key becomes a row index label, and each value is a list of
column values. Column names default to 0, 1, 2, …
Sourcepub fn from_dict_index_columns(
data: Vec<(&str, Vec<Scalar>)>,
column_names: &[&str],
) -> Result<Self, FrameError>
pub fn from_dict_index_columns( data: Vec<(&str, Vec<Scalar>)>, column_names: &[&str], ) -> Result<Self, FrameError>
Construct a DataFrame from a dict with orient=‘index’ and custom column names.
Like from_dict_index but with explicit column names.
Sourcepub fn from_list_like(
matrix_rows: Vec<Vec<Scalar>>,
column_order: Option<&[String]>,
index_labels: Option<Vec<IndexLabel>>,
) -> Result<Self, FrameError>
pub fn from_list_like( matrix_rows: Vec<Vec<Scalar>>, column_order: Option<&[String]>, index_labels: Option<Vec<IndexLabel>>, ) -> Result<Self, FrameError>
pd.DataFrame([[...], [...]], columns=..., index=...).
The list-like constructor: short rows are padded with NaN and the padded column widens to float64, matching pandas. Added so the conformance harness can stop building this frame itself (br-frankenpandas-oxodo).
Sourcepub fn from_records(
records: Vec<Vec<Scalar>>,
column_order: Option<&[String]>,
index_labels: Option<Vec<IndexLabel>>,
) -> Result<Self, FrameError>
pub fn from_records( records: Vec<Vec<Scalar>>, column_order: Option<&[String]>, index_labels: Option<Vec<IndexLabel>>, ) -> Result<Self, FrameError>
Construct a DataFrame from row-oriented list-like records.
Matches pd.DataFrame.from_records(data, columns=..., index=...) for
tuple/list-style records. Short rows are null-filled; explicit columns
may also introduce trailing all-null columns.
Sourcepub fn from_scalar(
value: &Scalar,
index_labels: Vec<IndexLabel>,
column_order: Option<&[String]>,
) -> Result<Self, FrameError>
pub fn from_scalar( value: &Scalar, index_labels: Vec<IndexLabel>, column_order: Option<&[String]>, ) -> Result<Self, FrameError>
Construct a DataFrame from row-oriented tuples.
Matches the rectangular tuple/list subset of
pd.DataFrame.from_records(data, columns=...). Each inner Vec is a row;
all rows must have the same length as columns.
Construct a DataFrame by BROADCASTING one scalar over an index and a
column set.
Matches pd.DataFrame(scalar, index=..., columns=...). Measured on
pandas 2.2.3:
pd.DataFrame(5, index=[0,1], columns=['a','b']) -> [[5,5],[5,5]] int64
pd.DataFrame(2.5, index=[0,1], columns=['a']) -> [[2.5],[2.5]] float64
pd.DataFrame('x', index=[0,1], columns=['a']) -> [['x'],['x']] object
pd.DataFrame(True, index=[0], columns=['a']) -> [[True]] bool
pd.DataFrame(5, index=[], columns=['a']) -> shape (0,1), int64
pd.DataFrame(5, index=[1,2], columns=[]) -> shape (2,0)
pd.DataFrame(5, index=[0,1]) -> ValueError:
"DataFrame constructor not properly called!" <- columns OMITTEDcolumns is Option because pandas draws a real distinction that a bare
slice cannot express: an EXPLICIT empty list is legal and yields shape
(n, 0), while OMITTING columns is an error — a bare scalar carries no
labels to infer. Collapsing the two would make one of those two measured
behaviours unreachable.
Added by br-frankenpandas-oxodo. The conformance harness had been
building this frame ITSELF for eight dataframe_constructor_scalar
fixtures, so the packet was green against an operation FrankenPandas did
not actually expose.
pub fn from_tuples( records: Vec<Vec<Scalar>>, columns: &[&str], ) -> Result<Self, FrameError>
Sourcepub fn from_tuples_with_index(
records: Vec<Vec<Scalar>>,
columns: &[&str],
index_labels: Vec<IndexLabel>,
) -> Result<Self, FrameError>
pub fn from_tuples_with_index( records: Vec<Vec<Scalar>>, columns: &[&str], index_labels: Vec<IndexLabel>, ) -> Result<Self, FrameError>
Construct a DataFrame from a list of row tuples with custom index.
Matches pd.DataFrame(data, columns=columns, index=index) for list-of-lists.
Sourcepub fn from_dict_mixed(
column_order: &[&str],
data: Vec<(&str, DataFrameColumnInput)>,
) -> Result<Self, FrameError>
pub fn from_dict_mixed( column_order: &[&str], data: Vec<(&str, DataFrameColumnInput)>, ) -> Result<Self, FrameError>
Construct a DataFrame from mixed dict inputs (Vec<Scalar> and scalar).
Scalar values are broadcast to the row count inferred from the first non-scalar column. If all inputs are scalar, an explicit index is required and this constructor rejects the operation.
Sourcepub fn from_record_maps(
records: Vec<BTreeMap<String, Scalar>>,
column_order: Option<&[String]>,
index_labels: Option<Vec<IndexLabel>>,
) -> Result<Self, FrameError>
pub fn from_record_maps( records: Vec<BTreeMap<String, Scalar>>, column_order: Option<&[String]>, index_labels: Option<Vec<IndexLabel>>, ) -> Result<Self, FrameError>
Construct a DataFrame from mapping records.
Matches the mapping-record branch of
pd.DataFrame.from_records(records, columns=..., index=...).
Missing keys are null-filled. If column_order is provided, it is used
as the exact output column selector/order and may include labels absent
from the records (materialized as all-null columns).
Sourcepub fn from_csv(text: &str, sep: char) -> Result<Self, FrameError>
pub fn from_csv(text: &str, sep: char) -> Result<Self, FrameError>
Parse a CSV string into a DataFrame.
Matches pd.read_csv(StringIO(text)). The first line is treated as
column headers. Values are auto-detected as Int64, Float64, Bool, or Utf8.
Sourcepub fn from_csv_with_options(
text: &str,
options: &DataFrameCsvReadOptions,
) -> Result<Self, FrameError>
pub fn from_csv_with_options( text: &str, options: &DataFrameCsvReadOptions, ) -> Result<Self, FrameError>
Parse a CSV string into a DataFrame with explicit parsing options.
Matches the pd.read_csv(..., header=..., dtype=..., index_col=..., na_values=...)
shape for currently supported options.
Sourcepub fn from_dict_with_index(
data: Vec<(&str, Vec<Scalar>)>,
index_labels: Vec<IndexLabel>,
) -> Result<Self, FrameError>
pub fn from_dict_with_index( data: Vec<(&str, Vec<Scalar>)>, index_labels: Vec<IndexLabel>, ) -> Result<Self, FrameError>
Construct a DataFrame from a dict of column vectors with an explicit index.
Matches pd.DataFrame({"a": [1, 2]}, index=["x", "y"]).
Sourcepub fn from_dict_with_index_mixed(
data: Vec<(&str, DataFrameColumnInput)>,
index_labels: Vec<IndexLabel>,
) -> Result<Self, FrameError>
pub fn from_dict_with_index_mixed( data: Vec<(&str, DataFrameColumnInput)>, index_labels: Vec<IndexLabel>, ) -> Result<Self, FrameError>
Construct a DataFrame from mixed dict inputs with an explicit index.
Scalar values are broadcast to the explicit index length.
Sourcepub fn select_columns(&self, names: &[&str]) -> Result<Self, FrameError>
pub fn select_columns(&self, names: &[&str]) -> Result<Self, FrameError>
Return a new DataFrame with only the specified columns, in order.
Matches df[["a", "c"]] column selection in pandas, preserving repeated
columns and duplicate column names.
Sourcepub fn column_occurrences(&self, name: &str) -> usize
pub fn column_occurrences(&self, name: &str) -> usize
How many columns carry the label name (0 when none; more than one
for a duplicated label, which df[name] selects as a frame).
Sourcepub fn get_column_selection(
&self,
name: &str,
) -> Result<ColumnSelection, FrameError>
pub fn get_column_selection( &self, name: &str, ) -> Result<ColumnSelection, FrameError>
Single column indexing matching df[name] in pandas.
If name matches a single column, returns ColumnSelection::Series.
If name matches multiple duplicate columns, returns ColumnSelection::DataFrame.
Sourcepub fn empty(&self) -> bool
pub fn empty(&self) -> bool
Pandas-style .empty property: true iff the DataFrame contains
zero rows OR zero columns.
Matches pd.DataFrame.empty. This is a stricter predicate than
is_empty() — a frame with rows but no columns is still empty
under pandas’ definition because there are no values to
operate on.
Sourcepub fn num_columns(&self) -> usize
pub fn num_columns(&self) -> usize
Return the number of columns.
Sourcepub fn dtypes(&self) -> Result<Series, FrameError>
pub fn dtypes(&self) -> Result<Series, FrameError>
Return a Series of dtypes, one per column.
Matches pd.DataFrame.dtypes.
Sourcepub fn copy(&self) -> Self
pub fn copy(&self) -> Self
Return a deep copy of this DataFrame.
Matches pd.DataFrame.copy(deep=True).
Sourcepub fn keys(&self) -> MultiIndexOrIndex
pub fn keys(&self) -> MultiIndexOrIndex
Return the DataFrame info axis.
Matches pd.DataFrame.keys(). This is an alias for the column labels.
pub fn index(&self) -> &Index
Sourcepub fn with_range_span(self, span: Option<(i64, i64, i64)>) -> Self
pub fn with_range_span(self, span: Option<(i64, i64, i64)>) -> Self
This frame with its row labels marked as the pandas RangeIndex
span (or unmarked), the labels unchanged; see
Index::range_span.
Sourcepub fn row_index(&self) -> MultiIndexOrIndex
pub fn row_index(&self) -> MultiIndexOrIndex
Return the logical DataFrame row index.
When row MultiIndex metadata is present, this returns it instead of the
flat storage fallback in index().
Sourcepub fn row_multiindex(&self) -> Option<&MultiIndex>
pub fn row_multiindex(&self) -> Option<&MultiIndex>
The row MultiIndex: the frame’s own, else the levels its flat index
carries (a frame built from a Series that had them).
Sourcepub fn series_index(&self) -> Index
pub fn series_index(&self) -> Index
The row index a column of this frame carries as a Series: the flat
labels, with the row MultiIndex levels attached when the frame has
them, so df['v'] of a multi-key groupby result keeps its levels
(br-frankenpandas-rc0923-epic-rust-parity-bugs-4qg5w.9).
Sourcepub fn column_multiindex(&self) -> Option<&MultiIndex>
pub fn column_multiindex(&self) -> Option<&MultiIndex>
The COLUMN axis when it has more than one level, as
df.groupby(k).agg({'x': ['sum','mean']}) and resample(...).ohlc()
both produce. None means the flat column_order is the whole axis.
Sibling of Self::row_multiindex; the field already existed but had no
reader outside this crate, so the conformance harness could not see a
two-level column axis at all. (br-frankenpandas-nv5ct)
Sourcepub fn columns(&self) -> &ColumnStore
pub fn columns(&self) -> &ColumnStore
Borrowed view of the column store.
Returns ColumnStore, not &BTreeMap<String, Column>: the concrete
map type used to be part of this crate’s public API, which meant a
duplicate-tolerant store could only be exposed by materializing a map
per call — collapsing exactly the repeated labels the store exists to
carry (br-frankenpandas-u387a). The view offers the same reads the
map did (get, contains_key, keys, values, iter, len,
is_empty, and [name] indexing), with iteration still NAME-SORTED.
Sourcepub fn columns_index(&self) -> MultiIndexOrIndex
pub fn columns_index(&self) -> MultiIndexOrIndex
Return the logical DataFrame columns index.
Matches pd.DataFrame.columns, including MultiIndex columns for
operations like groupby.ohlc().
pub fn columns_multiindex(&self) -> Option<&MultiIndex>
Sourcepub fn with_columns_multiindex(
&self,
multiindex: Option<MultiIndex>,
) -> Result<Self, FrameError>
pub fn with_columns_multiindex( &self, multiindex: Option<MultiIndex>, ) -> Result<Self, FrameError>
This frame with multiindex as its column axis (None: the flat
names), as pandas’ df.columns = MultiIndex sets it; the storage keys
stay as they are, so its width must match the column count.
Sourcepub fn column_names(&self) -> Vec<&String>
pub fn column_names(&self) -> Vec<&String>
Return the flat storage column names in observable DataFrame order.
For the pandas-visible logical column index, including MultiIndex
metadata, use columns_index().
Sourcepub fn column_label(&self, name: &str) -> IndexLabel
pub fn column_label(&self, name: &str) -> IndexLabel
The typed pandas label of the column keyed name (see
column_key): 0 for DataFrame([[1, 2]])’s first column, the
string itself for a string label.
Sourcepub fn column_series_name(&self, name: &str) -> LabelName
pub fn column_series_name(&self, name: &str) -> LabelName
The name a Series of the column keyed name takes: its typed label
(DataFrame([[1, 2]])[0].name is the integer 0).
Sourcepub fn column_labels(&self) -> Vec<IndexLabel>
pub fn column_labels(&self) -> Vec<IndexLabel>
Every column’s typed label, in column order.
Sourcepub fn with_column_labels(
self,
labels: Vec<IndexLabel>,
) -> Result<Self, FrameError>
pub fn with_column_labels( self, labels: Vec<IndexLabel>, ) -> Result<Self, FrameError>
This frame with its columns labelled labels, one per column in
order; each must key its column (column_key(label) is the name).
Sourcepub fn with_recorded_column_labels(
self,
labels: impl IntoIterator<Item = IndexLabel>,
) -> Self
pub fn with_recorded_column_labels( self, labels: impl IntoIterator<Item = IndexLabel>, ) -> Self
This frame recording labels as the typed labels of the columns
they key (see column_key); a label keying no column is ignored.
Sourcepub fn columns_name(&self) -> Option<&LabelName>
pub fn columns_name(&self) -> Option<&LabelName>
pandas’ df.columns.name: the column axis’ own name (a pivot’s is
its columns column’s).
Sourcepub fn with_columns_name<N: Into<LabelName>>(self, name: Option<N>) -> Self
pub fn with_columns_name<N: Into<LabelName>>(self, name: Option<N>) -> Self
This frame with its column axis named name (pandas’
rename_axis(columns=name); None unnames it). A LabelName keeps
its typed label.
Sourcepub fn with_value_labels(self, dtype: &DType) -> Self
pub fn with_value_labels(self, dtype: &DType) -> Self
This frame with its columns labelled by the dtype values their names
print - for columns made from a column’s values (pivot’s, crosstab’s,
get_dummies’): the column ‘5’ made from an int64 value is the integer
5, as in pandas (fvsao.32). A name that is not exactly such a value’s
text stays a string.
Sourcepub fn column_range_span(&self) -> Option<(i64, i64, i64)>
pub fn column_range_span(&self) -> Option<(i64, i64, i64)>
The range(start, stop, step) the column labels are when they are
pandas’ default RangeIndex (DataFrame([[1, 2]]).columns), while the
columns still are exactly that range.
Sourcepub fn with_column_range(self, span: (i64, i64, i64)) -> Self
pub fn with_column_range(self, span: (i64, i64, i64)) -> Self
This frame’s columns marked as pandas’ default RangeIndex span (its
integer labels recorded too).
Sourcepub fn with_labels_of(self, source: &Self) -> Self
pub fn with_labels_of(self, source: &Self) -> Self
This frame with the typed column labels source records for the
columns they share by name - for a result whose columns are some of
source’s (a selection, a reordering, a row operation rebuilt from
names), which dropped them (fvsao.32).
Sourcepub fn with_column_levels(&self, series: Series) -> Series
pub fn with_column_levels(&self, series: Series) -> Series
series, indexed by (some of) this frame’s columns, with those
columns’ MultiIndex levels attached: pandas indexes a row or a
reduction of MultiIndex columns by that MultiIndex (df.iloc[0],
df.sum() - the flat keys were the index; g3bux).
Sourcepub fn with_typed_labels_of(self, source: &Self) -> Self
pub fn with_typed_labels_of(self, source: &Self) -> Self
Self::with_labels_of without the RangeIndex mark, for a result
pandas builds a new column Index for (describe’s, get_dummies’).
Sourcepub fn columns_tz(&self) -> Option<&str>
pub fn columns_tz(&self) -> Option<&str>
The zone of datetime column labels (pandas’ df.columns.tz): a
tz-aware row index transposed onto the columns keeps it.
pub fn column(&self, name: &str) -> Option<&Column>
Sourcepub fn column_at(&self, position: usize) -> Option<&Column>
pub fn column_at(&self, position: usize) -> Option<&Column>
O(1) positional column access, the value counterpart to
Self::column_name_at.
br-frankenpandas-3ya6b. Reading every column of a frame had no route
that did not go through a label: callers had to ask
column_name_at(i) for an OWNED String and hand it straight back to
Self::column. On a transposed frame that label is a formatted
integer, so the round trip per column was
i.to_string()— one allocation to make the label,name.parse::<i64>()— to recover the position it came from, andlabel.to_string() != name— a SECOND allocation to validate the round trip (seehomogeneous_transpose_column_position),
to arrive back at the position the caller already had. A transposed frame has one output column per SOURCE ROW, so this is the one shape in the corpus where a per-column constant scales with the data: at 1M rows the old route pays ~2M allocations and ~1M parses before any column is materialized.
⚠️ THIS REMOVES A CONSTANT, NOT THE STRUCTURAL GAP. pandas answers
df.T.to_numpy() from its 2D BlockManager and measured FLAT at
45.2/44.6/44.6us from 10k to 1M rows, while FrankenPandas must still
build one Column per output column however it is addressed
(br-frankenpandas-l4vzc). Do not expect this to change the SIGN of that
comparison; if a measurement ever shows it doing so, l4vzc’s structural
account is wrong and that is the interesting result.
Sourcepub fn column_name_at(&self, position: usize) -> Option<String>
pub fn column_name_at(&self, position: usize) -> Option<String>
O(1) positional column-name access, matching df.columns[i] in
pandas. Unlike column_names(), a lazily labeled column axis (a
transposed frame’s Int64UnitRange order) formats just the requested
label instead of materializing every label String.
Sourcepub fn filter_rows(&self, mask: &Series) -> Result<Self, FrameError>
pub fn filter_rows(&self, mask: &Series) -> Result<Self, FrameError>
Filter rows where mask is True.
Matches df[bool_series] boolean indexing in pandas.
The mask must be a Bool-typed Series. Indexes are aligned; missing
mask values are treated as False.
Sourcepub fn isna(&self) -> Result<Self, FrameError>
pub fn isna(&self) -> Result<Self, FrameError>
Return a DataFrame of booleans indicating missing values.
Matches df.isna().
Sourcepub fn notna(&self) -> Result<Self, FrameError>
pub fn notna(&self) -> Result<Self, FrameError>
Return a DataFrame of booleans indicating non-missing values.
Matches df.notna().
Sourcepub fn isnull(&self) -> Result<Self, FrameError>
pub fn isnull(&self) -> Result<Self, FrameError>
Alias for isna.
Matches df.isnull().
Sourcepub fn notnull(&self) -> Result<Self, FrameError>
pub fn notnull(&self) -> Result<Self, FrameError>
Alias for notna.
Matches df.notnull().
Sourcepub fn count(&self) -> Result<Series, FrameError>
pub fn count(&self) -> Result<Series, FrameError>
Return non-missing counts for each column.
Matches df.count() default behavior (axis=0, skipna=True).
Sourcepub fn count_na(&self) -> Result<Series, FrameError>
pub fn count_na(&self) -> Result<Series, FrameError>
Count of missing (NaN/null) values per column.
Matches df.isna().sum(). Returns a Series indexed by column name.
Sourcepub fn fillna(&self, fill_value: &Scalar) -> Result<Self, FrameError>
pub fn fillna(&self, fill_value: &Scalar) -> Result<Self, FrameError>
Fill missing values in each column with fill_value.
Matches df.fillna(value) for scalar value.
Sourcepub fn fillna_limit(
&self,
fill_value: &Scalar,
limit: usize,
) -> Result<Self, FrameError>
pub fn fillna_limit( &self, fill_value: &Scalar, limit: usize, ) -> Result<Self, FrameError>
Fill the first limit missing values of each column with
fill_value (see Series::fillna_limit).
Matches df.fillna(value, limit=N).
Sourcepub fn fillna_dict(
&self,
fill_map: &BTreeMap<String, Scalar>,
) -> Result<Self, FrameError>
pub fn fillna_dict( &self, fill_map: &BTreeMap<String, Scalar>, ) -> Result<Self, FrameError>
Fill missing values with per-column values.
Matches df.fillna({'col1': val1, 'col2': val2}).
Columns not listed in fill_map are left unchanged.
Sourcepub fn dropna(&self) -> Result<Self, FrameError>
pub fn dropna(&self) -> Result<Self, FrameError>
Drop rows containing missing values in any selected column.
Matches default df.dropna() row-wise behavior (axis=0, how='any').
Sourcepub fn dropna_with_options(
&self,
how: DropNaHow,
subset: Option<&[String]>,
) -> Result<Self, FrameError>
pub fn dropna_with_options( &self, how: DropNaHow, subset: Option<&[String]>, ) -> Result<Self, FrameError>
Drop rows by configurable missing-value policy.
Matches df.dropna(how=..., subset=...) for row-wise mode (axis=0).
Sourcepub fn dropna_with_threshold(
&self,
thresh: usize,
subset: Option<&[String]>,
) -> Result<Self, FrameError>
pub fn dropna_with_threshold( &self, thresh: usize, subset: Option<&[String]>, ) -> Result<Self, FrameError>
Drop rows by minimum non-missing value count.
Matches df.dropna(thresh=..., subset=...) for row-wise mode (axis=0).
Sourcepub fn dropna_columns(&self) -> Result<Self, FrameError>
pub fn dropna_columns(&self) -> Result<Self, FrameError>
Drop columns containing missing values in any row.
Matches default df.dropna(axis=1) behavior (how='any').
Sourcepub fn dropna_columns_with_options(
&self,
how: DropNaHow,
subset: Option<&[IndexLabel]>,
) -> Result<Self, FrameError>
pub fn dropna_columns_with_options( &self, how: DropNaHow, subset: Option<&[IndexLabel]>, ) -> Result<Self, FrameError>
Drop columns by configurable missing-value policy.
Matches df.dropna(axis=1, how=..., subset=...) where subset selects
row labels to consider during missing-value checks.
Sourcepub fn dropna_columns_with_threshold(
&self,
thresh: usize,
subset: Option<&[IndexLabel]>,
) -> Result<Self, FrameError>
pub fn dropna_columns_with_threshold( &self, thresh: usize, subset: Option<&[IndexLabel]>, ) -> Result<Self, FrameError>
Drop columns by minimum non-missing value count.
Matches df.dropna(axis=1, thresh=..., subset=...) where subset
selects row labels to consider.
Sourcepub fn duplicated(
&self,
subset: Option<&[String]>,
keep: DuplicateKeep,
) -> Result<Series, FrameError>
pub fn duplicated( &self, subset: Option<&[String]>, keep: DuplicateKeep, ) -> Result<Series, FrameError>
Return a boolean Series indicating duplicated rows.
Matches df.duplicated(subset=..., keep=...).
Uses hash-based O(n) deduplication instead of O(n²) pairwise comparison. Per br-frankenpandas-cclly performance optimization.
Sourcepub fn drop_duplicates(
&self,
subset: Option<&[String]>,
keep: DuplicateKeep,
ignore_index: bool,
) -> Result<Self, FrameError>
pub fn drop_duplicates( &self, subset: Option<&[String]>, keep: DuplicateKeep, ignore_index: bool, ) -> Result<Self, FrameError>
Drop duplicated rows.
Matches df.drop_duplicates(subset=..., keep=..., ignore_index=...).
Sourcepub fn head(&self, n: i64) -> Result<Self, FrameError>
pub fn head(&self, n: i64) -> Result<Self, FrameError>
Return the first n rows.
Matches df.head(n). If n is negative, this returns all rows except
the last -n rows.
Sourcepub fn tail(&self, n: i64) -> Result<Self, FrameError>
pub fn tail(&self, n: i64) -> Result<Self, FrameError>
Return the last n rows.
Matches df.tail(n). If n is negative, this returns all rows except
the first -n rows.
Sourcepub fn set_index(&self, column: &str, drop: bool) -> Result<Self, FrameError>
pub fn set_index(&self, column: &str, drop: bool) -> Result<Self, FrameError>
Set the DataFrame index from an existing column.
Matches df.set_index(column, drop=...) for a single column selector.
Sourcepub fn set_index_with_verify_integrity(
&self,
column: &str,
drop: bool,
verify_integrity: bool,
) -> Result<Self, FrameError>
pub fn set_index_with_verify_integrity( &self, column: &str, drop: bool, verify_integrity: bool, ) -> Result<Self, FrameError>
Set the DataFrame index from an existing column while optionally rejecting duplicate labels.
Sourcepub fn set_index_multi(
&self,
columns: &[&str],
drop: bool,
sep: &str,
) -> Result<Self, FrameError>
pub fn set_index_multi( &self, columns: &[&str], drop: bool, sep: &str, ) -> Result<Self, FrameError>
Set the index from multiple columns, creating a composite index.
Matches df.set_index([col1, col2, ...]) in pandas. The composite
index is formed from the tuple of values across the specified columns,
formatted with the separator (default "/"). If drop is true
(pandas default), the columns are removed from the DataFrame.
Sourcepub fn set_index_append(
&self,
columns: &[&str],
drop: bool,
sep: &str,
) -> Result<Self, FrameError>
pub fn set_index_append( &self, columns: &[&str], drop: bool, sep: &str, ) -> Result<Self, FrameError>
df.set_index(columns, append=True): a MultiIndex whose levels are
the current index’s (every level of a row MultiIndex, keeping their
names) followed by columns.
Sourcepub fn to_multi_index(&self, columns: &[&str]) -> Result<MultiIndex, FrameError>
pub fn to_multi_index(&self, columns: &[&str]) -> Result<MultiIndex, FrameError>
Extract a MultiIndex from the specified columns.
Does NOT modify the DataFrame. Returns a standalone MultiIndex
that can be used for hierarchical indexing operations.
Sourcepub fn reset_index(&self, drop: bool) -> Result<Self, FrameError>
pub fn reset_index(&self, drop: bool) -> Result<Self, FrameError>
Reset the index to a default RangeIndex.
Matches df.reset_index(drop=...) for the single-index DataFrame model.
Sourcepub fn reset_index_allow_duplicates(
&self,
drop: bool,
allow_duplicates: bool,
) -> Result<Self, FrameError>
pub fn reset_index_allow_duplicates( &self, drop: bool, allow_duplicates: bool, ) -> Result<Self, FrameError>
df.reset_index(drop=..., allow_duplicates=...): with
allow_duplicates an index column may take a label a column already
has (pandas’ insert rule), where without it that is pandas’ “cannot
insert X, already exists” (br-frankenpandas-n57tz: allow_duplicates
was refused).
Sourcepub fn sort_index(&self, ascending: bool) -> Result<Self, FrameError>
pub fn sort_index(&self, ascending: bool) -> Result<Self, FrameError>
Return a new DataFrame sorted by index labels.
Matches df.sort_index(ascending=...) for 1D index labels.
Sourcepub fn sort_index_na(
&self,
ascending: bool,
na_position: &str,
) -> Result<Self, FrameError>
pub fn sort_index_na( &self, ascending: bool, na_position: &str, ) -> Result<Self, FrameError>
Return a new DataFrame sorted by index labels with explicit NA position.
Matches df.sort_index(ascending=..., na_position='first'|'last').
Sourcepub fn sort_index_axis1(&self, ascending: bool) -> Result<Self, FrameError>
pub fn sort_index_axis1(&self, ascending: bool) -> Result<Self, FrameError>
Sort the DataFrame by its column labels (axis=1).
Matches df.sort_index(axis=1, ascending=...): the labels
themselves - a column MultiIndex level by level, typed labels by
value (2 before 10) - not the storage names as text, which put the
column 10 before 2 and a pivot_table’s (v, 10) before (v, 2)
(br-frankenpandas-xbl2k). Stable; a repeated name keeps its columns
together in their order.
Sourcepub fn sort_values(
&self,
column: &str,
ascending: bool,
) -> Result<Self, FrameError>
pub fn sort_values( &self, column: &str, ascending: bool, ) -> Result<Self, FrameError>
Return a new DataFrame sorted by a column’s values.
Matches df.sort_values(by=column, ascending=...) for a single
column key with default na_position='last'.
Sourcepub fn sort_values_na(
&self,
column: &str,
ascending: bool,
na_position: &str,
) -> Result<Self, FrameError>
pub fn sort_values_na( &self, column: &str, ascending: bool, na_position: &str, ) -> Result<Self, FrameError>
Return a new DataFrame sorted by a column’s values with explicit NA position.
Matches df.sort_values(by=column, ascending=..., na_position='first'|'last').
Sourcepub fn sort_values_multi(
&self,
by: &[&str],
ascending: &[bool],
na_position: &str,
) -> Result<Self, FrameError>
pub fn sort_values_multi( &self, by: &[&str], ascending: &[bool], na_position: &str, ) -> Result<Self, FrameError>
Sort by multiple columns with per-column ascending flags.
Matches df.sort_values(by=[...], ascending=[...], na_position='first'|'last').
na_position defaults to “last”.
Sourcepub fn sort_values_at(
&self,
positions: &[usize],
ascending: &[bool],
na_position: &str,
) -> Result<Self, FrameError>
pub fn sort_values_at( &self, positions: &[usize], ascending: &[bool], na_position: &str, ) -> Result<Self, FrameError>
Sort by the columns AT positions (per-key ascending flags): a key
under a repeated column key - a MultiIndex column whose leaf name
repeats, (‘q’, ‘e’) beside (‘p’, ‘e’) - sorts by its own column
(i17d4; by name it sorted by the first).
Sourcepub fn loc(&self, labels: &[IndexLabel]) -> Result<Self, FrameError>
pub fn loc(&self, labels: &[IndexLabel]) -> Result<Self, FrameError>
Label-based row selection for list-like indexers.
Matches df.loc[[...]] for list selectors. Requested labels are
returned in selector order and duplicate labels are preserved.
Missing labels fail closed.
Sourcepub fn loc_with_columns(
&self,
labels: &[IndexLabel],
column_selector: Option<&[String]>,
) -> Result<Self, FrameError>
pub fn loc_with_columns( &self, labels: &[IndexLabel], column_selector: Option<&[String]>, ) -> Result<Self, FrameError>
Label-based row+column selection for list-like indexers.
Matches df.loc[[...], [...]] for list selectors. Requested rows are
returned in selector order and duplicate row labels are preserved.
Missing labels/columns fail closed.
Sourcepub fn loc_tuple(&self, key: &[IndexLabel]) -> Result<Self, FrameError>
pub fn loc_tuple(&self, key: &[IndexLabel]) -> Result<Self, FrameError>
Tuple-/prefix-key row selection against a row MultiIndex.
Exact tuple keys ([lvl0, lvl1, ...]) match full composite rows.
Shorter keys act as prefix selection, mirroring df.loc[(a, slice(None))]
for the leading levels.
Sourcepub fn loc_tuple_with_columns(
&self,
key: &[IndexLabel],
column_selector: Option<&[String]>,
) -> Result<Self, FrameError>
pub fn loc_tuple_with_columns( &self, key: &[IndexLabel], column_selector: Option<&[String]>, ) -> Result<Self, FrameError>
Tuple-/prefix-key row selection with an optional column subset.
Sourcepub fn get_loc(
&self,
key: &[IndexLabel],
level: Option<usize>,
) -> Result<Vec<usize>, FrameError>
pub fn get_loc( &self, key: &[IndexLabel], level: Option<usize>, ) -> Result<Vec<usize>, FrameError>
Return row positions for a row-MultiIndex tuple or a single level key.
level=None performs exact or prefix tuple lookup depending on key arity.
level=Some(n) performs a single-label lookup on the N-th level.
Sourcepub fn get_loc_level(
&self,
key: &[IndexLabel],
) -> Result<(Vec<usize>, Option<MultiIndexOrIndex>), FrameError>
pub fn get_loc_level( &self, key: &[IndexLabel], ) -> Result<(Vec<usize>, Option<MultiIndexOrIndex>), FrameError>
pandas-style tuple lookup returning matching positions and the remaining row index.
Sourcepub fn iloc(&self, positions: &[i64]) -> Result<Self, FrameError>
pub fn iloc(&self, positions: &[i64]) -> Result<Self, FrameError>
Position-based row selection for list-like indexers.
Matches df.iloc[[...]] for list selectors. Requested positions are
returned in selector order and duplicates are preserved.
Negative positions are resolved from the end of the DataFrame.
Sourcepub fn iloc_step(
&self,
start: usize,
step: isize,
len: usize,
) -> Result<Self, FrameError>
pub fn iloc_step( &self, start: usize, step: isize, len: usize, ) -> Result<Self, FrameError>
len rows from start, step apart (step negative for a backwards
slice): df.iloc[start::step] as Python’s slice.indices resolves it.
The rows are an arithmetic index and each all-valid float64 column a
strided view of its buffer, as pandas’ slice is a numpy view; every
stepped slice built, normalized and gathered a list of positions
(df.iloc[::-1] 8.6 ms a million rows by three columns, pandas 0.008;
br-frankenpandas-e00f7). Other columns gather the rows.
§Errors
Rejects a selection reaching outside the rows, as iloc does.
Sourcepub fn iloc_with_columns(
&self,
positions: &[i64],
column_selector: Option<&[String]>,
) -> Result<Self, FrameError>
pub fn iloc_with_columns( &self, positions: &[i64], column_selector: Option<&[String]>, ) -> Result<Self, FrameError>
Position-based row+column selection for list-like indexers.
Matches df.iloc[[...], [...]] for list selectors. Requested rows are
returned in selector order and duplicates are preserved.
Missing columns fail closed.
Sourcepub fn loc_bool(&self, mask: &[bool]) -> Result<Self, FrameError>
pub fn loc_bool(&self, mask: &[bool]) -> Result<Self, FrameError>
Boolean mask row selection.
Matches df.loc[bool_array] in pandas. The boolean mask must have the
same length as the DataFrame. Rows where the mask is True are kept.
Sourcepub fn iloc_bool(&self, mask: &[bool]) -> Result<Self, FrameError>
pub fn iloc_bool(&self, mask: &[bool]) -> Result<Self, FrameError>
Boolean mask row selection (position-based).
Matches df.iloc[bool_array] in pandas. Semantically identical to
loc_bool for DataFrames (the mask selects rows by position either way).
Sourcepub fn loc_bool_series(&self, mask: &Series) -> Result<Self, FrameError>
pub fn loc_bool_series(&self, mask: &Series) -> Result<Self, FrameError>
Boolean Series mask row selection with index alignment.
Matches df.loc[bool_series] in pandas, the most common usage pattern
(e.g., df.loc[df['col'] > 5]). The mask Series is aligned with the
DataFrame by index before filtering. Missing mask values are treated
as False. This is an alias for DataFrame::filter_rows.
Sourcepub fn iloc_bool_series(&self, mask: &Series) -> Result<Self, FrameError>
pub fn iloc_bool_series(&self, mask: &Series) -> Result<Self, FrameError>
Position-based boolean Series mask row selection with index alignment.
Matches df.iloc[bool_series] in pandas. Semantically identical to
loc_bool_series (delegates to filter_rows).
Sourcepub fn loc_slice(
&self,
start: Option<&IndexLabel>,
stop: Option<&IndexLabel>,
) -> Result<Self, FrameError>
pub fn loc_slice( &self, start: Option<&IndexLabel>, stop: Option<&IndexLabel>, ) -> Result<Self, FrameError>
Label-based slice row selection (inclusive on both ends).
Matches df.loc[start:stop] in pandas. Both endpoints are inclusive
(pandas label-slicing semantics). Either may be None to mean “from
the beginning” or “to the end”.
Sourcepub fn loc_slice_positions(
&self,
start: Option<&IndexLabel>,
stop: Option<&IndexLabel>,
) -> Result<Vec<usize>, FrameError>
pub fn loc_slice_positions( &self, start: Option<&IndexLabel>, stop: Option<&IndexLabel>, ) -> Result<Vec<usize>, FrameError>
The row positions .loc[start:stop] selects, resolved as
Self::loc_slice resolves them - for callers that write through
them (df.loc[a:b, col] = value).
Sourcepub fn iloc_slice(
&self,
start: Option<i64>,
stop: Option<i64>,
) -> Result<Self, FrameError>
pub fn iloc_slice( &self, start: Option<i64>, stop: Option<i64>, ) -> Result<Self, FrameError>
Position-based slice row selection (exclusive end).
Matches df.iloc[start:stop] in pandas. The start is inclusive and
stop is exclusive (Python slice semantics). Negative values are
resolved from the end. Both are optional.
Sourcepub fn loc_row(&self, label: &IndexLabel) -> Result<Series, FrameError>
pub fn loc_row(&self, label: &IndexLabel) -> Result<Series, FrameError>
Return a single row as a Series by label.
Matches df.loc[label] when label is a scalar in pandas. The
returned Series has the DataFrame’s column names as its index and the
row values as data.
Sourcepub fn loc_row_tuple(&self, key: &[IndexLabel]) -> Result<Series, FrameError>
pub fn loc_row_tuple(&self, key: &[IndexLabel]) -> Result<Series, FrameError>
Return a single row as a Series by exact row-MultiIndex tuple.
Sourcepub fn iloc_row(&self, position: i64) -> Result<Series, FrameError>
pub fn iloc_row(&self, position: i64) -> Result<Series, FrameError>
Return a single row as a Series by position.
Matches df.iloc[n] when n is a scalar in pandas. The returned
Series has the DataFrame’s column names as its index and the row values
as data.
Sourcepub fn with_column(
&self,
name: impl Into<String>,
column: Column,
) -> Result<Self, FrameError>
pub fn with_column( &self, name: impl Into<String>, column: Column, ) -> Result<Self, FrameError>
Add or replace a column.
Matches df['new_col'] = values.
Sourcepub fn astype_columns(
&self,
mapping: &[(&str, DType)],
) -> Result<Self, FrameError>
pub fn astype_columns( &self, mapping: &[(&str, DType)], ) -> Result<Self, FrameError>
Cast one or more columns to target dtypes.
Matches mapping-style df.astype({"a": dtype_a, "b": dtype_b}).
Mapping order is processed deterministically and duplicate selectors
are rejected.
Sourcepub fn astype_column(
&self,
name: &str,
dtype: DType,
) -> Result<Self, FrameError>
pub fn astype_column( &self, name: &str, dtype: DType, ) -> Result<Self, FrameError>
Cast a single column to a target dtype.
Matches df.astype({"col": dtype}) for single-column mapping.
Sourcepub fn astype_column_width(
&self,
name: &str,
width: NumericWidth,
nullable: bool,
) -> Result<Self, FrameError>
pub fn astype_column_width( &self, name: &str, width: NumericWidth, nullable: bool, ) -> Result<Self, FrameError>
Cast the column name to a numpy dtype narrower than 64 bits
(df.astype({'a': 'int16'})), as Series::astype_width.
Sourcepub fn astype_width(
&self,
width: NumericWidth,
nullable: bool,
) -> Result<Self, FrameError>
pub fn astype_width( &self, width: NumericWidth, nullable: bool, ) -> Result<Self, FrameError>
Cast every column to a numpy dtype narrower than 64 bits
(df.astype('int32')), as Series::astype_width.
Sourcepub fn astype(&self, dtype: DType) -> Result<Self, FrameError>
pub fn astype(&self, dtype: DType) -> Result<Self, FrameError>
Cast all columns to a single target dtype.
Matches df.astype(dtype) (scalar form).
Sourcepub fn with_constructor_dtype(&self, dtype: DType) -> Result<Self, FrameError>
pub fn with_constructor_dtype(&self, dtype: DType) -> Result<Self, FrameError>
Apply the CONSTRUCTOR’s dtype= argument to every column.
Matches the dtype= parameter of pd.DataFrame(data, dtype=...), which
is deliberately NOT the same operation as Self::astype even though
both name a target dtype. Measured on pandas 2.2.3:
pd.DataFrame([[1.5]], dtype='int64') -> ValueError: Trying to coerce
float values to integers
pd.DataFrame([[1.5]]).astype('int64') -> [[1]] <- TRUNCATES
pd.DataFrame([[2.0]], dtype='int64') -> [[2]] <- lossless is fineSo the constructor REFUSES a lossy float->int while astype truncates
toward zero. Column::new already encodes the strict rule
(br-frankenpandas-8nupg), and this is its frame-level composition.
It exists as its own method rather than reusing astype because the two
only COINCIDE today: Self::astype currently also goes through
Column::new without pre-truncating, so it inherits the strict rule. The
moment astype is corrected to truncate, a constructor path routed
through it would silently start truncating too — a divergence nothing
would catch. Keeping them separate makes that fix safe.
Added by br-frankenpandas-oxodo: the conformance harness had been
applying constructor dtype= ITSELF, so every constructor_dtype
fixture was green against a capability FrankenPandas did not expose.
Apply the DataFrame constructor’s dtype= to every column.
A NON-NULLABLE int64 REFUSES A MISSING VALUE. numpy’s int64 has no
NA representation, and pandas aborts the whole construction rather than
inventing one - it does NOT fall back to a nullable dtype or to NaN.
br-frankenpandas-v1zy1. MEASURED, live pandas 2.2.3, on
[[True, None], [False, True]]:
dtype= | pandas | why |
|---|---|---|
int64 | TypeError | numpy int64 cannot hold NA |
Int64 | [1, <NA>] | the nullable extension dtype can |
float64 | [1.0, nan] | NaN IS float64’s missing value |
Float64 | [1.0, <NA>] | extension dtype |
str | ['True', None] | the missing value SURVIVES the cast |
string | ['True', <NA>] | ditto, as the extension dtype |
bool | [True, False] | COERCED by truthiness; bool has no NA |
boolean | [True, <NA>] | extension dtype |
THE THREE FAMILIES RESOLVE THE SAME PROBLEM THREE DIFFERENT WAYS, which
is why there is no single “non-nullable dtypes reject missing values” rule:
int64 RAISES, bool COERCES, float64 has NaN as its own missing value.
A STRING CAST PRESERVES MISSINGNESS HERE AND ONLY HERE. astype(str)
genuinely does stringify - measured, pd.Series([True, None]).astype(str)
is ['True', 'None'] - so the shared cast in Column::new is RIGHT for
astype and wrong only for the constructor, which is why this method
restores the missing values rather than the cast being changed.
br-frankenpandas-constructor-utf8-null-stringified-r1bbv.
Before this check FrankenPandas returned [1, Null] for BOTH spellings, so
int64 and Int64 were behaviourally identical at the constructor and no
value fixture could detect them being confused - which is why
br-frankenpandas-jozfk’s spec-resolution fix, correct on its own terms, did
not make the corpus able to catch a regression that reverted it.
The check lives HERE and deliberately NOT in Column::new: numpy-int64
semantics are a property of the CONSTRUCTOR’s dtype=, while Column::new
is shared with astype and with internal builders that legitimately pair
DType::Int64 with missing values.
Sourcepub fn tz_localize(&self, tz: Option<&str>) -> Result<Self, FrameError>
pub fn tz_localize(&self, tz: Option<&str>) -> Result<Self, FrameError>
Localize tz-naive datetime columns to a timezone or strip timezone info.
Matches the supported subset of pd.DataFrame.tz_localize(tz). Walks
every Utf8-typed column whose values look like ISO-8601 datetime
strings and applies DatetimeAccessor::tz_localize column-by-column.
Non-Utf8 columns and Utf8 columns whose contents don’t parse as
datetimes are passed through unchanged. Per br-frankenpandas-6iac0.
Note: pandas’ DataFrame.tz_localize operates on the index axis by
default; this implementation deviates by walking column VALUES because
fp-index doesn’t yet have a dedicated DatetimeIndex variant (tracked
separately under br-frankenpandas-t8hz0). When the DatetimeIndex
variant lands, this method should grow an axis parameter.
Sourcepub fn tz_localize_with_options(
&self,
tz: Option<&str>,
options: TzLocalizeOptions,
) -> Result<Self, FrameError>
pub fn tz_localize_with_options( &self, tz: Option<&str>, options: TzLocalizeOptions, ) -> Result<Self, FrameError>
Localize tz-naive datetime columns with explicit DST policy.
Matches the supported subset of pd.DataFrame.tz_localize(tz, ambiguous=..., nonexistent=...). Same column-walking rules as
Self::tz_localize.
Sourcepub fn tz_convert(&self, tz: Option<&str>) -> Result<Self, FrameError>
pub fn tz_convert(&self, tz: Option<&str>) -> Result<Self, FrameError>
Convert timezone-aware datetime columns to a different timezone.
Matches the supported subset of pd.DataFrame.tz_convert(tz). Walks
every Utf8 datetime-string column and applies DatetimeAccessor::tz_convert
column-by-column. Non-Utf8 columns are passed through; columns whose
values are tz-naive (no offset suffix) raise an error matching
pandas’ “Cannot convert tz-naive timestamps, use tz_localize” message.
Per br-frankenpandas-6iac0.
Same axis-deviation note as Self::tz_localize.
Sourcepub fn to_period(&self, freq: &str) -> Result<Self, FrameError>
pub fn to_period(&self, freq: &str) -> Result<Self, FrameError>
Convert a datetime-like row index to period-style labels.
Matches the row-index default of pd.DataFrame.to_period(freq) for the
supported Y, Q, M, W, D, B, H, T/min, and S
frequencies.
FrankenPandas stores the converted labels in the existing flat Index
as canonical period strings until a dedicated Period label variant lands.
Sourcepub fn to_timestamp(&self, freq: &str, how: &str) -> Result<Self, FrameError>
pub fn to_timestamp(&self, freq: &str, how: &str) -> Result<Self, FrameError>
Convert period-style row index labels to timestamp labels.
Matches the row-index default of pd.DataFrame.to_timestamp(freq, how)
for the supported Y, Q, M, D, H, T/min, and S
frequencies. Until FrankenPandas has a dedicated PeriodIndex label type,
this accepts the canonical period strings emitted by Self::to_period.
Sourcepub fn astype_columns_safe(
&self,
mapping: &[(&str, DType)],
errors: &str,
) -> Result<Self, FrameError>
pub fn astype_columns_safe( &self, mapping: &[(&str, DType)], errors: &str, ) -> Result<Self, FrameError>
Cast one or more columns with error handling.
Matches df.astype({"a": dtype}, errors='coerce'|'raise'|'ignore').
errors="raise"(default): propagate conversion errorserrors="coerce": values that fail conversion become NaNerrors="ignore": return the original DataFrame unchanged on error
Sourcepub fn astype_safe(
&self,
dtype: DType,
errors: &str,
) -> Result<Self, FrameError>
pub fn astype_safe( &self, dtype: DType, errors: &str, ) -> Result<Self, FrameError>
Cast all columns with error handling.
Matches df.astype(dtype, errors='coerce'|'raise'|'ignore').
Sourcepub fn drop_column(&self, name: &str) -> Result<Self, FrameError>
pub fn drop_column(&self, name: &str) -> Result<Self, FrameError>
Remove a column by name, returning the modified DataFrame.
Matches df.drop(columns=['col']).
Sourcepub fn drop_columns(&self, names: &[&str]) -> Result<Self, FrameError>
pub fn drop_columns(&self, names: &[&str]) -> Result<Self, FrameError>
Drop multiple columns at once.
Matches df.drop(columns=[...]). Returns error if any column is missing.
Sourcepub fn filter(
&self,
items: Option<&[&str]>,
like: Option<&str>,
regex: Option<&str>,
) -> Result<Self, FrameError>
pub fn filter( &self, items: Option<&[&str]>, like: Option<&str>, regex: Option<&str>, ) -> Result<Self, FrameError>
Filter the DataFrame by column-label patterns.
Matches pd.DataFrame.filter(items=None, like=None, regex=None, axis=1)
(column-axis filter). Exactly one of items, like, or regex must
be Some; the others must be None. Per br-frankenpandas-nk54a.
items: Some(list): keep columns whose names appear inlist, inlistorder. Missing names are silently dropped (matches pandas).like: Some(substr): keep columns whose names containsubstr.regex: Some(pattern): keep columns whose names match the regex.
Use DataFrame::filter_axis with axis=0 for row-index label
matching.
Sourcepub fn filter_axis(
&self,
items: Option<&[&str]>,
like: Option<&str>,
regex: Option<&str>,
axis: usize,
) -> Result<Self, FrameError>
pub fn filter_axis( &self, items: Option<&[&str]>, like: Option<&str>, regex: Option<&str>, axis: usize, ) -> Result<Self, FrameError>
Filter rows or columns by label.
Matches pd.DataFrame.filter(items=None, like=None, regex=None, axis=...).
axis=0: filter rows by row-index label string form.axis=1: filter columns by column label.
Exactly one of items, like, or regex must be provided. items
preserves the caller-provided item order and silently drops missing
labels.
Sourcepub fn rename(&self, mapping: &[(&str, &str)]) -> Result<Self, FrameError>
pub fn rename(&self, mapping: &[(&str, &str)]) -> Result<Self, FrameError>
pandas-named column rename alias.
Matches df.rename(columns={'old': 'new'}) for mapping-style
column renames.
Sourcepub fn rename_columns(
&self,
mapping: &[(&str, &str)],
) -> Result<Self, FrameError>
pub fn rename_columns( &self, mapping: &[(&str, &str)], ) -> Result<Self, FrameError>
Rename columns using a mapping.
Matches df.rename(columns={'old': 'new'}).
Sourcepub fn rename_columns_map(
&self,
mapping: &HashMap<String, String>,
) -> Result<Self, FrameError>
pub fn rename_columns_map( &self, mapping: &HashMap<String, String>, ) -> Result<Self, FrameError>
Rename columns using a HashMap mapping.
Convenience wrapper matching df.rename(columns={...}) semantics.
Only columns present in the mapping are renamed; others are kept as-is.
Sourcepub fn rename_with<F>(&self, func: F) -> Result<Self, FrameError>
pub fn rename_with<F>(&self, func: F) -> Result<Self, FrameError>
Rename columns using a mapper function.
Matches df.rename(columns=func). Applies the function to each column name.
Sourcepub fn rename_index(&self, mapping: &[(IndexLabel, IndexLabel)]) -> Self
pub fn rename_index(&self, mapping: &[(IndexLabel, IndexLabel)]) -> Self
Rename index labels using a mapping.
Matches df.rename(index={...}). Labels not in the mapping are
left unchanged.
Sourcepub fn rename_index_with<F>(&self, func: F) -> Self
pub fn rename_index_with<F>(&self, func: F) -> Self
Rename index labels using a function.
Matches df.rename(index=func). Applies the function to each
index label.
Sourcepub fn rename_axis<N: Into<LabelName>>(
&self,
name: N,
) -> Result<Self, FrameError>
pub fn rename_axis<N: Into<LabelName>>( &self, name: N, ) -> Result<Self, FrameError>
Rename the row index axis.
Matches pd.DataFrame.rename_axis(name) for flat row indexes.
Sourcepub fn add_prefix(&self, prefix: &str) -> Result<Self, FrameError>
pub fn add_prefix(&self, prefix: &str) -> Result<Self, FrameError>
Add a prefix to all column names.
Matches df.add_prefix(prefix).
Sourcepub fn add_suffix(&self, suffix: &str) -> Result<Self, FrameError>
pub fn add_suffix(&self, suffix: &str) -> Result<Self, FrameError>
Add a suffix to all column names.
Matches df.add_suffix(suffix).
Sourcepub fn add_prefix_axis(
&self,
prefix: &str,
axis: usize,
) -> Result<Self, FrameError>
pub fn add_prefix_axis( &self, prefix: &str, axis: usize, ) -> Result<Self, FrameError>
Add a prefix to labels along the chosen axis.
Matches df.add_prefix(prefix, axis=...). axis=0 prefixes the
index (labels are stringified), axis=1 prefixes column names.
Sourcepub fn add_suffix_axis(
&self,
suffix: &str,
axis: usize,
) -> Result<Self, FrameError>
pub fn add_suffix_axis( &self, suffix: &str, axis: usize, ) -> Result<Self, FrameError>
Add a suffix to labels along the chosen axis.
Matches df.add_suffix(suffix, axis=...). axis=0 suffixes the
index (labels are stringified), axis=1 suffixes column names.
Sourcepub fn describe(&self) -> Result<Self, FrameError>
pub fn describe(&self) -> Result<Self, FrameError>
Summary statistics for numeric columns.
Matches df.describe() — returns a DataFrame with index
[count, mean, std, min, 25%, 50%, 75%, max] and one column per
numeric input column.
Sourcepub fn describe_with_percentiles(
&self,
percentiles: &[f64],
) -> Result<Self, FrameError>
pub fn describe_with_percentiles( &self, percentiles: &[f64], ) -> Result<Self, FrameError>
Describe with custom percentiles.
Matches pd.DataFrame.describe(percentiles=[...]).
Sourcepub fn describe_dtypes(
&self,
include: &[&str],
exclude: &[&str],
) -> Result<Self, FrameError>
pub fn describe_dtypes( &self, include: &[&str], exclude: &[&str], ) -> Result<Self, FrameError>
Describe with include/exclude dtype filters.
Matches df.describe(include=[...], exclude=[...]). Pass empty
slices to use defaults (numeric only). Supported dtype strings:
“int64”, “float64”, “bool”, “object”/“string”.
Sourcepub fn quantile(&self, q: f64) -> Result<Series, FrameError>
pub fn quantile(&self, q: f64) -> Result<Series, FrameError>
Compute quantile(s) for each numeric column.
Matches df.quantile(q) for a single quantile value.
Returns a Series indexed by column names.
Sourcepub fn apply<A>(&self, func: A, axis: usize) -> Result<A::Output, FrameError>where
A: DataFrameApplyArg,
pub fn apply<A>(&self, func: A, axis: usize) -> Result<A::Output, FrameError>where
A: DataFrameApplyArg,
Apply either a built-in reducer name or a user closure along an axis.
df.apply("sum", 0)returns aSeries.df.apply(|vals| ..., 1)returns a single-columnDataFrame.
Sourcepub fn transpose_view(
&self,
) -> Result<Option<DataFrameTransposeView<'_>>, FrameError>
pub fn transpose_view( &self, ) -> Result<Option<DataFrameTransposeView<'_>>, FrameError>
Transpose the DataFrame: rows become columns, columns become rows.
Matches df.T / df.transpose(). Column names become the index
of the result, and the original index labels become column names
(converted to strings).
pub fn transpose(&self) -> Result<Self, FrameError>
Sourcepub fn t(&self) -> Result<Self, FrameError>
pub fn t(&self) -> Result<Self, FrameError>
Alias for transpose().
Matches df.T in pandas.
Sourcepub fn T(&self) -> Result<Self, FrameError>
pub fn T(&self) -> Result<Self, FrameError>
Uppercase pandas spelling for Self::transpose.
Rust style prefers Self::t, but pandas exposes df.T.
Sourcepub fn values(&self) -> Vec<Vec<Scalar>>
pub fn values(&self) -> Vec<Vec<Scalar>>
Return row-major scalar values.
Matches pd.DataFrame.values at the API-shape level. Unlike
Self::to_numpy, this preserves non-numeric scalar values.
Sourcepub fn product(&self) -> Result<Series, FrameError>
pub fn product(&self) -> Result<Series, FrameError>
Per-column product alias.
Matches pd.DataFrame.product() as an alias of prod().
Sourcepub fn product_with_numeric_only(
&self,
numeric_only: bool,
) -> Result<Series, FrameError>
pub fn product_with_numeric_only( &self, numeric_only: bool, ) -> Result<Series, FrameError>
df.product(numeric_only=...), the alias’s sibling of
Self::prod_with_numeric_only. An alias must offer the same options
as the method it aliases, or callers get a silently narrower API on one
spelling. (br-frankenpandas-reductions-numeric-only-default-zx21n)
Sourcepub fn get(&self, key: &str) -> Result<Option<Series>, FrameError>
pub fn get(&self, key: &str) -> Result<Option<Series>, FrameError>
Dict-like column lookup.
Matches pd.DataFrame.get(key) by returning None instead of an
error for a missing column.
Sourcepub fn get_or(&self, key: &str, default: Series) -> Result<Series, FrameError>
pub fn get_or(&self, key: &str, default: Series) -> Result<Series, FrameError>
Dict-like column lookup with a fallback Series.
Matches pd.DataFrame.get(key, default) for Series defaults.
Sourcepub fn bool_(&self) -> Result<bool, FrameError>
pub fn bool_(&self) -> Result<bool, FrameError>
Extract the single boolean value from a 1x1 DataFrame.
Matches pd.DataFrame.bool(). Raises unless the DataFrame has exactly
one row, one column, and that cell is a boolean scalar.
Sourcepub fn attrs(&self) -> BTreeMap<String, Scalar>
pub fn attrs(&self) -> BTreeMap<String, Scalar>
User metadata mapping.
Matches pd.DataFrame.attrs shape. FrankenPandas does not yet persist
mutable attrs on the DataFrame storage object, so the current accessor
returns the default empty metadata map.
Sourcepub fn flags(&self) -> DataFrameFlags
pub fn flags(&self) -> DataFrameFlags
DataFrame flags metadata.
Matches pd.DataFrame.flags for the duplicate-label flag currently
represented by FrankenPandas.
Sourcepub fn set_flags(
&self,
allows_duplicate_labels: Option<bool>,
) -> Result<Self, FrameError>
pub fn set_flags( &self, allows_duplicate_labels: Option<bool>, ) -> Result<Self, FrameError>
Return a DataFrame with updated flags.
Matches pd.DataFrame.set_flags(allows_duplicate_labels=...) for the
duplicate-label flag.
Sourcepub fn style(&self) -> StyledDataFrame<'_>
pub fn style(&self) -> StyledDataFrame<'_>
Styling accessor for DataFrame HTML and text rendering helpers.
Matches pd.DataFrame.style as a typed accessor over the current
DataFrame. The current implementation supports practical table
rendering methods such as StyledDataFrame::to_html,
StyledDataFrame::to_string_table, and classed HTML output.
Sourcepub fn sparse(&self) -> SparseDataFrameView<'_>
pub fn sparse(&self) -> SparseDataFrameView<'_>
Sparse accessor for DataFrame density and dense materialization helpers.
Matches pd.DataFrame.sparse as a typed accessor over the current
DataFrame. The current dense-backed implementation exposes non-fill
counts, density metrics, caller-provided fill-value variants, and
SparseDataFrameView::to_dense.
Sourcepub fn swapaxes(&self) -> Result<Self, FrameError>
pub fn swapaxes(&self) -> Result<Self, FrameError>
Swap axes (rows and columns).
Matches df.swapaxes('index', 'columns'). Alias for transpose().
Sourcepub fn lookup(
&self,
row_labels: &[IndexLabel],
col_labels: &[&str],
) -> Result<Vec<Scalar>, FrameError>
pub fn lookup( &self, row_labels: &[IndexLabel], col_labels: &[&str], ) -> Result<Vec<Scalar>, FrameError>
Label-based element lookup.
Matches df.lookup(row_labels, col_labels). Returns a Vec of Scalars
where element i is the value at (row_labels[i], col_labels[i]).
Sourcepub fn with_column_keys(&self, keys: Vec<String>) -> Result<Self, FrameError>
pub fn with_column_keys(&self, keys: Vec<String>) -> Result<Self, FrameError>
This frame with its columns keyed keys, position for position, over
the same rows and row MultiIndex (the typed column labels, column
MultiIndex and axis name dropped): stand-in keys for an operation
that finds columns by name, so repeated keys stay apart (i17d4).
§Errors
LengthMismatch when keys does not name every column.
Sourcepub fn where_cond(
&self,
cond: &Self,
other: Option<&Scalar>,
) -> Result<Self, FrameError>
pub fn where_cond( &self, cond: &Self, other: Option<&Scalar>, ) -> Result<Self, FrameError>
Matches df.where(cond, other). Applies element-wise to each column.
If other is None, replaced values become NaN.
Sourcepub fn where(
&self,
cond: &Self,
other: Option<&Scalar>,
) -> Result<Self, FrameError>
pub fn where( &self, cond: &Self, other: Option<&Scalar>, ) -> Result<Self, FrameError>
pandas-named alias for Self::where_cond. Matches df.where(cond, other).
Per br-frankenpandas-nk54a. where would conflict with the Rust
keyword in where clauses if used as an identifier in some
contexts, but it’s not a reserved identifier — the inherent
method works directly. Provided as a pandas-faithful alias.
Sourcepub fn mask(
&self,
cond: &Self,
other: Option<&Scalar>,
) -> Result<Self, FrameError>
pub fn mask( &self, cond: &Self, other: Option<&Scalar>, ) -> Result<Self, FrameError>
Replace values where cond is True with other.
Matches df.mask(cond, other). Inverse of where_cond.
Sourcepub fn where_cond_df(
&self,
cond: &Self,
other: &Self,
) -> Result<Self, FrameError>
pub fn where_cond_df( &self, cond: &Self, other: &Self, ) -> Result<Self, FrameError>
Keep values where cond is True, replacing False positions with
corresponding values from other DataFrame.
Matches df.where(cond, other=df).
Sourcepub fn mask_df_other(
&self,
cond: &Self,
other: &Self,
) -> Result<Self, FrameError>
pub fn mask_df_other( &self, cond: &Self, other: &Self, ) -> Result<Self, FrameError>
Replace values where cond is True with corresponding values from
other DataFrame.
Matches df.mask(cond, other=df).
Sourcepub fn where_mask_df_other(
&self,
cond: &Self,
other: &Self,
) -> Result<Self, FrameError>
pub fn where_mask_df_other( &self, cond: &Self, other: &Self, ) -> Result<Self, FrameError>
Symmetry alias for where_cond_df (br-frankenpandas-df9v7 /
fd90.138, refactored in br-frankenpandas-a2sck / fd90.139).
mask_df_other already existed but no parallel-named where_* was
reachable from a mask_df_other callsite without remembering the
where_cond_df name. This alias makes the symmetry explicit; both
names dispatch through the same implementation. Prefer where_cond_df
in new code.
Sourcepub fn iterrows(&self) -> Vec<(IndexLabel, Vec<(&str, Scalar)>)>
pub fn iterrows(&self) -> Vec<(IndexLabel, Vec<(&str, Scalar)>)>
Iterate over rows as (IndexLabel, Vec<(&str, Scalar)>) pairs.
Matches df.iterrows(). Returns an iterator over (index_label, row_data)
where row_data is a vector of (column_name, value) pairs.
Sourcepub fn itertuples(&self) -> Vec<(IndexLabel, Vec<Scalar>)>
pub fn itertuples(&self) -> Vec<(IndexLabel, Vec<Scalar>)>
Iterate over rows as tuples of (IndexLabel, Vec<Scalar>).
Matches df.itertuples(). Returns (index_label, values_in_column_order).
Sourcepub fn to_records(&self) -> Vec<Vec<Scalar>>
pub fn to_records(&self) -> Vec<Vec<Scalar>>
Convert DataFrame to a list of record tuples.
Matches df.to_records(). Each record is a Vec of Scalar where the
first element is the index label (converted to Scalar) followed by
each column value in column order.
Sourcepub fn to_numpy_2d(&self) -> Vec<Vec<f64>>
pub fn to_numpy_2d(&self) -> Vec<Vec<f64>>
Convert numeric columns to a 2D Vec<Vec<f64>>.
Matches df.to_numpy(). Rows are outer, columns are inner.
Non-numeric values become f64::NAN.
Sourcepub fn items(&self) -> Result<Vec<(String, Series)>, FrameError>
pub fn items(&self) -> Result<Vec<(String, Series)>, FrameError>
Iterate over columns as (column_name, Series) pairs.
Matches df.items() / df.iteritems().
§Panics
Panics if self.column_order references a column that is absent from
self.columns, which indicates internal DataFrame metadata corruption.
Sourcepub fn iteritems(&self) -> Result<Vec<(String, Series)>, FrameError>
👎Deprecated: use items() instead
pub fn iteritems(&self) -> Result<Vec<(String, Series)>, FrameError>
use items() instead
Alias for items (deprecated in pandas but kept for compatibility).
Sourcepub fn assign(
&self,
assignments: Vec<(&str, Column)>,
) -> Result<Self, FrameError>
pub fn assign( &self, assignments: Vec<(&str, Column)>, ) -> Result<Self, FrameError>
Assign new or overwrite existing columns.
Matches df.assign(**kwargs). Takes a list of (column_name, Column) pairs.
Existing columns are replaced; new columns are appended.
Sourcepub fn assign_fn(
&self,
assignments: Vec<(&str, Box<dyn Fn(&DataFrame) -> Result<Column, FrameError>>)>,
) -> Result<Self, FrameError>
pub fn assign_fn( &self, assignments: Vec<(&str, Box<dyn Fn(&DataFrame) -> Result<Column, FrameError>>)>, ) -> Result<Self, FrameError>
Assign new columns computed from the DataFrame via closures.
Matches df.assign(col=lambda df: ...). Each closure receives a
reference to the current DataFrame (including previously-assigned
columns in this call) and must return a Column of the correct length.
Sourcepub fn pipe<F>(&self, func: F) -> Result<Self, FrameError>
pub fn pipe<F>(&self, func: F) -> Result<Self, FrameError>
Apply a transformation function to the DataFrame.
Matches df.pipe(func). The function receives a reference to self
and returns a new DataFrame.
Sourcepub fn rank(
&self,
method: &str,
ascending: bool,
na_option: &str,
) -> Result<Self, FrameError>
pub fn rank( &self, method: &str, ascending: bool, na_option: &str, ) -> Result<Self, FrameError>
Rank values in each column of the DataFrame.
Applies Series::rank independently to each column.
Sourcepub fn rank_with_pct(
&self,
method: &str,
ascending: bool,
na_option: &str,
pct: bool,
) -> Result<Self, FrameError>
pub fn rank_with_pct( &self, method: &str, ascending: bool, na_option: &str, pct: bool, ) -> Result<Self, FrameError>
Rank values in each column of the DataFrame and optionally scale them to percentile ranks.
Sourcepub fn rank_axis1(
&self,
method: &str,
ascending: bool,
na_option: &str,
) -> Result<Self, FrameError>
pub fn rank_axis1( &self, method: &str, ascending: bool, na_option: &str, ) -> Result<Self, FrameError>
Ranks values across columns for each row independently.
Matches pd.DataFrame.rank(axis=1).
Sourcepub fn rank_axis1_with_pct(
&self,
method: &str,
ascending: bool,
na_option: &str,
pct: bool,
) -> Result<Self, FrameError>
pub fn rank_axis1_with_pct( &self, method: &str, ascending: bool, na_option: &str, pct: bool, ) -> Result<Self, FrameError>
Rank values across columns for each row and optionally scale them to percentile ranks.
Sourcepub fn melt(
&self,
id_vars: &[&str],
value_vars: &[&str],
var_name: Option<&str>,
value_name: Option<&str>,
) -> Result<Self, FrameError>
pub fn melt( &self, id_vars: &[&str], value_vars: &[&str], var_name: Option<&str>, value_name: Option<&str>, ) -> Result<Self, FrameError>
Unpivot (melt) a DataFrame from wide to long format.
id_vars: columns to keep as identifiers
value_vars: columns to unpivot (if empty, uses all non-id columns)
var_name: name for the variable column (default “variable”)
value_name: name for the value column (default “value”)
Sourcepub fn pivot_table(
&self,
values: &str,
index_col: &str,
columns_col: &str,
aggfunc: &str,
) -> Result<Self, FrameError>
pub fn pivot_table( &self, values: &str, index_col: &str, columns_col: &str, aggfunc: &str, ) -> Result<Self, FrameError>
Pivot table: aggregate values grouped by index and column keys.
values: column containing values to aggregate
index_col: column to use as the new row index
columns_col: column whose unique values become new columns
aggfunc: aggregation function (“mean”, “sum”, “count”, “size”, “min”, “max”, “first”, “last”)
Sourcepub fn pivot_table_with_dropna(
&self,
values: &str,
index_col: &str,
columns_col: &str,
aggfunc: &str,
dropna: bool,
) -> Result<Self, FrameError>
pub fn pivot_table_with_dropna( &self, values: &str, index_col: &str, columns_col: &str, aggfunc: &str, dropna: bool, ) -> Result<Self, FrameError>
Pivot table with explicit control over whether missing index/column keys are dropped before aggregation.
Matches df.pivot_table(..., dropna=...) for the core single-value
case. The default pivot_table() wrapper uses dropna=true.
Sourcepub fn pivot_table_fill(
&self,
values: &str,
index_col: &str,
columns_col: &str,
aggfunc: &str,
fill_value: f64,
) -> Result<Self, FrameError>
pub fn pivot_table_fill( &self, values: &str, index_col: &str, columns_col: &str, aggfunc: &str, fill_value: f64, ) -> Result<Self, FrameError>
Create a pivot table with a fill_value for missing cells.
Matches df.pivot_table(values, index, columns, aggfunc, fill_value=v).
Sourcepub fn pivot_table_multi_values(
&self,
values: &[&str],
index_col: &str,
columns_col: &str,
aggfunc: &str,
) -> Result<Self, FrameError>
pub fn pivot_table_multi_values( &self, values: &[&str], index_col: &str, columns_col: &str, aggfunc: &str, ) -> Result<Self, FrameError>
Create a pivot table with multiple value columns.
Matches df.pivot_table(values=['col1','col2'], index=..., columns=..., aggfunc=...).
Column names in the result are formatted as “value_column_pivot_value”
(e.g. “sales_East”, “profit_East”).
⚠️ THE VALUE GROUPS COME OUT IN NAME ORDER, NOT ARGUMENT ORDER, and that
is pandas’ rule rather than a convenience. br-frankenpandas-eay9h.
MEASURED, live pandas 2.2.3, one frame, both spellings of values:
| call | result |
|---|---|
values=["sales","profit"] sort=True | profit_A profit_B sales_A sales_B |
values=["profit","sales"] sort=True | profit_A profit_B sales_A sales_B |
values=["sales","profit"] sort=False | sales_A sales_B profit_A profit_B |
values=["profit","sales"] sort=False | sales_A sales_B profit_A profit_B |
pandas DOES NOT MOVE when the caller reorders values: sort=True (its
DEFAULT) is alphabetical by value name and sort=False preserves the
FRAME’s column order. This method exposes no sort knob, so it implements
the default. Iterating values in argument order – what this did until
eay9h – agrees with pandas only when the caller happens to pass the value
names already sorted.
Sourcepub fn pivot_table_aggfunc_dict(
&self,
value_aggs: &[(&str, &str)],
index_col: &str,
columns_col: &str,
) -> Result<Self, FrameError>
pub fn pivot_table_aggfunc_dict( &self, value_aggs: &[(&str, &str)], index_col: &str, columns_col: &str, ) -> Result<Self, FrameError>
Create a pivot table where each value column uses its own aggregation.
Matches df.pivot_table(values=[...], index=..., columns=..., aggfunc={'col1':'sum','col2':'mean'}).
Each (value_col, aggfunc) entry is pivoted independently and the
result columns are prefixed with the value column name
({value_col}_{pivot_column}), matching the layout of
pivot_table_multi_values – including its NAME ordering. Duplicate value
column names are rejected (a dict has unique keys). Missing columns and
unsupported aggfuncs propagate from the single-value pivot_table call.
⚠️ Same rule, measured separately on live pandas 2.2.3 because the dict
form does NOT follow the list form when sort=False (there it keeps the
dict’s own key order, where the list form takes the frame’s column order).
Under pandas’ sort=True DEFAULT, which is what this implements, both are
alphabetical and neither moves when the caller reorders the argument:
| call | result |
|---|---|
aggfunc={"zeta":"sum","alpha":"mean"} | alpha_A alpha_B zeta_A zeta_B |
aggfunc={"alpha":"mean","zeta":"sum"} | alpha_A alpha_B zeta_A zeta_B |
br-frankenpandas-eay9h.
Sourcepub fn pivot_table_with_margins(
&self,
values: &str,
index_col: &str,
columns_col: &str,
aggfunc: &str,
margins: bool,
) -> Result<Self, FrameError>
pub fn pivot_table_with_margins( &self, values: &str, index_col: &str, columns_col: &str, aggfunc: &str, margins: bool, ) -> Result<Self, FrameError>
Create a pivot table with optional margin totals.
Matches df.pivot_table(values, index, columns, aggfunc, margins=True).
When margins is true, appends an “All” row and “All” column with
totals computed using the same aggregation function.
Sourcepub fn pivot_table_with_margins_name(
&self,
values: &str,
index_col: &str,
columns_col: &str,
aggfunc: &str,
margins: bool,
margins_name: &str,
) -> Result<Self, FrameError>
pub fn pivot_table_with_margins_name( &self, values: &str, index_col: &str, columns_col: &str, aggfunc: &str, margins: bool, margins_name: &str, ) -> Result<Self, FrameError>
Pivot table with margins and a customizable margin label.
Like pivot_table_with_margins but allows specifying the label used
for the margin row/column (default is “All” in pandas).
Sourcepub fn agg(
&self,
funcs: &HashMap<String, Vec<String>>,
) -> Result<Self, FrameError>
pub fn agg( &self, funcs: &HashMap<String, Vec<String>>, ) -> Result<Self, FrameError>
Aggregate using one or more operations over the specified axis.
funcs: mapping of column_name → list of aggregation function names.
Returns a DataFrame with index = function names and columns = original column names.
Sourcepub fn aggregate(
&self,
funcs: &HashMap<String, Vec<String>>,
) -> Result<Self, FrameError>
pub fn aggregate( &self, funcs: &HashMap<String, Vec<String>>, ) -> Result<Self, FrameError>
pandas alias for Self::agg.
Matches pd.DataFrame.aggregate(...) for dict-style column
aggregation specifications.
Sourcepub fn applymap<F>(&self, func: F) -> Result<Self, FrameError>
pub fn applymap<F>(&self, func: F) -> Result<Self, FrameError>
Apply a function element-wise to every value in the DataFrame.
Returns a new DataFrame with the same shape and index.
Sourcepub fn map<F>(&self, func: F) -> Result<Self, FrameError>
pub fn map<F>(&self, func: F) -> Result<Self, FrameError>
pandas-2.1+ alias for Self::applymap. Matches df.map(func).
Per br-frankenpandas-nk54a. pandas 2.1 deprecated applymap in
favor of map; this alias supports the new spelling so users
migrating from pandas 2.x don’t need to rename.
Sourcepub fn applymap_na_action<F>(&self, func: F) -> Result<Self, FrameError>
pub fn applymap_na_action<F>(&self, func: F) -> Result<Self, FrameError>
Apply a function element-wise, skipping missing values.
Matches df.applymap(func, na_action='ignore'). Missing values
(Null/NaN) are passed through unchanged; func is only called on
non-missing values.
Sourcepub fn map_elements<F>(&self, func: F) -> Result<Self, FrameError>
pub fn map_elements<F>(&self, func: F) -> Result<Self, FrameError>
Apply a function element-wise (pandas 2.0 name for applymap).
Matches pd.DataFrame.map(func).
Sourcepub fn transform<F>(&self, func: F) -> Result<Self, FrameError>
pub fn transform<F>(&self, func: F) -> Result<Self, FrameError>
Apply a function element-wise, preserving the shape of the DataFrame.
Similar to applymap but validates that the output has the same shape.
Sourcepub fn pivot_table_multi_agg(
&self,
values: &str,
index_col: &str,
columns_col: &str,
aggfuncs: &[&str],
) -> Result<Self, FrameError>
pub fn pivot_table_multi_agg( &self, values: &str, index_col: &str, columns_col: &str, aggfuncs: &[&str], ) -> Result<Self, FrameError>
Create a pivot table applying multiple aggregation functions.
Matches df.pivot_table(values, index, columns, aggfunc=['sum','mean']).
Returns a DataFrame with columns named "{col}_{func}" for each
combination of pivot column value and aggregation function.
Sourcepub fn corr(&self) -> Result<Self, FrameError>
pub fn corr(&self) -> Result<Self, FrameError>
Compute the Pearson correlation matrix between numeric columns.
Sourcepub fn corr_with_numeric_only(
&self,
numeric_only: bool,
) -> Result<Self, FrameError>
pub fn corr_with_numeric_only( &self, numeric_only: bool, ) -> Result<Self, FrameError>
Compute the Pearson correlation matrix, optionally restricting to numeric dtypes.
Matches df.corr(numeric_only=...). Boolean columns are treated as numeric,
and non-numeric columns are excluded from the result.
Sourcepub fn corr_min_periods(&self, min_periods: usize) -> Result<Self, FrameError>
pub fn corr_min_periods(&self, min_periods: usize) -> Result<Self, FrameError>
Compute pairwise Pearson correlation with a minimum-observations threshold.
Matches df.corr(min_periods=n). Pairs with fewer than min_periods
valid (non-NaN) observations yield NaN.
Sourcepub fn corr_min_periods_with_numeric_only(
&self,
min_periods: usize,
numeric_only: bool,
) -> Result<Self, FrameError>
pub fn corr_min_periods_with_numeric_only( &self, min_periods: usize, numeric_only: bool, ) -> Result<Self, FrameError>
Compute pairwise Pearson correlation with a minimum-observations threshold.
Matches df.corr(min_periods=n, numeric_only=...).
Sourcepub fn corr_method(&self, method: &str) -> Result<Self, FrameError>
pub fn corr_method(&self, method: &str) -> Result<Self, FrameError>
Compute correlation matrix using the specified method.
Supported methods: “pearson”, “spearman”, “kendall”.
Sourcepub fn corr_method_with_numeric_only(
&self,
method: &str,
numeric_only: bool,
) -> Result<Self, FrameError>
pub fn corr_method_with_numeric_only( &self, method: &str, numeric_only: bool, ) -> Result<Self, FrameError>
Compute correlation matrix using the specified method and numeric_only policy.
Supported methods: “pearson”, “spearman”, “kendall”.
Sourcepub fn cov(&self) -> Result<Self, FrameError>
pub fn cov(&self) -> Result<Self, FrameError>
Compute the pairwise covariance matrix between numeric columns.
Matches df.cov(), whose pandas 2.x default is numeric_only=False:
a string or categorical column is an error, not silently dropped.
Sourcepub fn cov_with_numeric_only(
&self,
numeric_only: bool,
) -> Result<Self, FrameError>
pub fn cov_with_numeric_only( &self, numeric_only: bool, ) -> Result<Self, FrameError>
Compute the pairwise covariance matrix, optionally restricting to
numeric dtypes. Matches df.cov(numeric_only=...).
Sourcepub fn cov_min_periods(&self, min_periods: usize) -> Result<Self, FrameError>
pub fn cov_min_periods(&self, min_periods: usize) -> Result<Self, FrameError>
Compute pairwise covariance with a minimum-observations threshold.
Matches df.cov(min_periods=n). Pairs with fewer than min_periods
valid (non-NaN) observations yield NaN.
Sourcepub fn cov_min_periods_with_numeric_only(
&self,
min_periods: usize,
numeric_only: bool,
) -> Result<Self, FrameError>
pub fn cov_min_periods_with_numeric_only( &self, min_periods: usize, numeric_only: bool, ) -> Result<Self, FrameError>
Matches df.cov(min_periods=n, numeric_only=...).
Sourcepub fn corrwith(&self, other: &Self) -> Result<Series, FrameError>
pub fn corrwith(&self, other: &Self) -> Result<Series, FrameError>
Column-wise correlation with another DataFrame.
Matches df.corrwith(other). Returns a Series of Pearson correlations
for each shared numeric column.
Sourcepub fn corrwith_axis(
&self,
other: &Self,
axis: usize,
) -> Result<Series, FrameError>
pub fn corrwith_axis( &self, other: &Self, axis: usize, ) -> Result<Series, FrameError>
Compute pairwise correlation with another DataFrame along the given axis.
Matches df.corrwith(other, axis=...).
axis=0(default): correlate matching columnsaxis=1: correlate matching rows
Sourcepub fn dot(&self, other: &Self) -> Result<Self, FrameError>
pub fn dot(&self, other: &Self) -> Result<Self, FrameError>
Matrix dot product with another DataFrame.
Matches df.dot(other). Computes matrix multiplication where
self’s columns are matched to other’s index.
Sourcepub fn value_counts_per_column(&self) -> Result<Self, FrameError>
pub fn value_counts_per_column(&self) -> Result<Self, FrameError>
Compute the number of unique values per column.
Sourcepub fn iat(&self, row_pos: i64, col_pos: i64) -> Result<Scalar, FrameError>
pub fn iat(&self, row_pos: i64, col_pos: i64) -> Result<Scalar, FrameError>
Single-cell access by integer (row_pos, col_pos).
Matches pd.DataFrame.iat[i, j]. Negative positions count
from the end (pandas convention). Returns
CompatibilityRejected for out-of-range row or column
positions.
Sourcepub fn with_index(&self, index: Index) -> Result<Self, FrameError>
pub fn with_index(&self, index: Index) -> Result<Self, FrameError>
This frame with index as its row axis, labels and name both, as
pandas’ df.index = new_index replaces it (set_axis keeps the old
axis name).
Sourcepub fn set_axis(
&self,
labels: Vec<IndexLabel>,
axis: usize,
) -> Result<Self, FrameError>
pub fn set_axis( &self, labels: Vec<IndexLabel>, axis: usize, ) -> Result<Self, FrameError>
Replace the row index or column names without touching data.
Matches pd.DataFrame.set_axis(labels, axis=0|1):
axis=0: replace the row index withlabels.axis=1: replace column names with stringifiedlabels.
Returns LengthMismatch when labels.len() doesn’t match the
chosen axis; returns CompatibilityRejected for unknown axis.
Sourcepub fn at(&self, label: &IndexLabel, column: &str) -> Result<Scalar, FrameError>
pub fn at(&self, label: &IndexLabel, column: &str) -> Result<Scalar, FrameError>
Single-cell access by (row label, column name).
Matches pd.DataFrame.at[label, col]. Returns None when the
row label is not present in the index or the column name is
unknown. Use .iloc / iat-style positional access on the
underlying Index+Column for integer positions.
Sourcepub fn value_counts_map(&self) -> Result<BTreeMap<String, Series>, FrameError>
pub fn value_counts_map(&self) -> Result<BTreeMap<String, Series>, FrameError>
Per-column value counts as a map of Series.
Returns {column_name → Series} where each Series is the
value_counts() result for that column. This is distinct from
both value_counts() (counts unique full-row tuples) and
value_counts_per_column() (returns a nunique summary
DataFrame). Callers who want the pandas idiom
{col: df[col].value_counts() for col in df.columns} get it
in one pass here.
Sourcepub fn value_counts(&self) -> Result<Series, FrameError>
pub fn value_counts(&self) -> Result<Series, FrameError>
Count unique rows in the DataFrame.
Matches pd.DataFrame.value_counts(). Returns a Series indexed by
composite row values, with counts as values, sorted descending.
Sourcepub fn value_counts_subset(&self, subset: &[&str]) -> Result<Series, FrameError>
pub fn value_counts_subset(&self, subset: &[&str]) -> Result<Series, FrameError>
Count unique value combinations for a subset of columns.
Matches df.value_counts(subset=['col1','col2']). Counts
combinations of values in the specified columns only.
Sourcepub fn infer_objects(&self) -> Result<Self, FrameError>
pub fn infer_objects(&self) -> Result<Self, FrameError>
Infer better dtypes for object columns.
Matches pd.DataFrame.infer_objects() column by column (see
inferred_object_column): numpy dtypes stay, text stays text
(pandas: DataFrame({‘n’: [‘10’]}).infer_objects() is object).
Sourcepub fn nlargest(&self, n: usize, column: &str) -> Result<Self, FrameError>
pub fn nlargest(&self, n: usize, column: &str) -> Result<Self, FrameError>
Get the top N rows ordered by a column.
Sourcepub fn nsmallest(&self, n: usize, column: &str) -> Result<Self, FrameError>
pub fn nsmallest(&self, n: usize, column: &str) -> Result<Self, FrameError>
Get the bottom N rows ordered by a column.
Sourcepub fn nlargest_multi(
&self,
n: usize,
columns: &[&str],
) -> Result<Self, FrameError>
pub fn nlargest_multi( &self, n: usize, columns: &[&str], ) -> Result<Self, FrameError>
Get the top N rows ordered by multiple columns.
Matches df.nlargest(n, columns=[...]).
Sourcepub fn nsmallest_multi(
&self,
n: usize,
columns: &[&str],
) -> Result<Self, FrameError>
pub fn nsmallest_multi( &self, n: usize, columns: &[&str], ) -> Result<Self, FrameError>
Get the bottom N rows ordered by multiple columns.
Matches df.nsmallest(n, columns=[...]).
pub fn nlargest_keep( &self, n: usize, column: &str, keep: &str, ) -> Result<Self, FrameError>
Sourcepub fn nsmallest_keep(
&self,
n: usize,
column: &str,
keep: &str,
) -> Result<Self, FrameError>
pub fn nsmallest_keep( &self, n: usize, column: &str, keep: &str, ) -> Result<Self, FrameError>
Get the bottom N rows with keep parameter.
Matches pd.DataFrame.nsmallest(n, columns, keep).
Sourcepub fn take(&self, indices: &[i64], axis: usize) -> Result<Self, FrameError>
pub fn take(&self, indices: &[i64], axis: usize) -> Result<Self, FrameError>
Return the elements in the given positional indices along an axis.
Matches df.take(indices, axis=0|1), including negative indices from the end.
Sourcepub fn take_rows(&self, indices: &[usize]) -> Result<Self, FrameError>
pub fn take_rows(&self, indices: &[usize]) -> Result<Self, FrameError>
Helper for selecting rows by normalized non-negative positional indices.
Used by df.take(indices, axis=0) after negative indices have been resolved.
Sourcepub fn fillna_method(&self, method: &str) -> Result<Self, FrameError>
pub fn fillna_method(&self, method: &str) -> Result<Self, FrameError>
Fill missing values using a method (‘ffill’ or ‘bfill’).
Matches pd.DataFrame.fillna(method='ffill') / method='bfill'.
Sourcepub fn reindex(&self, new_labels: Vec<IndexLabel>) -> Result<Self, FrameError>
pub fn reindex(&self, new_labels: Vec<IndexLabel>) -> Result<Self, FrameError>
Reindex the DataFrame to a new set of index labels.
Missing rows are filled with NaN.
Sourcepub fn reindex_to_index(&self, target: &Index) -> Result<Self, FrameError>
pub fn reindex_to_index(&self, target: &Index) -> Result<Self, FrameError>
Self::reindex to the labels of target, kept as they are (a
range, an int64 buffer; br-frankenpandas-mcq15): the rows’ index is
target under this frame’s index name.
Sourcepub fn reindex_like(&self, other: &Self) -> Result<Self, FrameError>
pub fn reindex_like(&self, other: &Self) -> Result<Self, FrameError>
Reindex this DataFrame to match another DataFrame’s row index.
Matches pd.DataFrame.reindex_like(other) for row-index alignment.
Sourcepub fn reindex_axis(
&self,
labels: Vec<IndexLabel>,
axis: usize,
) -> Result<Self, FrameError>
pub fn reindex_axis( &self, labels: Vec<IndexLabel>, axis: usize, ) -> Result<Self, FrameError>
Conform DataFrame to new index or columns.
Matches pd.DataFrame.reindex(labels, axis=...).
Sourcepub fn reindex_fill(
&self,
new_labels: Vec<IndexLabel>,
fill_value: Scalar,
) -> Result<Self, FrameError>
pub fn reindex_fill( &self, new_labels: Vec<IndexLabel>, fill_value: Scalar, ) -> Result<Self, FrameError>
Reindex with a static fill_value for missing labels.
Matches df.reindex(new_labels, fill_value=X). Labels not found
in the current index are filled with fill_value instead of NaN.
Sourcepub fn reindex_with_method(
&self,
new_labels: Vec<IndexLabel>,
method: &str,
) -> Result<Self, FrameError>
pub fn reindex_with_method( &self, new_labels: Vec<IndexLabel>, method: &str, ) -> Result<Self, FrameError>
Reindex to new labels with a fill method for introduced NaN.
Matches df.reindex(new_labels, method='ffill'|'bfill').
Single-pass, label-presence driven: only labels ABSENT from the source
index are filled from the nearest source label in the fill direction;
labels PRESENT in the source keep their own values, INCLUDING source
NaNs. A two-pass reindex(...).ffill() would instead fill every NaN
slot, overwriting original source NaNs that pandas leaves untouched.
Sourcepub fn reindex_with_method_options(
&self,
new_labels: Vec<IndexLabel>,
method: &str,
limit: Option<usize>,
tolerance: Option<&[f64]>,
) -> Result<Self, FrameError>
pub fn reindex_with_method_options( &self, new_labels: Vec<IndexLabel>, method: &str, limit: Option<usize>, tolerance: Option<&[f64]>, ) -> Result<Self, FrameError>
Self::reindex_with_method with pandas’ limit and tolerance
(one per new label; see method_reindex_positions).
Sourcepub fn reindex_columns(&self, new_columns: &[&str]) -> Result<Self, FrameError>
pub fn reindex_columns(&self, new_columns: &[&str]) -> Result<Self, FrameError>
Reindex columns: reorder, filter, or add columns.
Matches df.reindex(columns=[...]). Columns present in the new list
but missing from the DataFrame are filled with NaN. Columns not in the
new list are dropped. Order follows the provided list.
Sourcepub fn update(&self, other: &Self) -> Result<Self, FrameError>
pub fn update(&self, other: &Self) -> Result<Self, FrameError>
Update values using non-null values from another DataFrame.
Analogous to pandas.DataFrame.update(other). Only updates values
at matching index labels and column names where other has non-null
values. Retains self’s index and columns (no new labels/columns
added from other).
Sourcepub fn combine_first(&self, other: &Self) -> Result<Self, FrameError>
pub fn combine_first(&self, other: &Self) -> Result<Self, FrameError>
Combine two DataFrames, preferring non-null values from self.
Analogous to pandas.DataFrame.combine_first(other). Uses union
of indices and columns. For overlapping positions, uses self’s value
if non-null, else other’s value.
Sourcepub fn combine_elementwise<F>(
&self,
other: &Self,
func: F,
) -> Result<Self, FrameError>
pub fn combine_elementwise<F>( &self, other: &Self, func: F, ) -> Result<Self, FrameError>
Combine two DataFrames element-wise using a binary function.
Matches df.combine(other, func). Aligns on both index and columns
(union), filling missing positions with NaN before applying func.
Sourcepub fn combine<F>(
&self,
other: &Self,
func: F,
fill_value: Option<&Scalar>,
overwrite: bool,
) -> Result<Self, FrameError>
pub fn combine<F>( &self, other: &Self, func: F, fill_value: Option<&Scalar>, overwrite: bool, ) -> Result<Self, FrameError>
Combine the DataFrame with another DataFrame using a column-wise function.
Matches pd.DataFrame.combine(other, func, fill_value=None, overwrite=True).
Sourcepub fn rolling(
&self,
window: usize,
min_periods: Option<usize>,
) -> DataFrameRolling<'_>
pub fn rolling( &self, window: usize, min_periods: Option<usize>, ) -> DataFrameRolling<'_>
Create a rolling window view over all numeric columns.
Matches df.rolling(window) semantics.
Sourcepub fn rolling_with_center(
&self,
window: usize,
min_periods: Option<usize>,
center: bool,
) -> DataFrameRolling<'_>
pub fn rolling_with_center( &self, window: usize, min_periods: Option<usize>, center: bool, ) -> DataFrameRolling<'_>
Create a rolling window view over all numeric columns, centered on
each row when center is true.
Matches df.rolling(window, min_periods, center).
Sourcepub fn rolling_closed(
&self,
window: usize,
min_periods: Option<usize>,
center: bool,
closed: IntervalClosed,
on: Option<&str>,
) -> Result<DataFrameRolling<'_>, FrameError>
pub fn rolling_closed( &self, window: usize, min_periods: Option<usize>, center: bool, closed: IntervalClosed, on: Option<&str>, ) -> Result<DataFrameRolling<'_>, FrameError>
Self::rolling_with_center closed as pandas’ closed= says
(fixed_window_bounds), and with pandas’ on= a column passed
through as it was rather than aggregated. min_periods defaults to
window and must not exceed it.
Sourcepub fn rolling_offset(
&self,
window: &str,
min_periods: Option<usize>,
closed: IntervalClosed,
on: Option<&str>,
) -> Result<DataFrameRolling<'_>, FrameError>
pub fn rolling_offset( &self, window: &str, min_periods: Option<usize>, closed: IntervalClosed, on: Option<&str>, ) -> Result<DataFrameRolling<'_>, FrameError>
A time-based window (pandas’ df.rolling('7D', on=, closed=)) over
the datetime index or, with on, over that datetime column, which
is passed through as it was (offset_window_bounds); min_periods
defaults to 1, as pandas’.
Sourcepub fn rolling_offset_centered(
&self,
window: &str,
min_periods: Option<usize>,
closed: IntervalClosed,
on: Option<&str>,
center: bool,
) -> Result<DataFrameRolling<'_>, FrameError>
pub fn rolling_offset_centered( &self, window: &str, min_periods: Option<usize>, closed: IntervalClosed, on: Option<&str>, center: bool, ) -> Result<DataFrameRolling<'_>, FrameError>
Self::rolling_offset, each window centred on its row when
center (centered_offset_window_bounds; br-frankenpandas-gv69z).
Sourcepub fn expanding(&self, min_periods: Option<usize>) -> DataFrameExpanding<'_>
pub fn expanding(&self, min_periods: Option<usize>) -> DataFrameExpanding<'_>
Create an expanding window view over all numeric columns.
Matches df.expanding(min_periods) semantics.
Sourcepub fn ewm(&self, span: Option<f64>, alpha: Option<f64>) -> DataFrameEwm<'_>
pub fn ewm(&self, span: Option<f64>, alpha: Option<f64>) -> DataFrameEwm<'_>
Create an exponentially weighted moving window view over all numeric columns.
Matches df.ewm(span=...) semantics (pandas’ default adjust=True,
min_periods=0).
Sourcepub fn ewm_with_options(
&self,
span: Option<f64>,
alpha: Option<f64>,
adjust: bool,
min_periods: usize,
) -> DataFrameEwm<'_>
pub fn ewm_with_options( &self, span: Option<f64>, alpha: Option<f64>, adjust: bool, min_periods: usize, ) -> DataFrameEwm<'_>
ewm with pandas’ adjust and min_periods, applied to
each numeric column as Series::ewm_with_options does.
Sourcepub fn resample(&self, freq: &str) -> DataFrameResample<'_>
pub fn resample(&self, freq: &str) -> DataFrameResample<'_>
Create a time-based resampler view for the DataFrame.
Matches df.resample(freq). The DataFrame must have Utf8 datetime-like
index labels. Applies aggregation to each numeric column per time bucket.
pub fn resample_ext( &self, freq: &str, closed: Option<&str>, label: Option<&str>, origin: Option<&str>, ) -> DataFrameResample<'_>
Sourcepub fn asfreq(&self, freq: &str) -> Result<Self, FrameError>
pub fn asfreq(&self, freq: &str) -> Result<Self, FrameError>
Conform the row index to a datetime frequency.
Matches the row-axis default of pd.DataFrame.asfreq(freq) for flat,
strictly increasing datetime-like indexes. Missing rows introduced by
the new frequency are filled with NaN.
Sourcepub fn asfreq_with_options(
&self,
freq: &str,
method: Option<&str>,
fill_value: Option<Scalar>,
) -> Result<Self, FrameError>
pub fn asfreq_with_options( &self, freq: &str, method: Option<&str>, fill_value: Option<Scalar>, ) -> Result<Self, FrameError>
Conform the row index to a datetime frequency with optional fill.
method accepts pandas spellings "ffill"/"pad" and
"bfill"/"backfill" for labels introduced by the frequency grid.
fill_value, when present, fills any remaining missing values after
reindexing/method fill.
Sourcepub fn between_time(&self, start: &str, end: &str) -> Result<Self, FrameError>
pub fn between_time(&self, start: &str, end: &str) -> Result<Self, FrameError>
Select rows where the time component of the index is between two times.
Matches df.between_time(start_time, end_time).
Index labels should be datetime-like strings with time component (HH:MM or HH:MM:SS).
Sourcepub fn between_time_inclusive(
&self,
start: &str,
end: &str,
inclusive: IntervalClosed,
) -> Result<Self, FrameError>
pub fn between_time_inclusive( &self, start: &str, end: &str, inclusive: IntervalClosed, ) -> Result<Self, FrameError>
Self::between_time with pandas’ inclusive=.
Sourcepub fn at_time(&self, time: &str) -> Result<Self, FrameError>
pub fn at_time(&self, time: &str) -> Result<Self, FrameError>
Select rows where the time component exactly matches the given time.
Matches df.at_time(time).
Sourcepub fn to_latex(&self, include_index: bool) -> String
pub fn to_latex(&self, include_index: bool) -> String
Render the DataFrame as a LaTeX table.
Matches df.to_latex().
Sourcepub fn ndim(&self) -> usize
pub fn ndim(&self) -> usize
Return the number of dimensions.
Matches pd.DataFrame.ndim. Always returns 2.
Sourcepub fn axes(&self) -> (Vec<IndexLabel>, Vec<String>)
pub fn axes(&self) -> (Vec<IndexLabel>, Vec<String>)
Return a list of the row axis labels and column axis labels.
Matches pd.DataFrame.axes.
Sourcepub fn size(&self) -> usize
pub fn size(&self) -> usize
Total number of cells in the DataFrame (rows × columns).
Matches pd.DataFrame.size. Equivalent to
len() * num_columns(), but follows pandas’ property naming so
callers can write size-generic code that works on both Series
and DataFrame.
Sourcepub fn to_html(&self, include_index: bool) -> String
pub fn to_html(&self, include_index: bool) -> String
Render the DataFrame as an HTML table.
Matches pd.DataFrame.to_html().
Sourcepub fn groupby(&self, by: &[&str]) -> Result<DataFrameGroupBy<'_>, FrameError>
pub fn groupby(&self, by: &[&str]) -> Result<DataFrameGroupBy<'_>, FrameError>
Group by one or more columns and aggregate.
Returns a DataFrameGroupBy for deferred aggregation.
Sourcepub fn groupby_with_as_index(
&self,
by: &[&str],
as_index: bool,
) -> Result<DataFrameGroupBy<'_>, FrameError>
pub fn groupby_with_as_index( &self, by: &[&str], as_index: bool, ) -> Result<DataFrameGroupBy<'_>, FrameError>
Group the DataFrame by one or more columns with explicit as_index.
When as_index is true (default), group keys become the index.
When as_index is false, group keys become regular columns and the
index is a default integer range. Matches df.groupby(by, as_index=...).
Sourcepub fn groupby_full(
&self,
by: &[&str],
as_index: bool,
sort: bool,
) -> Result<DataFrameGroupBy<'_>, FrameError>
pub fn groupby_full( &self, by: &[&str], as_index: bool, sort: bool, ) -> Result<DataFrameGroupBy<'_>, FrameError>
Group the DataFrame with full parameter control.
Matches df.groupby(by, as_index=..., sort=...).
When sort is true (default), groups are sorted by key.
When sort is false, groups appear in first-seen order.
Sourcepub fn groupby_full_options(
&self,
by: &[&str],
as_index: bool,
sort: bool,
dropna: bool,
) -> Result<DataFrameGroupBy<'_>, FrameError>
pub fn groupby_full_options( &self, by: &[&str], as_index: bool, sort: bool, dropna: bool, ) -> Result<DataFrameGroupBy<'_>, FrameError>
Group with all options including dropna.
When dropna is true (default), rows with NaN in any group key column
are excluded. When false, NaN keys form their own group.
Matches df.groupby(by, dropna=False).
Sourcepub fn groupby_full_options_with_observed(
&self,
by: &[&str],
as_index: bool,
sort: bool,
dropna: bool,
observed: bool,
) -> Result<DataFrameGroupBy<'_>, FrameError>
pub fn groupby_full_options_with_observed( &self, by: &[&str], as_index: bool, sort: bool, dropna: bool, observed: bool, ) -> Result<DataFrameGroupBy<'_>, FrameError>
Group with explicit observed control for categorical inputs.
The current DataFrame storage model materializes categorical columns to
their labels, so observed=true matches the pandas-observable result
surface for categorical groupers. observed=false still requires
DataFrame-level category metadata and is rejected for now.
Sourcepub fn info(&self) -> String
pub fn info(&self) -> String
Get summary info about the DataFrame: dtypes, non-null counts, memory.
Sourcepub fn to_dict(&self, orient: &str) -> Result<DataFrameDictResult, FrameError>
pub fn to_dict(&self, orient: &str) -> Result<DataFrameDictResult, FrameError>
Convert DataFrame to a nested dictionary.
Matches pd.DataFrame.to_dict(orient=...).
Supported orients:
"dict":{column -> {index -> value}}(default)"list":{column -> [values]}"records":[{column -> value}, ...]"index":{index -> {column -> value}}"series":{column -> Series}"split":{index, columns, data}
Sourcepub fn to_series_dict(&self) -> BTreeMap<String, Series>
pub fn to_series_dict(&self) -> BTreeMap<String, Series>
Convert DataFrame to a dict of Series (one per column).
Matches pd.DataFrame.to_dict(orient='series').
Returns {column_name -> Series} where each Series has the
DataFrame’s index.
§Panics
Panics if any column length no longer matches the DataFrame index length, which indicates internal DataFrame corruption.
Sourcepub fn to_xarray(&self) -> Result<DataFrameXArrayDataset, FrameError>
pub fn to_xarray(&self) -> Result<DataFrameXArrayDataset, FrameError>
Convert a flat-index DataFrame into an xarray-like Dataset snapshot.
Matches the practical pd.DataFrame.to_xarray() shape for scalar
columns: the row index becomes the single coordinate/dimension, and
each DataFrame column becomes one 1-D data variable.
Sourcepub fn to_csv(&self, sep: char, include_index: bool) -> String
pub fn to_csv(&self, sep: char, include_index: bool) -> String
Export DataFrame to CSV string.
Matches df.to_csv() returning a string representation.
Sourcepub fn to_csv_options(
&self,
sep: char,
include_index: bool,
na_rep: &str,
columns: Option<&[&str]>,
) -> Result<String, FrameError>
pub fn to_csv_options( &self, sep: char, include_index: bool, na_rep: &str, columns: Option<&[&str]>, ) -> Result<String, FrameError>
Export DataFrame to CSV string with additional formatting options.
Matches df.to_csv(sep, index, na_rep, columns).
na_rep: string to represent missing values (default empty)columns: optional subset of columns to include
Sourcepub fn to_csv_with_quoting(
&self,
sep: char,
include_index: bool,
na_rep: &str,
columns: Option<&[&str]>,
quoting: CsvQuoting,
) -> Result<String, FrameError>
pub fn to_csv_with_quoting( &self, sep: char, include_index: bool, na_rep: &str, columns: Option<&[&str]>, quoting: CsvQuoting, ) -> Result<String, FrameError>
Export DataFrame to CSV string with quoting control.
Matches df.to_csv(..., quoting=csv.QUOTE_*).
CsvQuoting::Minimal: Quote only when necessary (default pandas behavior)CsvQuoting::All: Quote all fields including headers, index, and valuesCsvQuoting::NonNumeric: Quote all non-numeric fieldsCsvQuoting::None: Never quote fieldsheader: if true (default), write column names as first row
Sourcepub fn to_csv_with_header(
&self,
sep: char,
include_index: bool,
na_rep: &str,
columns: Option<&[&str]>,
quoting: CsvQuoting,
header: bool,
) -> Result<String, FrameError>
pub fn to_csv_with_header( &self, sep: char, include_index: bool, na_rep: &str, columns: Option<&[&str]>, quoting: CsvQuoting, header: bool, ) -> Result<String, FrameError>
Export DataFrame to CSV string with full control over quoting and header.
header: if true, write column names as first row; if false, omit header
Sourcepub fn to_csv_full(
&self,
sep: char,
include_index: bool,
na_rep: &str,
columns: Option<&[&str]>,
quoting: CsvQuoting,
header: bool,
escapechar: Option<char>,
) -> Result<String, FrameError>
pub fn to_csv_full( &self, sep: char, include_index: bool, na_rep: &str, columns: Option<&[&str]>, quoting: CsvQuoting, header: bool, escapechar: Option<char>, ) -> Result<String, FrameError>
Export DataFrame to CSV string with full control over all options.
escapechar: when using CsvQuoting::None, escape special characters with this
Sourcepub fn to_json(&self, orient: &str) -> Result<String, FrameError>
pub fn to_json(&self, orient: &str) -> Result<String, FrameError>
Export DataFrame to JSON string.
Matches pd.DataFrame.to_json(orient=...), floats at pandas’ default
double_precision (10).
Sourcepub fn to_json_with_options(
&self,
orient: &str,
options: JsonOptions,
) -> Result<String, FrameError>
pub fn to_json_with_options( &self, orient: &str, options: JsonOptions, ) -> Result<String, FrameError>
DataFrame::to_json under pandas’ double_precision / index
keywords (JsonOptions; split and table without the index
when it is off).
Sourcepub fn to_numpy(&self) -> Vec<Vec<f64>>
pub fn to_numpy(&self) -> Vec<Vec<f64>>
Return the DataFrame values as a row-major 2D vector of f64.
Matches pd.DataFrame.to_numpy(). Non-numeric values become NaN.
Each inner vector is one row.
Sourcepub fn to_numpy_flat(&self) -> (Vec<f64>, usize, usize)
pub fn to_numpy_flat(&self) -> (Vec<f64>, usize, usize)
Numeric-coerced values as a single row-major contiguous Vec<f64>
plus (rows, cols), i.e. numpy C-order.
Unlike to_numpy — which returns a nested
Vec<Vec<f64>> and pays one heap allocation per row (allocation-bound at
large row counts) — this materializes into ONE buffer, matching numpy’s
contiguous 2-D layout and making the result usable directly by BLAS /
interop. Values are identical to to_numpy (flat[i*cols + j] == to_numpy()[i][j]): all-valid Int64/Float64 columns copy/cast from their
typed slice, everything else takes the exact Scalar to_f64/NaN path.
Sourcepub fn to_string(&self) -> String
pub fn to_string(&self) -> String
Render the DataFrame as a formatted plain-text table.
Matches df.to_string() with pandas’ default index=True behavior.
Sourcepub fn to_string_table(&self, include_index: bool) -> String
pub fn to_string_table(&self, include_index: bool) -> String
Render the DataFrame as a formatted plain-text table with explicit index-column control.
Matches df.to_string(). Columns are right-aligned for numeric data,
left-aligned for strings. Includes index column on the left.
Sourcepub fn to_string_truncated(
&self,
include_index: bool,
max_rows: Option<usize>,
max_cols: Option<usize>,
) -> String
pub fn to_string_truncated( &self, include_index: bool, max_rows: Option<usize>, max_cols: Option<usize>, ) -> String
Render the DataFrame as a string table with truncation.
Matches df.to_string(max_rows=N, max_cols=M). When the number
of rows exceeds max_rows, shows the first and last max_rows/2
rows with “…” in between. Similarly truncates columns.
Sourcepub fn to_markdown(
&self,
include_index: bool,
tablefmt: Option<&str>,
) -> Result<String, FrameError>
pub fn to_markdown( &self, include_index: bool, tablefmt: Option<&str>, ) -> Result<String, FrameError>
Render the DataFrame as a Markdown table.
Matches df.to_markdown().
Sourcepub fn sample(
&self,
n: Option<usize>,
frac: Option<f64>,
replace: bool,
seed: Option<u64>,
) -> Result<Self, FrameError>
pub fn sample( &self, n: Option<usize>, frac: Option<f64>, replace: bool, seed: Option<u64>, ) -> Result<Self, FrameError>
Randomly sample rows from the DataFrame.
n: number of rows to sample (mutually exclusive with frac).
frac: fraction of rows to sample.
replace: whether to sample with replacement.
seed: optional deterministic seed.
Sourcepub fn sample_weights(
&self,
n: usize,
weights: &[f64],
replace: bool,
seed: Option<u64>,
) -> Result<Self, FrameError>
pub fn sample_weights( &self, n: usize, weights: &[f64], replace: bool, seed: Option<u64>, ) -> Result<Self, FrameError>
Weighted sampling of rows.
Matches df.sample(n, weights=...). The weights slice must have the
same length as the DataFrame. Weights are normalized to sum to 1.
Sourcepub fn stack(&self) -> Result<Self, FrameError>
pub fn stack(&self) -> Result<Self, FrameError>
Stack: pivot columns into rows (wide-to-long).
Converts a DataFrame with columns [A, B, …] into a two-column
DataFrame with a multi-level index (original_index, column_name)
and a single value column. Similar to pandas DataFrame.stack().
Sourcepub fn unstack_levels(
&self,
moved: &[usize],
fill_value: Option<&Scalar>,
) -> Result<Self, FrameError>
pub fn unstack_levels( &self, moved: &[usize], fill_value: Option<&Scalar>, ) -> Result<Self, FrameError>
pandas’ DataFrame.unstack(level=moved, fill_value) over a row
MultiIndex: each column unstacked as Series::unstack_levels, side
by side under its label - the column MultiIndex (column levels,
*moved levels), its levels named after the column axis and the moved
levels (br-frankenpandas-xbl2k; the binding unstacked a column at a
time and lost the moved levels’ names).
Sourcepub fn unstack(&self) -> Result<Self, FrameError>
pub fn unstack(&self) -> Result<Self, FrameError>
Unstack: pivot rows into columns (long-to-wide).
Assumes the index contains composite labels in “row|col” format
(as produced by stack()). Produces a DataFrame with unique row
keys as index and unique column keys as columns.
Sourcepub fn apply_fn<F>(&self, func: F, axis: usize) -> Result<Self, FrameError>
pub fn apply_fn<F>(&self, func: F, axis: usize) -> Result<Self, FrameError>
Apply a closure to each column (axis=0) or each row (axis=1).
Unlike the string-based apply(), this takes a Rust closure.
Sourcepub fn apply_with_result_type<F>(
&self,
func: F,
result_type: &str,
) -> Result<Self, FrameError>
pub fn apply_with_result_type<F>( &self, func: F, result_type: &str, ) -> Result<Self, FrameError>
Row-wise apply with result_type control.
Matches pd.DataFrame.apply(func, axis=1, result_type=...).
"reduce": Each row produces a single scalar → returns a Series (default)."expand": Each row produces a Vec of scalars → columns of the output DataFrame."broadcast": Each row produces a scalar → broadcast to all columns, preserving shape.
Sourcepub fn apply_row<F>(&self, name: &str, func: F) -> Result<Series, FrameError>
pub fn apply_row<F>(&self, name: &str, func: F) -> Result<Series, FrameError>
Row-wise apply returning a Series (one value per row).
Convenience wrapper for apply_fn(func, 1) that directly returns
a Series instead of a single-column DataFrame.
Sourcepub fn apply_row_fn<F>(&self, name: &str, func: F) -> Result<Series, FrameError>
pub fn apply_row_fn<F>(&self, name: &str, func: F) -> Result<Series, FrameError>
Row-wise apply with failable closure returning a Series.
Like apply_row but the closure can return errors.
Sourcepub fn pivot(
&self,
index_col: &str,
columns_col: &str,
values_col: &str,
) -> Result<Self, FrameError>
pub fn pivot( &self, index_col: &str, columns_col: &str, values_col: &str, ) -> Result<Self, FrameError>
Simple pivot: reshape long to wide using column values.
Matches pd.DataFrame.pivot(index, columns, values).
Unlike pivot_table, no aggregation is performed; duplicate entries error.
Sourcepub fn squeeze_to_series(&self, axis: usize) -> Result<Series, Self>
pub fn squeeze_to_series(&self, axis: usize) -> Result<Series, Self>
Squeeze a single-column DataFrame to a Series, or single-row to a Series.
Matches pd.DataFrame.squeeze(axis).
- axis=1 (default): if single column, return as Series
- axis=0: if single row, return as Series
§Panics
Panics if the squeezed output cannot be represented as a valid Series because the DataFrame’s internal index or column metadata has already diverged from its column storage.
Sourcepub fn memory_usage(&self) -> Result<Series, FrameError>
pub fn memory_usage(&self) -> Result<Series, FrameError>
Approximate memory usage per column.
Matches pd.DataFrame.memory_usage(). Returns a Series with column
names as index and byte estimates as values. Includes the index.
Sourcepub fn memory_usage_with_options(
&self,
index: bool,
deep: bool,
) -> Result<Series, FrameError>
pub fn memory_usage_with_options( &self, index: bool, deep: bool, ) -> Result<Series, FrameError>
Matches pd.DataFrame.memory_usage(index=..., deep=...).
Sourcepub fn nunique(&self) -> Result<Series, FrameError>
pub fn nunique(&self) -> Result<Series, FrameError>
Count of unique non-null values per column.
Matches pd.DataFrame.nunique().
Sourcepub fn nunique_with_dropna(&self, dropna: bool) -> Result<Series, FrameError>
pub fn nunique_with_dropna(&self, dropna: bool) -> Result<Series, FrameError>
Count of unique values per column with explicit null counting control.
Matches pd.DataFrame.nunique(dropna=...).
Sourcepub fn nunique_axis(&self, axis: usize) -> Result<Series, FrameError>
pub fn nunique_axis(&self, axis: usize) -> Result<Series, FrameError>
Count unique non-null values with axis parameter.
Matches pd.DataFrame.nunique(axis).
- axis=0 (default): unique count per column (same as
nunique()) - axis=1: unique count per row
Sourcepub fn nunique_axis_with_dropna(
&self,
axis: usize,
dropna: bool,
) -> Result<Series, FrameError>
pub fn nunique_axis_with_dropna( &self, axis: usize, dropna: bool, ) -> Result<Series, FrameError>
Count unique values with axis parameter and explicit null counting control.
Matches pd.DataFrame.nunique(axis=..., dropna=...).
Sourcepub fn nunique_axis1(&self) -> Result<Series, FrameError>
pub fn nunique_axis1(&self) -> Result<Series, FrameError>
Count unique non-null values per row (axis=1).
Matches pd.DataFrame.nunique(axis=1).
Sourcepub fn nunique_axis1_with_dropna(
&self,
dropna: bool,
) -> Result<Series, FrameError>
pub fn nunique_axis1_with_dropna( &self, dropna: bool, ) -> Result<Series, FrameError>
Count unique values per row with explicit null counting control.
Matches pd.DataFrame.nunique(axis=1, dropna=...).
Sourcepub fn idxmin(&self) -> Result<Series, FrameError>
pub fn idxmin(&self) -> Result<Series, FrameError>
Return index label of minimum value over requested axis.
Matches pd.DataFrame.idxmin().
Sourcepub fn idxmax(&self) -> Result<Series, FrameError>
pub fn idxmax(&self) -> Result<Series, FrameError>
Return index label of maximum value over requested axis.
Matches pd.DataFrame.idxmax().
Sourcepub fn idxmax_ext(
&self,
axis: usize,
skipna: bool,
numeric_only: bool,
) -> Result<Series, FrameError>
pub fn idxmax_ext( &self, axis: usize, skipna: bool, numeric_only: bool, ) -> Result<Series, FrameError>
Return index of first occurrence of maximum over requested axis.
Matches df.idxmax(axis=..., skipna=..., numeric_only=...).
Sourcepub fn idxmin_ext(
&self,
axis: usize,
skipna: bool,
numeric_only: bool,
) -> Result<Series, FrameError>
pub fn idxmin_ext( &self, axis: usize, skipna: bool, numeric_only: bool, ) -> Result<Series, FrameError>
Return index of first occurrence of minimum over requested axis.
Matches df.idxmin(axis=..., skipna=..., numeric_only=...).
Sourcepub fn idxmin_axis1(&self) -> Result<Series, FrameError>
pub fn idxmin_axis1(&self) -> Result<Series, FrameError>
Column label of the minimum value per row (axis=1).
Matches pd.DataFrame.idxmin(axis=1). Returns a Series with one
entry per row, containing the column name of the minimum value.
Sourcepub fn idxmax_axis1(&self) -> Result<Series, FrameError>
pub fn idxmax_axis1(&self) -> Result<Series, FrameError>
Column label of the maximum value per row (axis=1).
Matches pd.DataFrame.idxmax(axis=1). Returns a Series with one
entry per row, containing the column name of the maximum value.
Sourcepub fn all(&self) -> Result<Series, FrameError>
pub fn all(&self) -> Result<Series, FrameError>
Whether all non-null values are truthy, per column.
Matches pd.DataFrame.all().
Sourcepub fn any(&self) -> Result<Series, FrameError>
pub fn any(&self) -> Result<Series, FrameError>
Whether any non-null value is truthy, per column.
Matches pd.DataFrame.any().
Sourcepub fn sum(&self) -> Result<Series, FrameError>
pub fn sum(&self) -> Result<Series, FrameError>
Sum of non-null values per column.
Matches pd.DataFrame.sum().
⚠️ This still defaults to numeric_only=true, which is pandas 1.x.
pandas 2.x defaults to FALSE and includes object columns. Reach the
pandas-2.x behaviour explicitly via Self::sum_with_numeric_only until
the default is flipped
(br-frankenpandas-reductions-numeric-only-default-zx21n).
Sourcepub fn sum_with_numeric_only(
&self,
numeric_only: bool,
) -> Result<Series, FrameError>
pub fn sum_with_numeric_only( &self, numeric_only: bool, ) -> Result<Series, FrameError>
df.sum(numeric_only=...). With false, an object column is CONCATENATED
and the numeric columns keep their own dtype, matching pandas 2.x.
Sourcepub fn min_agg_with_numeric_only(
&self,
numeric_only: bool,
) -> Result<Series, FrameError>
pub fn min_agg_with_numeric_only( &self, numeric_only: bool, ) -> Result<Series, FrameError>
df.min(numeric_only=...). With false, an object column is compared
LEXICOGRAPHICALLY, matching pandas 2.x.
Sourcepub fn max_agg_with_numeric_only(
&self,
numeric_only: bool,
) -> Result<Series, FrameError>
pub fn max_agg_with_numeric_only( &self, numeric_only: bool, ) -> Result<Series, FrameError>
df.max(numeric_only=...). See Self::min_agg_with_numeric_only.
Sourcepub fn mean_with_numeric_only(
&self,
numeric_only: bool,
) -> Result<Series, FrameError>
pub fn mean_with_numeric_only( &self, numeric_only: bool, ) -> Result<Series, FrameError>
df.mean(numeric_only=...). With false and a non-numeric column present
this RAISES, as pandas 2.x does (“Could not convert … to numeric”).
Sourcepub fn prod_with_numeric_only(
&self,
numeric_only: bool,
) -> Result<Series, FrameError>
pub fn prod_with_numeric_only( &self, numeric_only: bool, ) -> Result<Series, FrameError>
df.prod(numeric_only=...). Raises on a non-numeric column when false.
Sourcepub fn median_with_numeric_only(
&self,
numeric_only: bool,
) -> Result<Series, FrameError>
pub fn median_with_numeric_only( &self, numeric_only: bool, ) -> Result<Series, FrameError>
df.median(numeric_only=...). Raises on a non-numeric column when false.
Sourcepub fn std_agg_with_numeric_only(
&self,
numeric_only: bool,
) -> Result<Series, FrameError>
pub fn std_agg_with_numeric_only( &self, numeric_only: bool, ) -> Result<Series, FrameError>
df.std(numeric_only=...). Raises on a non-numeric column when false.
Sourcepub fn var_agg_with_numeric_only(
&self,
numeric_only: bool,
) -> Result<Series, FrameError>
pub fn var_agg_with_numeric_only( &self, numeric_only: bool, ) -> Result<Series, FrameError>
df.var(numeric_only=...). Raises on a non-numeric column when false.
Sourcepub fn sem_agg_with_numeric_only(
&self,
numeric_only: bool,
) -> Result<Series, FrameError>
pub fn sem_agg_with_numeric_only( &self, numeric_only: bool, ) -> Result<Series, FrameError>
df.sem(numeric_only=...). Raises on a non-numeric column when false.
Sourcepub fn skew_agg_with_numeric_only(
&self,
numeric_only: bool,
) -> Result<Series, FrameError>
pub fn skew_agg_with_numeric_only( &self, numeric_only: bool, ) -> Result<Series, FrameError>
df.skew(numeric_only=...). Raises on a non-numeric column when false.
Sourcepub fn kurtosis_agg_with_numeric_only(
&self,
numeric_only: bool,
) -> Result<Series, FrameError>
pub fn kurtosis_agg_with_numeric_only( &self, numeric_only: bool, ) -> Result<Series, FrameError>
df.kurtosis(numeric_only=...). Raises on a non-numeric column when
false.
Sourcepub fn mean(&self) -> Result<Series, FrameError>
pub fn mean(&self) -> Result<Series, FrameError>
Mean of non-null values per column.
Matches pd.DataFrame.mean().
Sourcepub fn min_agg(&self) -> Result<Series, FrameError>
pub fn min_agg(&self) -> Result<Series, FrameError>
Min of non-null values per column.
Matches pd.DataFrame.min().
Sourcepub fn max_agg(&self) -> Result<Series, FrameError>
pub fn max_agg(&self) -> Result<Series, FrameError>
Max of non-null values per column.
Matches pd.DataFrame.max().
Sourcepub fn std_agg(&self) -> Result<Series, FrameError>
pub fn std_agg(&self) -> Result<Series, FrameError>
Standard deviation of non-null values per column.
Matches pd.DataFrame.std().
Sourcepub fn var_agg(&self) -> Result<Series, FrameError>
pub fn var_agg(&self) -> Result<Series, FrameError>
Variance of non-null values per column.
Matches pd.DataFrame.var().
Sourcepub fn std_agg_ddof(&self, ddof: usize) -> Result<Series, FrameError>
pub fn std_agg_ddof(&self, ddof: usize) -> Result<Series, FrameError>
Standard deviation per column with configurable degrees of freedom.
Matches pd.DataFrame.std(ddof=n).
Sourcepub fn var_agg_ddof(&self, ddof: usize) -> Result<Series, FrameError>
pub fn var_agg_ddof(&self, ddof: usize) -> Result<Series, FrameError>
Variance per column with configurable degrees of freedom.
Matches pd.DataFrame.var(ddof=n).
Sourcepub fn median_agg(&self) -> Result<Series, FrameError>
pub fn median_agg(&self) -> Result<Series, FrameError>
Median of non-null values per column.
Matches pd.DataFrame.median().
Sourcepub fn prod_agg(&self) -> Result<Series, FrameError>
pub fn prod_agg(&self) -> Result<Series, FrameError>
Product of non-null values per column.
Matches pd.DataFrame.prod().
Sourcepub fn mode(&self) -> Result<Self, FrameError>
pub fn mode(&self) -> Result<Self, FrameError>
Mode per column.
Matches pd.DataFrame.mode(). Returns a DataFrame where each column
contains its mode values, padded with NaN when columns have fewer modes.
Sourcepub fn mode_with_options(
&self,
axis: usize,
numeric_only: bool,
dropna: bool,
) -> Result<Self, FrameError>
pub fn mode_with_options( &self, axis: usize, numeric_only: bool, dropna: bool, ) -> Result<Self, FrameError>
Mode over columns or rows with pandas-compatible options.
Matches pd.DataFrame.mode(axis=..., numeric_only=..., dropna=...).
Sourcepub fn sum_skipna(&self, skipna: bool) -> Result<Series, FrameError>
pub fn sum_skipna(&self, skipna: bool) -> Result<Series, FrameError>
Sum per column with skipna control.
Matches pd.DataFrame.sum(skipna=True|False).
Sourcepub fn mean_skipna(&self, skipna: bool) -> Result<Series, FrameError>
pub fn mean_skipna(&self, skipna: bool) -> Result<Series, FrameError>
Mean per column with skipna control.
Sourcepub fn std_agg_skipna(&self, skipna: bool) -> Result<Series, FrameError>
pub fn std_agg_skipna(&self, skipna: bool) -> Result<Series, FrameError>
Std per column with skipna control.
Sourcepub fn var_agg_skipna(&self, skipna: bool) -> Result<Series, FrameError>
pub fn var_agg_skipna(&self, skipna: bool) -> Result<Series, FrameError>
Var per column with skipna control.
Sourcepub fn prod_agg_skipna(&self, skipna: bool) -> Result<Series, FrameError>
pub fn prod_agg_skipna(&self, skipna: bool) -> Result<Series, FrameError>
Prod per column with skipna control.
Sourcepub fn skew_agg(&self) -> Result<Series, FrameError>
pub fn skew_agg(&self) -> Result<Series, FrameError>
Skewness of non-null values per column.
Matches pd.DataFrame.skew().
Sourcepub fn kurtosis_agg(&self) -> Result<Series, FrameError>
pub fn kurtosis_agg(&self) -> Result<Series, FrameError>
Kurtosis of non-null values per column.
Matches pd.DataFrame.kurtosis().
Sourcepub fn kurt_agg(&self) -> Result<Series, FrameError>
pub fn kurt_agg(&self) -> Result<Series, FrameError>
Alias for kurtosis_agg() — pandas exposes df.kurt() and
df.kurtosis() as equivalents at the column-aggregate level.
Sourcepub fn sem_agg(&self) -> Result<Series, FrameError>
pub fn sem_agg(&self) -> Result<Series, FrameError>
Standard error of the mean per column.
Matches pd.DataFrame.sem().
Sourcepub fn min(&self) -> Result<Series, FrameError>
pub fn min(&self) -> Result<Series, FrameError>
Per-column min — pandas-parity alias for min_agg.
Sourcepub fn max(&self) -> Result<Series, FrameError>
pub fn max(&self) -> Result<Series, FrameError>
Per-column max — pandas-parity alias for max_agg.
Sourcepub fn std(&self) -> Result<Series, FrameError>
pub fn std(&self) -> Result<Series, FrameError>
Per-column std — pandas-parity alias for std_agg.
Sourcepub fn var(&self) -> Result<Series, FrameError>
pub fn var(&self) -> Result<Series, FrameError>
Per-column var — pandas-parity alias for var_agg.
Sourcepub fn median(&self) -> Result<Series, FrameError>
pub fn median(&self) -> Result<Series, FrameError>
Per-column median — pandas-parity alias for median_agg.
Sourcepub fn prod(&self) -> Result<Series, FrameError>
pub fn prod(&self) -> Result<Series, FrameError>
Per-column product — pandas-parity alias for prod_agg.
Sourcepub fn skew(&self) -> Result<Series, FrameError>
pub fn skew(&self) -> Result<Series, FrameError>
Per-column skewness — pandas-parity alias for skew_agg.
Sourcepub fn kurtosis(&self) -> Result<Series, FrameError>
pub fn kurtosis(&self) -> Result<Series, FrameError>
Per-column excess kurtosis — pandas-parity alias for
kurtosis_agg. Pandas uses both kurt and
kurtosis as aliases.
Sourcepub fn kurt(&self) -> Result<Series, FrameError>
pub fn kurt(&self) -> Result<Series, FrameError>
Per-column excess kurtosis (pandas alias for kurtosis).
Sourcepub fn sem(&self) -> Result<Series, FrameError>
pub fn sem(&self) -> Result<Series, FrameError>
Per-column standard error of the mean — pandas-parity alias for
sem_agg.
Sourcepub fn sum_axis1(&self) -> Result<Series, FrameError>
pub fn sum_axis1(&self) -> Result<Series, FrameError>
Sum across columns per row.
Matches pd.DataFrame.sum(axis=1).
Sourcepub fn mean_axis1(&self) -> Result<Series, FrameError>
pub fn mean_axis1(&self) -> Result<Series, FrameError>
Mean across columns per row.
Matches pd.DataFrame.mean(axis=1).
Sourcepub fn min_axis1(&self) -> Result<Series, FrameError>
pub fn min_axis1(&self) -> Result<Series, FrameError>
Minimum across columns per row.
Matches pd.DataFrame.min(axis=1).
Sourcepub fn apply_rows<F>(&self, func: F, name: &str) -> Result<Series, FrameError>
pub fn apply_rows<F>(&self, func: F, name: &str) -> Result<Series, FrameError>
Apply a custom function to each row of the DataFrame.
Matches pd.DataFrame.apply(func, axis=1). The function receives
a slice of Scalar values representing the row (in column_order)
and should return a single Scalar result.
Sourcepub fn max_axis1(&self) -> Result<Series, FrameError>
pub fn max_axis1(&self) -> Result<Series, FrameError>
Maximum across columns per row.
Matches pd.DataFrame.max(axis=1).
Sourcepub fn std_axis1(&self) -> Result<Series, FrameError>
pub fn std_axis1(&self) -> Result<Series, FrameError>
Standard deviation across columns per row.
Matches pd.DataFrame.std(axis=1).
Sourcepub fn var_axis1(&self) -> Result<Series, FrameError>
pub fn var_axis1(&self) -> Result<Series, FrameError>
Variance across columns per row.
Matches pd.DataFrame.var(axis=1).
Sourcepub fn sem_axis1(&self) -> Result<Series, FrameError>
pub fn sem_axis1(&self) -> Result<Series, FrameError>
Standard error of the mean across columns per row.
Matches pd.DataFrame.sem(axis=1).
Sourcepub fn skew_axis1(&self) -> Result<Series, FrameError>
pub fn skew_axis1(&self) -> Result<Series, FrameError>
Skewness across columns per row.
Matches pd.DataFrame.skew(axis=1).
Sourcepub fn kurtosis_axis1(&self) -> Result<Series, FrameError>
pub fn kurtosis_axis1(&self) -> Result<Series, FrameError>
Excess kurtosis across columns per row.
Matches pd.DataFrame.kurtosis(axis=1).
Sourcepub fn kurt_axis1(&self) -> Result<Series, FrameError>
pub fn kurt_axis1(&self) -> Result<Series, FrameError>
Alias for kurtosis_axis1() — pandas exposes
df.kurt(axis=1) and df.kurtosis(axis=1) as equivalents.
Sourcepub fn count_axis1(&self) -> Result<Series, FrameError>
pub fn count_axis1(&self) -> Result<Series, FrameError>
Count of non-null values across columns per row.
Matches pd.DataFrame.count(axis=1).
Sourcepub fn all_axis1(&self) -> Result<Series, FrameError>
pub fn all_axis1(&self) -> Result<Series, FrameError>
Whether all non-null values are truthy across columns per row.
Matches pd.DataFrame.all(axis=1).
Sourcepub fn any_axis1(&self) -> Result<Series, FrameError>
pub fn any_axis1(&self) -> Result<Series, FrameError>
Whether any non-null value is truthy across columns per row.
Matches pd.DataFrame.any(axis=1).
Sourcepub fn quantile_axis1(&self, q: f64) -> Result<Series, FrameError>
pub fn quantile_axis1(&self, q: f64) -> Result<Series, FrameError>
Median across columns per row.
Matches pd.DataFrame.median(axis=1).
Per-row quantile across numeric columns (axis=1).
Matches pd.DataFrame.quantile(q, axis=1). For each row the
numeric column values are collected (skipping non-numeric and
missing entries) and their linear-interpolation quantile is
returned. q must lie in [0.0, 1.0]. Rows with no numeric
entries emit Null(NaN).
Sourcepub fn argmin_axis1(&self) -> Result<Series, FrameError>
pub fn argmin_axis1(&self) -> Result<Series, FrameError>
Per-row index label of the first smallest numeric value.
Matches pd.DataFrame.idxmin(axis=1) combined with positional
column lookup. Returns the column-name Series entry for each
row’s argmin; rows with no numeric entries emit Null(NaN).
Sourcepub fn argmax_axis1(&self) -> Result<Series, FrameError>
pub fn argmax_axis1(&self) -> Result<Series, FrameError>
Per-row index label of the first largest numeric value.
Matches pd.DataFrame.idxmax(axis=1).
pub fn median_axis1(&self) -> Result<Series, FrameError>
Sourcepub fn prod_axis1(&self) -> Result<Series, FrameError>
pub fn prod_axis1(&self) -> Result<Series, FrameError>
Product across columns per row.
Matches pd.DataFrame.prod(axis=1).
Sourcepub fn cumsum(&self) -> Result<Self, FrameError>
pub fn cumsum(&self) -> Result<Self, FrameError>
Cumulative sum per column.
Matches pd.DataFrame.cumsum().
Sourcepub fn cumprod(&self) -> Result<Self, FrameError>
pub fn cumprod(&self) -> Result<Self, FrameError>
Cumulative product per column.
Matches pd.DataFrame.cumprod().
Sourcepub fn cummax(&self) -> Result<Self, FrameError>
pub fn cummax(&self) -> Result<Self, FrameError>
Cumulative maximum per column.
Matches pd.DataFrame.cummax().
Sourcepub fn cummin(&self) -> Result<Self, FrameError>
pub fn cummin(&self) -> Result<Self, FrameError>
Cumulative minimum per column.
Matches pd.DataFrame.cummin().
Sourcepub fn cumsum_with_skipna(&self, skipna: bool) -> Result<Self, FrameError>
pub fn cumsum_with_skipna(&self, skipna: bool) -> Result<Self, FrameError>
Per-column cumulative sum with an explicit skipna, matching
pd.DataFrame.cumsum(axis=0, skipna=...). skipna=false propagates the
first NaN/NaT down each column (br-frankenpandas-tlhd6 follow-up).
Sourcepub fn cumprod_with_skipna(&self, skipna: bool) -> Result<Self, FrameError>
pub fn cumprod_with_skipna(&self, skipna: bool) -> Result<Self, FrameError>
Per-column cumulative product with an explicit skipna
(see cumsum_with_skipna).
Sourcepub fn cummax_with_skipna(&self, skipna: bool) -> Result<Self, FrameError>
pub fn cummax_with_skipna(&self, skipna: bool) -> Result<Self, FrameError>
Per-column cumulative maximum with an explicit skipna
(see cumsum_with_skipna).
Sourcepub fn cummin_with_skipna(&self, skipna: bool) -> Result<Self, FrameError>
pub fn cummin_with_skipna(&self, skipna: bool) -> Result<Self, FrameError>
Per-column cumulative minimum with an explicit skipna
(see cumsum_with_skipna).
Sourcepub fn cumsum_axis1_with_skipna(&self, skipna: bool) -> Result<Self, FrameError>
pub fn cumsum_axis1_with_skipna(&self, skipna: bool) -> Result<Self, FrameError>
Cumulative sum across columns with explicit skipna, computed row-wise.
Sourcepub fn cumsum_axis1(&self) -> Result<Self, FrameError>
pub fn cumsum_axis1(&self) -> Result<Self, FrameError>
Cumulative sum across columns, computed row-wise.
Matches pd.DataFrame.cumsum(axis=1, skipna=True).
Sourcepub fn cumprod_axis1_with_skipna(
&self,
skipna: bool,
) -> Result<Self, FrameError>
pub fn cumprod_axis1_with_skipna( &self, skipna: bool, ) -> Result<Self, FrameError>
Cumulative product across columns with explicit skipna, computed row-wise.
Sourcepub fn cumprod_axis1(&self) -> Result<Self, FrameError>
pub fn cumprod_axis1(&self) -> Result<Self, FrameError>
Cumulative product across columns, computed row-wise.
Matches pd.DataFrame.cumprod(axis=1, skipna=True).
Sourcepub fn cummin_axis1_with_skipna(&self, skipna: bool) -> Result<Self, FrameError>
pub fn cummin_axis1_with_skipna(&self, skipna: bool) -> Result<Self, FrameError>
Cumulative minimum across columns with explicit skipna, computed row-wise.
Sourcepub fn cummin_axis1(&self) -> Result<Self, FrameError>
pub fn cummin_axis1(&self) -> Result<Self, FrameError>
Cumulative minimum across columns, computed row-wise.
Matches pd.DataFrame.cummin(axis=1, skipna=True).
Sourcepub fn cummax_axis1_with_skipna(&self, skipna: bool) -> Result<Self, FrameError>
pub fn cummax_axis1_with_skipna(&self, skipna: bool) -> Result<Self, FrameError>
Cumulative maximum across columns with explicit skipna, computed row-wise.
Sourcepub fn cummax_axis1(&self) -> Result<Self, FrameError>
pub fn cummax_axis1(&self) -> Result<Self, FrameError>
Cumulative maximum across columns, computed row-wise.
Matches pd.DataFrame.cummax(axis=1, skipna=True).
Sourcepub fn diff(&self, periods: i64) -> Result<Self, FrameError>
pub fn diff(&self, periods: i64) -> Result<Self, FrameError>
First-order difference per column.
Matches pd.DataFrame.diff(periods).
Sourcepub fn diff_axis1(&self, periods: i64) -> Result<Self, FrameError>
pub fn diff_axis1(&self, periods: i64) -> Result<Self, FrameError>
First-order difference across columns per row.
Matches pd.DataFrame.diff(periods, axis=1).
Sourcepub fn pct_change_axis1(&self, periods: i64) -> Result<Self, FrameError>
pub fn pct_change_axis1(&self, periods: i64) -> Result<Self, FrameError>
Percentage change across columns per row.
Matches pd.DataFrame.pct_change(periods, axis=1).
Sourcepub fn shift(&self, periods: i64) -> Result<Self, FrameError>
pub fn shift(&self, periods: i64) -> Result<Self, FrameError>
Shift values per column.
Matches pd.DataFrame.shift(periods).
Sourcepub fn shift_with_fill_value(
&self,
periods: i64,
fill_value: Scalar,
) -> Result<Self, FrameError>
pub fn shift_with_fill_value( &self, periods: i64, fill_value: Scalar, ) -> Result<Self, FrameError>
Shift values per column, filling the vacated positions with fill_value
instead of NaN. Matches pd.DataFrame.shift(periods, fill_value=...). An
Int64 fill on an Int64 column keeps that column Int64 (no widening
to Float64), exactly as the Series variant (br-frankenpandas-twqkf).
Sourcepub fn shift_axis1(&self, periods: i64) -> Result<Self, FrameError>
pub fn shift_axis1(&self, periods: i64) -> Result<Self, FrameError>
Shift index horizontally by desired number of periods.
Matches pd.DataFrame.shift(periods, axis=1).
Sourcepub fn shift_axis1_with_fill_value(
&self,
periods: i64,
fill_value: Scalar,
) -> Result<Self, FrameError>
pub fn shift_axis1_with_fill_value( &self, periods: i64, fill_value: Scalar, ) -> Result<Self, FrameError>
Shift index horizontally by desired number of periods, filling vacated positions with fill_value.
Matches pd.DataFrame.shift(periods, axis=1, fill_value=...).
Sourcepub fn abs(&self) -> Result<Self, FrameError>
pub fn abs(&self) -> Result<Self, FrameError>
Absolute value per column.
Matches pd.DataFrame.abs().
Sourcepub fn clip(
&self,
lower: Option<f64>,
upper: Option<f64>,
) -> Result<Self, FrameError>
pub fn clip( &self, lower: Option<f64>, upper: Option<f64>, ) -> Result<Self, FrameError>
Clip values per column.
Matches pd.DataFrame.clip(lower, upper).
Sourcepub fn clip_lower(&self, threshold: f64) -> Result<Self, FrameError>
pub fn clip_lower(&self, threshold: f64) -> Result<Self, FrameError>
Clip values below a threshold across all numeric columns.
Matches pd.DataFrame.clip(lower=threshold).
Sourcepub fn clip_upper(&self, threshold: f64) -> Result<Self, FrameError>
pub fn clip_upper(&self, threshold: f64) -> Result<Self, FrameError>
Clip values above a threshold across all numeric columns.
Matches pd.DataFrame.clip(upper=threshold).
Sourcepub fn clip_with_column_bounds(
&self,
lower: Option<&Series>,
upper: Option<&Series>,
) -> Result<Self, FrameError>
pub fn clip_with_column_bounds( &self, lower: Option<&Series>, upper: Option<&Series>, ) -> Result<Self, FrameError>
Clip each column to its own bound, matching df.clip(lower=s, upper=s, axis=1) where lower/upper are Series indexed by column name.
Each numeric column is clipped to the scalar bound looked up by its name.
Following pandas’ where-based broadcast, a column whose provided lower
or upper bound is absent from the Series (i.e. NaN) becomes all-NaN —
distinct from the scalar clip, where a NaN bound means “no clip”.
A bound Series passed as None applies no clipping on that side.
(Per-row bounds, axis=0, are tracked under br-frankenpandas-l4wfl.)
Sourcepub fn clip_with_row_bounds(
&self,
lower: Option<&Series>,
upper: Option<&Series>,
) -> Result<Self, FrameError>
pub fn clip_with_row_bounds( &self, lower: Option<&Series>, upper: Option<&Series>, ) -> Result<Self, FrameError>
Clip each row to its own bound, matching df.clip(lower=s, upper=s, axis=0) where lower/upper are Series indexed by row label.
Every numeric value in row i is clipped to the bound looked up by that
row’s label. Semantics verified against live pandas 2.2.3
(br-frankenpandas-l4wfl):
- A row label present in the bound Series with a finite value clips
that whole row to the value; dtype is preserved when the input is
Int64and every resulting value is integral (an integral float bound such as3.0keepsInt64; a fractional bound that actually clips demotes the column toFloat64). - A row label present but NaN applies no clipping on that side (NaN comparisons are false), leaving the value and dtype untouched.
- A row label absent from any provided bound Series forces that entire
row to NaN and demotes every column to
Float64— pandas reindexes the bound to the frame’s axis, and the introduced NaN propagates through the where-broadcast. This is distinct from a present-but-NaN bound. - Pre-existing data nulls are preserved (and, like pandas, keep the
column in
Float64).
A bound Series passed as None applies no clipping on that side.
(Per-column bounds, axis=1, are Self::clip_with_column_bounds.)
Sourcepub fn round(&self, decimals: i32) -> Result<Self, FrameError>
pub fn round(&self, decimals: i32) -> Result<Self, FrameError>
Round numeric columns to specified decimal places.
Matches pd.DataFrame.round(decimals).
Sourcepub fn round_columns(
&self,
decimals: &BTreeMap<String, i32>,
) -> Result<Self, FrameError>
pub fn round_columns( &self, decimals: &BTreeMap<String, i32>, ) -> Result<Self, FrameError>
Round each named column to its own number of decimal places.
Matches pd.DataFrame.round(decimals) where decimals is a dict/Series
mapping column name -> decimals. Columns absent from the map are left
UNCHANGED (pandas only rounds the listed columns); a listed non-numeric
column is also left unchanged (rounding is a no-op on object dtype).
Sourcepub fn floor(&self) -> Result<Self, FrameError>
pub fn floor(&self) -> Result<Self, FrameError>
Floor each numeric element (round toward negative infinity).
Matches np.floor(df). NaN values pass through.
Sourcepub fn ceil(&self) -> Result<Self, FrameError>
pub fn ceil(&self) -> Result<Self, FrameError>
Ceiling of each numeric element (round toward positive infinity).
Matches np.ceil(df). NaN values pass through.
Sourcepub fn trunc(&self) -> Result<Self, FrameError>
pub fn trunc(&self) -> Result<Self, FrameError>
Truncate each numeric element toward zero.
Matches np.trunc(df). NaN values pass through.
Sourcepub fn sqrt(&self) -> Result<Self, FrameError>
pub fn sqrt(&self) -> Result<Self, FrameError>
Element-wise square root.
Matches np.sqrt(df). NaN values pass through.
Sourcepub fn exp(&self) -> Result<Self, FrameError>
pub fn exp(&self) -> Result<Self, FrameError>
Element-wise exponential (e^x).
Matches np.exp(df). NaN values pass through.
Sourcepub fn log(&self) -> Result<Self, FrameError>
pub fn log(&self) -> Result<Self, FrameError>
Element-wise natural logarithm.
Matches np.log(df). NaN values pass through.
Sourcepub fn log10(&self) -> Result<Self, FrameError>
pub fn log10(&self) -> Result<Self, FrameError>
Element-wise base-10 logarithm.
Matches np.log10(df). NaN values pass through.
Sourcepub fn log2(&self) -> Result<Self, FrameError>
pub fn log2(&self) -> Result<Self, FrameError>
Element-wise base-2 logarithm.
Matches np.log2(df). NaN values pass through.
Sourcepub fn sin(&self) -> Result<Self, FrameError>
pub fn sin(&self) -> Result<Self, FrameError>
Element-wise sine.
Matches np.sin(df). NaN values pass through.
Sourcepub fn cos(&self) -> Result<Self, FrameError>
pub fn cos(&self) -> Result<Self, FrameError>
Element-wise cosine.
Matches np.cos(df). NaN values pass through.
Sourcepub fn tan(&self) -> Result<Self, FrameError>
pub fn tan(&self) -> Result<Self, FrameError>
Element-wise tangent.
Matches np.tan(df). NaN values pass through.
Sourcepub fn sinh(&self) -> Result<Self, FrameError>
pub fn sinh(&self) -> Result<Self, FrameError>
Element-wise hyperbolic sine.
Matches np.sinh(df). NaN values pass through.
Sourcepub fn cosh(&self) -> Result<Self, FrameError>
pub fn cosh(&self) -> Result<Self, FrameError>
Element-wise hyperbolic cosine.
Matches np.cosh(df). NaN values pass through.
Sourcepub fn tanh(&self) -> Result<Self, FrameError>
pub fn tanh(&self) -> Result<Self, FrameError>
Element-wise hyperbolic tangent.
Matches np.tanh(df). NaN values pass through.
Sourcepub fn arcsin(&self) -> Result<Self, FrameError>
pub fn arcsin(&self) -> Result<Self, FrameError>
Element-wise inverse sine.
Matches np.arcsin(df). NaN values pass through.
Sourcepub fn arccos(&self) -> Result<Self, FrameError>
pub fn arccos(&self) -> Result<Self, FrameError>
Element-wise inverse cosine.
Matches np.arccos(df). NaN values pass through.
Sourcepub fn arctan(&self) -> Result<Self, FrameError>
pub fn arctan(&self) -> Result<Self, FrameError>
Element-wise inverse tangent.
Matches np.arctan(df). NaN values pass through.
Sourcepub fn arcsinh(&self) -> Result<Self, FrameError>
pub fn arcsinh(&self) -> Result<Self, FrameError>
Element-wise inverse hyperbolic sine.
Matches np.arcsinh(df). NaN values pass through.
Sourcepub fn arccosh(&self) -> Result<Self, FrameError>
pub fn arccosh(&self) -> Result<Self, FrameError>
Element-wise inverse hyperbolic cosine.
Matches np.arccosh(df). NaN values pass through.
Sourcepub fn arctanh(&self) -> Result<Self, FrameError>
pub fn arctanh(&self) -> Result<Self, FrameError>
Element-wise inverse hyperbolic tangent.
Matches np.arctanh(df). NaN values pass through.
Sourcepub fn expm1(&self) -> Result<Self, FrameError>
pub fn expm1(&self) -> Result<Self, FrameError>
Element-wise exp(x) - 1 with improved precision for small x.
Matches np.expm1(df). NaN values pass through.
Sourcepub fn log1p(&self) -> Result<Self, FrameError>
pub fn log1p(&self) -> Result<Self, FrameError>
Element-wise log(1 + x) with improved precision for small x.
Matches np.log1p(df). NaN values pass through.
Sourcepub fn cbrt(&self) -> Result<Self, FrameError>
pub fn cbrt(&self) -> Result<Self, FrameError>
Element-wise cube root.
Matches np.cbrt(df). NaN values pass through.
Sourcepub fn sign(&self) -> Result<Self, FrameError>
pub fn sign(&self) -> Result<Self, FrameError>
Element-wise sign (-1, 0, or 1).
Matches np.sign(df). NaN values pass through.
Sourcepub fn signbit(&self) -> Result<Self, FrameError>
pub fn signbit(&self) -> Result<Self, FrameError>
Element-wise sign bit (true if negative).
Matches np.signbit(df). NaN values pass through.
Sourcepub fn radians(&self) -> Result<Self, FrameError>
pub fn radians(&self) -> Result<Self, FrameError>
Convert angles from degrees to radians.
Matches np.radians(df) / np.deg2rad(df).
Sourcepub fn deg2rad(&self) -> Result<Self, FrameError>
pub fn deg2rad(&self) -> Result<Self, FrameError>
Alias for radians(). Matches np.deg2rad(df).
Sourcepub fn degrees(&self) -> Result<Self, FrameError>
pub fn degrees(&self) -> Result<Self, FrameError>
Convert angles from radians to degrees.
Matches np.degrees(df) / np.rad2deg(df).
Sourcepub fn rad2deg(&self) -> Result<Self, FrameError>
pub fn rad2deg(&self) -> Result<Self, FrameError>
Alias for degrees(). Matches np.rad2deg(df).
Sourcepub fn reciprocal(&self) -> Result<Self, FrameError>
pub fn reciprocal(&self) -> Result<Self, FrameError>
Element-wise reciprocal (1/x).
Matches np.reciprocal(df). NaN values pass through.
Sourcepub fn square(&self) -> Result<Self, FrameError>
pub fn square(&self) -> Result<Self, FrameError>
Element-wise square (x^2).
Matches np.square(df). NaN values pass through.
Sourcepub fn rint(&self) -> Result<Self, FrameError>
pub fn rint(&self) -> Result<Self, FrameError>
Round to nearest integer (banker’s rounding).
Matches np.rint(df). NaN values pass through.
Sourcepub fn fix(&self) -> Result<Self, FrameError>
pub fn fix(&self) -> Result<Self, FrameError>
Round toward zero (alias for trunc).
Matches np.fix(df). NaN values pass through.
Sourcepub fn isfinite(&self) -> Result<Self, FrameError>
pub fn isfinite(&self) -> Result<Self, FrameError>
Element-wise check for finite values.
Matches np.isfinite(df). Returns boolean DataFrame.
Sourcepub fn isinf(&self) -> Result<Self, FrameError>
pub fn isinf(&self) -> Result<Self, FrameError>
Element-wise check for infinite values.
Matches np.isinf(df). Returns boolean DataFrame.
Sourcepub fn isnan(&self) -> Result<Self, FrameError>
pub fn isnan(&self) -> Result<Self, FrameError>
Element-wise check for NaN values.
Matches np.isnan(df). Returns boolean DataFrame.
Sourcepub fn isneginf(&self) -> Result<Self, FrameError>
pub fn isneginf(&self) -> Result<Self, FrameError>
Element-wise check for negative infinity.
Matches np.isneginf(df). Returns boolean DataFrame.
Sourcepub fn isposinf(&self) -> Result<Self, FrameError>
pub fn isposinf(&self) -> Result<Self, FrameError>
Element-wise check for positive infinity.
Matches np.isposinf(df). Returns boolean DataFrame.
Sourcepub fn nan_to_num(&self) -> Result<Self, FrameError>
pub fn nan_to_num(&self) -> Result<Self, FrameError>
Replace NaN with zero and infinity with large finite numbers.
Matches np.nan_to_num(df).
Sourcepub fn neg(&self) -> Result<Self, FrameError>
pub fn neg(&self) -> Result<Self, FrameError>
Element-wise negation (-x).
Matches np.negative(df) / -df.
Sourcepub fn negative(&self) -> Result<Self, FrameError>
pub fn negative(&self) -> Result<Self, FrameError>
Alias for neg(). Matches np.negative(df).
Sourcepub fn invert(&self) -> Result<Self, FrameError>
pub fn invert(&self) -> Result<Self, FrameError>
Element-wise NOT per column: ~df (logical for bool, bitwise for
int; a float column refuses, as numpy).
Sourcepub fn positive(&self) -> Result<Self, FrameError>
pub fn positive(&self) -> Result<Self, FrameError>
Element-wise identity (+x, no-op for numeric).
Matches np.positive(df) / +df.
Sourcepub fn reverse(&self) -> Result<Self, FrameError>
pub fn reverse(&self) -> Result<Self, FrameError>
Reverse the order of elements in each column.
Matches df[::-1] / np.flip(df, axis=0).
Sourcepub fn flip(&self) -> Result<Self, FrameError>
pub fn flip(&self) -> Result<Self, FrameError>
Alias for reverse(). Matches np.flip(df, axis=0).
Sourcepub fn roll(&self, shift: i64) -> Result<Self, FrameError>
pub fn roll(&self, shift: i64) -> Result<Self, FrameError>
Roll elements along axis 0 by shift positions.
Matches np.roll(df, shift, axis=0). Elements shifted off
one end wrap around to the other.
Sourcepub fn tile(&self, reps: usize) -> Result<Self, FrameError>
pub fn tile(&self, reps: usize) -> Result<Self, FrameError>
Tile (repeat) each column a given number of times.
Matches np.tile(df, (reps, 1)).
Sourcepub fn add_scalar(&self, value: f64) -> Result<Self, FrameError>
pub fn add_scalar(&self, value: f64) -> Result<Self, FrameError>
Add a scalar to all numeric columns.
Matches df + scalar or df.add(scalar).
Sourcepub fn arith_series(
&self,
series: &Series,
op: ArithmeticOp,
axis: usize,
reflected: bool,
) -> Result<Self, FrameError>
pub fn arith_series( &self, series: &Series, op: ArithmeticOp, axis: usize, reflected: bool, ) -> Result<Self, FrameError>
df <op> series, or series <op> df when reflected, broadcast as
pandas does (br-frankenpandas-ini2u: fp had no DataFrame x Series op).
With axis = 1 (pandas’ default, “columns”) the Series’ labels name
columns: column labels are outer-joined, each column combines with its
label’s value, and a label on one side only gives an all-NaN float64
column. With axis = 0 (“index”) the Series runs down the rows and each
column combines with it as Series arithmetic over the outer-joined row
labels. An outer join keeps equal labels in order and sorts different
ones; dtypes follow Series arithmetic.
Sourcepub fn cmp_series(
&self,
series: &Series,
op: ComparisonOp,
axis: usize,
) -> Result<Self, FrameError>
pub fn cmp_series( &self, series: &Series, op: ComparisonOp, axis: usize, ) -> Result<Self, FrameError>
df <op> series for a comparison, broadcast like
arith_series: a missing operand compares False
(True under !=), as pandas’ flex comparisons do.
Sourcepub fn arith_scalar(
&self,
scalar: &Scalar,
op: ArithmeticOp,
reflected: bool,
) -> Result<Self, FrameError>
pub fn arith_scalar( &self, scalar: &Scalar, op: ArithmeticOp, reflected: bool, ) -> Result<Self, FrameError>
df <op> scalar, or scalar <op> df when reflected, with pandas’
dtypes: an all-valid Int64 column (and a Bool column under + - * // %)
with an integer scalar goes through the Series kernel
(Column::binary_numeric) and stays int64 - wrapping overflow, pandas’
zero-division floats, its negative-power error - where the f64 path made
it float64 (br-frankenpandas-c74wi). True division, a float scalar, and
every other column keep the f64 path of the per-op methods.
Sourcepub fn sub_scalar(&self, value: f64) -> Result<Self, FrameError>
pub fn sub_scalar(&self, value: f64) -> Result<Self, FrameError>
Subtract a scalar from all numeric columns.
Sourcepub fn mul_scalar(&self, value: f64) -> Result<Self, FrameError>
pub fn mul_scalar(&self, value: f64) -> Result<Self, FrameError>
Multiply all numeric columns by a scalar.
Sourcepub fn div_scalar(&self, value: f64) -> Result<Self, FrameError>
pub fn div_scalar(&self, value: f64) -> Result<Self, FrameError>
Divide all numeric columns by a scalar.
Sourcepub fn pow_scalar(&self, value: f64) -> Result<Self, FrameError>
pub fn pow_scalar(&self, value: f64) -> Result<Self, FrameError>
Raise all numeric columns to a scalar power.
Sourcepub fn mod_scalar(&self, value: f64) -> Result<Self, FrameError>
pub fn mod_scalar(&self, value: f64) -> Result<Self, FrameError>
Modulo all numeric columns by a scalar.
Sourcepub fn add<'a, O>(&self, other: O) -> Result<Self, FrameError>where
O: Into<DataFrameArithmeticOperand<'a>>,
pub fn add<'a, O>(&self, other: O) -> Result<Self, FrameError>where
O: Into<DataFrameArithmeticOperand<'a>>,
Add another DataFrame or scalar with pandas’ canonical method name.
Matches pd.DataFrame.add(other) for DataFrame and scalar operands.
Sourcepub fn sub<'a, O>(&self, other: O) -> Result<Self, FrameError>where
O: Into<DataFrameArithmeticOperand<'a>>,
pub fn sub<'a, O>(&self, other: O) -> Result<Self, FrameError>where
O: Into<DataFrameArithmeticOperand<'a>>,
Subtract another DataFrame or scalar with pandas’ canonical method name.
Sourcepub fn subtract<'a, O>(&self, other: O) -> Result<Self, FrameError>where
O: Into<DataFrameArithmeticOperand<'a>>,
pub fn subtract<'a, O>(&self, other: O) -> Result<Self, FrameError>where
O: Into<DataFrameArithmeticOperand<'a>>,
Alias for DataFrame::sub.
Sourcepub fn mul<'a, O>(&self, other: O) -> Result<Self, FrameError>where
O: Into<DataFrameArithmeticOperand<'a>>,
pub fn mul<'a, O>(&self, other: O) -> Result<Self, FrameError>where
O: Into<DataFrameArithmeticOperand<'a>>,
Multiply by another DataFrame or scalar with pandas’ canonical method name.
Sourcepub fn multiply<'a, O>(&self, other: O) -> Result<Self, FrameError>where
O: Into<DataFrameArithmeticOperand<'a>>,
pub fn multiply<'a, O>(&self, other: O) -> Result<Self, FrameError>where
O: Into<DataFrameArithmeticOperand<'a>>,
Alias for DataFrame::mul.
Sourcepub fn div<'a, O>(&self, other: O) -> Result<Self, FrameError>where
O: Into<DataFrameArithmeticOperand<'a>>,
pub fn div<'a, O>(&self, other: O) -> Result<Self, FrameError>where
O: Into<DataFrameArithmeticOperand<'a>>,
Divide by another DataFrame or scalar with pandas’ canonical method name.
Sourcepub fn divide<'a, O>(&self, other: O) -> Result<Self, FrameError>where
O: Into<DataFrameArithmeticOperand<'a>>,
pub fn divide<'a, O>(&self, other: O) -> Result<Self, FrameError>where
O: Into<DataFrameArithmeticOperand<'a>>,
Alias for DataFrame::div.
Sourcepub fn truediv<'a, O>(&self, other: O) -> Result<Self, FrameError>where
O: Into<DataFrameArithmeticOperand<'a>>,
pub fn truediv<'a, O>(&self, other: O) -> Result<Self, FrameError>where
O: Into<DataFrameArithmeticOperand<'a>>,
Alias for DataFrame::div.
Sourcepub fn floordiv<'a, O>(&self, other: O) -> Result<Self, FrameError>where
O: Into<DataFrameArithmeticOperand<'a>>,
pub fn floordiv<'a, O>(&self, other: O) -> Result<Self, FrameError>where
O: Into<DataFrameArithmeticOperand<'a>>,
Floor-divide by another DataFrame or scalar.
Sourcepub fn mod<'a, O>(&self, other: O) -> Result<Self, FrameError>where
O: Into<DataFrameArithmeticOperand<'a>>,
pub fn mod<'a, O>(&self, other: O) -> Result<Self, FrameError>where
O: Into<DataFrameArithmeticOperand<'a>>,
Modulo by another DataFrame or scalar.
Rust callers use the raw identifier form: df.r#mod(other).
Sourcepub fn pow<'a, O>(&self, other: O) -> Result<Self, FrameError>where
O: Into<DataFrameArithmeticOperand<'a>>,
pub fn pow<'a, O>(&self, other: O) -> Result<Self, FrameError>where
O: Into<DataFrameArithmeticOperand<'a>>,
Raise to the power of another DataFrame or scalar.
Sourcepub fn radd<'a, O>(&self, other: O) -> Result<Self, FrameError>where
O: Into<DataFrameArithmeticOperand<'a>>,
pub fn radd<'a, O>(&self, other: O) -> Result<Self, FrameError>where
O: Into<DataFrameArithmeticOperand<'a>>,
Reverse add: other + self.
Sourcepub fn rsub<'a, O>(&self, other: O) -> Result<Self, FrameError>where
O: Into<DataFrameArithmeticOperand<'a>>,
pub fn rsub<'a, O>(&self, other: O) -> Result<Self, FrameError>where
O: Into<DataFrameArithmeticOperand<'a>>,
Reverse subtract: other - self.
Sourcepub fn rmul<'a, O>(&self, other: O) -> Result<Self, FrameError>where
O: Into<DataFrameArithmeticOperand<'a>>,
pub fn rmul<'a, O>(&self, other: O) -> Result<Self, FrameError>where
O: Into<DataFrameArithmeticOperand<'a>>,
Reverse multiply: other * self.
Sourcepub fn rdiv<'a, O>(&self, other: O) -> Result<Self, FrameError>where
O: Into<DataFrameArithmeticOperand<'a>>,
pub fn rdiv<'a, O>(&self, other: O) -> Result<Self, FrameError>where
O: Into<DataFrameArithmeticOperand<'a>>,
Reverse true division: other / self.
Sourcepub fn rtruediv<'a, O>(&self, other: O) -> Result<Self, FrameError>where
O: Into<DataFrameArithmeticOperand<'a>>,
pub fn rtruediv<'a, O>(&self, other: O) -> Result<Self, FrameError>where
O: Into<DataFrameArithmeticOperand<'a>>,
Alias for DataFrame::rdiv.
Sourcepub fn rfloordiv<'a, O>(&self, other: O) -> Result<Self, FrameError>where
O: Into<DataFrameArithmeticOperand<'a>>,
pub fn rfloordiv<'a, O>(&self, other: O) -> Result<Self, FrameError>where
O: Into<DataFrameArithmeticOperand<'a>>,
Reverse floor division: other // self.
Sourcepub fn rmod<'a, O>(&self, other: O) -> Result<Self, FrameError>where
O: Into<DataFrameArithmeticOperand<'a>>,
pub fn rmod<'a, O>(&self, other: O) -> Result<Self, FrameError>where
O: Into<DataFrameArithmeticOperand<'a>>,
Reverse modulo: other % self.
Sourcepub fn rpow<'a, O>(&self, other: O) -> Result<Self, FrameError>where
O: Into<DataFrameArithmeticOperand<'a>>,
pub fn rpow<'a, O>(&self, other: O) -> Result<Self, FrameError>where
O: Into<DataFrameArithmeticOperand<'a>>,
Reverse power: other ** self.
Sourcepub fn add_df(&self, other: &Self) -> Result<Self, FrameError>
pub fn add_df(&self, other: &Self) -> Result<Self, FrameError>
Add another DataFrame element-wise with index alignment.
Matches pd.DataFrame.add(other).
Sourcepub fn sub_df(&self, other: &Self) -> Result<Self, FrameError>
pub fn sub_df(&self, other: &Self) -> Result<Self, FrameError>
Subtract another DataFrame element-wise with index alignment.
Matches pd.DataFrame.sub(other).
Sourcepub fn mul_df(&self, other: &Self) -> Result<Self, FrameError>
pub fn mul_df(&self, other: &Self) -> Result<Self, FrameError>
Multiply another DataFrame element-wise with index alignment.
Matches pd.DataFrame.mul(other).
Sourcepub fn div_df(&self, other: &Self) -> Result<Self, FrameError>
pub fn div_df(&self, other: &Self) -> Result<Self, FrameError>
Divide by another DataFrame element-wise with index alignment.
Matches pd.DataFrame.div(other).
Sourcepub fn floordiv_df(&self, other: &Self) -> Result<Self, FrameError>
pub fn floordiv_df(&self, other: &Self) -> Result<Self, FrameError>
Floor-divide by another DataFrame element-wise with index alignment.
Matches pd.DataFrame.floordiv(other).
Sourcepub fn mod_df(&self, other: &Self) -> Result<Self, FrameError>
pub fn mod_df(&self, other: &Self) -> Result<Self, FrameError>
Modulo with another DataFrame element-wise with index alignment.
Matches pd.DataFrame.mod(other).
Sourcepub fn pow_df(&self, other: &Self) -> Result<Self, FrameError>
pub fn pow_df(&self, other: &Self) -> Result<Self, FrameError>
Raise another DataFrame element-wise to the power with index alignment.
Matches pd.DataFrame.pow(other) / df1 ** df2.
Sourcepub fn add_df_fill(
&self,
other: &Self,
fill_value: f64,
) -> Result<Self, FrameError>
pub fn add_df_fill( &self, other: &Self, fill_value: f64, ) -> Result<Self, FrameError>
Add another DataFrame element-wise with fill_value for NaN handling.
Matches pd.DataFrame.add(other, fill_value=X).
Sourcepub fn sub_df_fill(
&self,
other: &Self,
fill_value: f64,
) -> Result<Self, FrameError>
pub fn sub_df_fill( &self, other: &Self, fill_value: f64, ) -> Result<Self, FrameError>
Subtract another DataFrame element-wise with fill_value for NaN handling.
Matches pd.DataFrame.sub(other, fill_value=X).
Sourcepub fn mul_df_fill(
&self,
other: &Self,
fill_value: f64,
) -> Result<Self, FrameError>
pub fn mul_df_fill( &self, other: &Self, fill_value: f64, ) -> Result<Self, FrameError>
Multiply another DataFrame element-wise with fill_value for NaN handling.
Matches pd.DataFrame.mul(other, fill_value=X).
Sourcepub fn div_df_fill(
&self,
other: &Self,
fill_value: f64,
) -> Result<Self, FrameError>
pub fn div_df_fill( &self, other: &Self, fill_value: f64, ) -> Result<Self, FrameError>
Divide by another DataFrame element-wise with fill_value for NaN handling.
Matches pd.DataFrame.div(other, fill_value=X).
Sourcepub fn floordiv_df_fill(
&self,
other: &Self,
fill_value: f64,
) -> Result<Self, FrameError>
pub fn floordiv_df_fill( &self, other: &Self, fill_value: f64, ) -> Result<Self, FrameError>
Floor-divide by another DataFrame element-wise with fill_value for NaN handling.
Matches pd.DataFrame.floordiv(other, fill_value=X).
Sourcepub fn mod_df_fill(
&self,
other: &Self,
fill_value: f64,
) -> Result<Self, FrameError>
pub fn mod_df_fill( &self, other: &Self, fill_value: f64, ) -> Result<Self, FrameError>
Modulo with another DataFrame element-wise with fill_value for NaN handling.
Matches pd.DataFrame.mod(other, fill_value=X).
Sourcepub fn floordiv_scalar(&self, value: f64) -> Result<Self, FrameError>
pub fn floordiv_scalar(&self, value: f64) -> Result<Self, FrameError>
Floor-divide all numeric columns by a scalar.
Matches pd.DataFrame.floordiv(scalar).
Sourcepub fn eq_df(&self, other: &Self) -> Result<Self, FrameError>
pub fn eq_df(&self, other: &Self) -> Result<Self, FrameError>
Element-wise equality with another DataFrame.
Matches pd.DataFrame.eq(other).
Sourcepub fn ne_df(&self, other: &Self) -> Result<Self, FrameError>
pub fn ne_df(&self, other: &Self) -> Result<Self, FrameError>
Element-wise not-equal with another DataFrame.
Matches pd.DataFrame.ne(other).
Sourcepub fn gt_df(&self, other: &Self) -> Result<Self, FrameError>
pub fn gt_df(&self, other: &Self) -> Result<Self, FrameError>
Element-wise greater-than with another DataFrame.
Matches pd.DataFrame.gt(other).
Sourcepub fn ge_df(&self, other: &Self) -> Result<Self, FrameError>
pub fn ge_df(&self, other: &Self) -> Result<Self, FrameError>
Element-wise greater-or-equal with another DataFrame.
Matches pd.DataFrame.ge(other).
Sourcepub fn lt_df(&self, other: &Self) -> Result<Self, FrameError>
pub fn lt_df(&self, other: &Self) -> Result<Self, FrameError>
Element-wise less-than with another DataFrame.
Matches pd.DataFrame.lt(other).
Sourcepub fn le_df(&self, other: &Self) -> Result<Self, FrameError>
pub fn le_df(&self, other: &Self) -> Result<Self, FrameError>
Element-wise less-or-equal with another DataFrame.
Matches pd.DataFrame.le(other).
Sourcepub fn compare_scalar_df(
&self,
scalar: &Scalar,
op: ComparisonOp,
) -> Result<Self, FrameError>
pub fn compare_scalar_df( &self, scalar: &Scalar, op: ComparisonOp, ) -> Result<Self, FrameError>
Compare each element in all columns against a scalar.
Matches pd.DataFrame.eq(scalar) etc.
Sourcepub fn eq_scalar_df(&self, scalar: &Scalar) -> Result<Self, FrameError>
pub fn eq_scalar_df(&self, scalar: &Scalar) -> Result<Self, FrameError>
Element-wise == scalar for all columns.
Sourcepub fn ne_scalar_df(&self, scalar: &Scalar) -> Result<Self, FrameError>
pub fn ne_scalar_df(&self, scalar: &Scalar) -> Result<Self, FrameError>
Element-wise != scalar for all columns.
Sourcepub fn gt_scalar_df(&self, scalar: &Scalar) -> Result<Self, FrameError>
pub fn gt_scalar_df(&self, scalar: &Scalar) -> Result<Self, FrameError>
Element-wise > scalar for all columns.
Sourcepub fn ge_scalar_df(&self, scalar: &Scalar) -> Result<Self, FrameError>
pub fn ge_scalar_df(&self, scalar: &Scalar) -> Result<Self, FrameError>
Element-wise >= scalar for all columns.
Sourcepub fn lt_scalar_df(&self, scalar: &Scalar) -> Result<Self, FrameError>
pub fn lt_scalar_df(&self, scalar: &Scalar) -> Result<Self, FrameError>
Element-wise < scalar for all columns.
Sourcepub fn le_scalar_df(&self, scalar: &Scalar) -> Result<Self, FrameError>
pub fn le_scalar_df(&self, scalar: &Scalar) -> Result<Self, FrameError>
Element-wise <= scalar for all columns.
Sourcepub fn eq<'a, O>(&self, other: O) -> Result<Self, FrameError>where
O: Into<DataFrameComparisonOperand<'a>>,
pub fn eq<'a, O>(&self, other: O) -> Result<Self, FrameError>where
O: Into<DataFrameComparisonOperand<'a>>,
Element-wise equality with another DataFrame or scalar.
Matches pd.DataFrame.eq(other).
Sourcepub fn ne<'a, O>(&self, other: O) -> Result<Self, FrameError>where
O: Into<DataFrameComparisonOperand<'a>>,
pub fn ne<'a, O>(&self, other: O) -> Result<Self, FrameError>where
O: Into<DataFrameComparisonOperand<'a>>,
Element-wise inequality with another DataFrame or scalar.
Matches pd.DataFrame.ne(other).
Sourcepub fn gt<'a, O>(&self, other: O) -> Result<Self, FrameError>where
O: Into<DataFrameComparisonOperand<'a>>,
pub fn gt<'a, O>(&self, other: O) -> Result<Self, FrameError>where
O: Into<DataFrameComparisonOperand<'a>>,
Element-wise greater-than comparison with another DataFrame or scalar.
Matches pd.DataFrame.gt(other).
Sourcepub fn ge<'a, O>(&self, other: O) -> Result<Self, FrameError>where
O: Into<DataFrameComparisonOperand<'a>>,
pub fn ge<'a, O>(&self, other: O) -> Result<Self, FrameError>where
O: Into<DataFrameComparisonOperand<'a>>,
Element-wise greater-or-equal comparison with another DataFrame or scalar.
Matches pd.DataFrame.ge(other).
Sourcepub fn lt<'a, O>(&self, other: O) -> Result<Self, FrameError>where
O: Into<DataFrameComparisonOperand<'a>>,
pub fn lt<'a, O>(&self, other: O) -> Result<Self, FrameError>where
O: Into<DataFrameComparisonOperand<'a>>,
Element-wise less-than comparison with another DataFrame or scalar.
Matches pd.DataFrame.lt(other).
Sourcepub fn le<'a, O>(&self, other: O) -> Result<Self, FrameError>where
O: Into<DataFrameComparisonOperand<'a>>,
pub fn le<'a, O>(&self, other: O) -> Result<Self, FrameError>where
O: Into<DataFrameComparisonOperand<'a>>,
Element-wise less-or-equal comparison with another DataFrame or scalar.
Matches pd.DataFrame.le(other).
Sourcepub fn get_dummies(&self, columns: &[&str]) -> Result<Self, FrameError>
pub fn get_dummies(&self, columns: &[&str]) -> Result<Self, FrameError>
One-hot encode specified columns.
Matches pd.get_dummies(df, columns). Creates indicator columns
for each unique value in the specified columns, prefixed with
{column_name}_{value}. Original columns are removed.
If columns is empty, all Utf8 columns are encoded.
Sourcepub fn get_dummies_with_options(
&self,
columns: &[&str],
prefix_sep: &str,
dummy_na: bool,
drop_first: bool,
) -> Result<Self, FrameError>
pub fn get_dummies_with_options( &self, columns: &[&str], prefix_sep: &str, dummy_na: bool, drop_first: bool, ) -> Result<Self, FrameError>
One-hot encode columns with full pandas 2.2 option parity.
Matches pd.get_dummies(df, columns=..., prefix_sep='_', dummy_na=False, drop_first=False).
prefix_sepjoins the source column name to the value (pandas default'_').dummy_naadds an{col}{sep}nanindicator column marking null values in the source column.drop_firstdrops the first indicator column for each encoded source column (discovery order), avoiding the dummy-variable trap.
Sourcepub fn from_dummies(
&self,
sep: Option<&str>,
default_category: Option<&str>,
) -> Result<Self, FrameError>
pub fn from_dummies( &self, sep: Option<&str>, default_category: Option<&str>, ) -> Result<Self, FrameError>
Convert dummy (one-hot encoded) columns back into categorical / string columns.
Matches pd.from_dummies(df, sep=..., default_category=...).
§Errors
Returns FrameError::CompatibilityRejected if:
sepis given and any column name does not contain the separator.- Any row contains multiple 1s.
- Any row contains no 1s and no
default_categoryis provided.
Sourcepub fn lreshape(
&self,
groups: &BTreeMap<String, Vec<String>>,
dropna: bool,
) -> Result<Self, FrameError>
pub fn lreshape( &self, groups: &BTreeMap<String, Vec<String>>, dropna: bool, ) -> Result<Self, FrameError>
Reshape wide-format data to long format by grouping specified columns into target columns.
Matches pd.lreshape(df, groups, dropna=...).
groups: mapping of target column name to list of wide source column names.
All lists in groups must have identical lengths.
§Errors
Returns FrameError::CompatibilityRejected if the group column lists do not have equal lengths.
Sourcepub fn wide_to_long(
&self,
stubnames: &[&str],
i: &[&str],
j: &str,
sep: &str,
suffix: &str,
) -> Result<Self, FrameError>
pub fn wide_to_long( &self, stubnames: &[&str], i: &[&str], j: &str, sep: &str, suffix: &str, ) -> Result<Self, FrameError>
Reshape wide DataFrame to long format.
Matches pd.wide_to_long(df, stubnames, i, j, sep, suffix).
Sourcepub fn squeeze(&self, axis: usize) -> Result<Series, Self>
pub fn squeeze(&self, axis: usize) -> Result<Series, Self>
Squeeze: pandas-named alias for squeeze_to_series.
Matches pd.DataFrame.squeeze(axis).
Sourcepub fn get_column(&self, key: &str) -> Series
pub fn get_column(&self, key: &str) -> Series
Get a column by name with a default if not found.
Matches pd.DataFrame.get(key, default). Returns the column
as a Series, or a default Series of NaN values.
Sourcepub fn where_mask_df(
&self,
cond_df: &Self,
other: &Scalar,
) -> Result<Self, FrameError>
pub fn where_mask_df( &self, cond_df: &Self, other: &Scalar, ) -> Result<Self, FrameError>
Replace values where condition DataFrame is True with other.
Matches pd.DataFrame.where(cond, other) with a DataFrame condition.
Where cond_df is True, keep the original value; where False, use other.
Sourcepub fn mask_df(
&self,
cond_df: &Self,
other: &Scalar,
) -> Result<Self, FrameError>
pub fn mask_df( &self, cond_df: &Self, other: &Scalar, ) -> Result<Self, FrameError>
Replace values where condition DataFrame is False with other.
Matches pd.DataFrame.mask(cond, other) with a DataFrame condition.
Inverse of where_mask_df: where cond_df is True, replace with other.
Sourcepub fn assign_column(
&self,
name: &str,
values: Vec<Scalar>,
) -> Result<Self, FrameError>
pub fn assign_column( &self, name: &str, values: Vec<Scalar>, ) -> Result<Self, FrameError>
Set or replace a column by name with given values.
Matches pd.DataFrame.assign(**kwargs) for single-column assignment.
If the column already exists, it is replaced. Otherwise it is appended.
Sourcepub fn pct_change(&self, periods: i64) -> Result<Self, FrameError>
pub fn pct_change(&self, periods: i64) -> Result<Self, FrameError>
Percentage change per column.
Matches pd.DataFrame.pct_change(periods).
Sourcepub fn pct_change_with_fill(
&self,
periods: i64,
fill_method: Option<&str>,
limit: Option<usize>,
) -> Result<Self, FrameError>
pub fn pct_change_with_fill( &self, periods: i64, fill_method: Option<&str>, limit: Option<usize>, ) -> Result<Self, FrameError>
Percentage change per column with fill options.
Matches pd.DataFrame.pct_change(periods, fill_method=..., limit=...).
Sourcepub fn ffill(&self, limit: Option<usize>) -> Result<Self, FrameError>
pub fn ffill(&self, limit: Option<usize>) -> Result<Self, FrameError>
Forward-fill missing values per column.
Matches pd.DataFrame.ffill(). Applies to all columns.
Sourcepub fn ffill_axis1(&self, limit: Option<usize>) -> Result<Self, FrameError>
pub fn ffill_axis1(&self, limit: Option<usize>) -> Result<Self, FrameError>
Forward-fill missing values across columns for each row.
Matches pd.DataFrame.ffill(axis=1).
Sourcepub fn bfill(&self, limit: Option<usize>) -> Result<Self, FrameError>
pub fn bfill(&self, limit: Option<usize>) -> Result<Self, FrameError>
Back-fill missing values per column.
Matches pd.DataFrame.bfill(). Applies to all columns.
Sourcepub fn pad(&self, limit: Option<usize>) -> Result<Self, FrameError>
pub fn pad(&self, limit: Option<usize>) -> Result<Self, FrameError>
Deprecated pandas alias for Self::ffill. Matches
pd.DataFrame.pad(limit=None). Per br-frankenpandas-qn0bj — pandas
kept pad for backwards compatibility after promoting ffill.
Sourcepub fn backfill(&self, limit: Option<usize>) -> Result<Self, FrameError>
pub fn backfill(&self, limit: Option<usize>) -> Result<Self, FrameError>
Deprecated pandas alias for Self::bfill. Matches
pd.DataFrame.backfill(limit=None). Per br-frankenpandas-qn0bj.
Sourcepub fn bool(&self) -> Result<bool, FrameError>
pub fn bool(&self) -> Result<bool, FrameError>
pandas-named alias for Self::bool_. Matches pd.DataFrame.bool().
Per br-frankenpandas-qn0bj. bool is a Rust keyword in type
position; the public name uses the raw-identifier form so callers
from Rust write df.r#bool(). The Python FFI surface exposes it as
bare bool.
Sourcepub fn bfill_axis1(&self, limit: Option<usize>) -> Result<Self, FrameError>
pub fn bfill_axis1(&self, limit: Option<usize>) -> Result<Self, FrameError>
Back-fill missing values across columns for each row.
Matches pd.DataFrame.bfill(axis=1).
Sourcepub fn interpolate(&self) -> Result<Self, FrameError>
pub fn interpolate(&self) -> Result<Self, FrameError>
Linearly interpolate missing values per numeric column.
Matches pd.DataFrame.interpolate(). Non-numeric columns are preserved.
Sourcepub fn interpolate_method(&self, method: &str) -> Result<Self, FrameError>
pub fn interpolate_method(&self, method: &str) -> Result<Self, FrameError>
Interpolate missing values per numeric column with the specified method.
Matches df.interpolate(method='linear'|'nearest'|'zero').
Sourcepub fn interpolate_with(
&self,
method: &str,
limit: Option<usize>,
limit_direction: Option<&str>,
limit_area: Option<&str>,
) -> Result<Self, FrameError>
pub fn interpolate_with( &self, method: &str, limit: Option<usize>, limit_direction: Option<&str>, limit_area: Option<&str>, ) -> Result<Self, FrameError>
Series::interpolate_with applied to every column, with pandas’
all-object rejection (fvsao.5).
Sourcepub fn convert_dtypes(&self) -> Result<Self, FrameError>
pub fn convert_dtypes(&self) -> Result<Self, FrameError>
Convert dtypes to best-possible types.
Matches pd.DataFrame.convert_dtypes(): each column as
Series::convert_dtypes converts it - numbers and bools to pandas’
nullable dtypes, text left as text. It parsed numeric-looking text
into numbers (pandas keeps ['1', '2'] as strings; only to_numeric
parses) and left numbers unchanged.
Sourcepub fn convert_dtypes_with(
&self,
options: ConvertDtypes,
) -> Result<Self, FrameError>
pub fn convert_dtypes_with( &self, options: ConvertDtypes, ) -> Result<Self, FrameError>
Matches pd.DataFrame.convert_dtypes(infer_objects=, convert_string=, convert_integer=, convert_boolean=, convert_floating=): each column as convert_column_dtypes_with
retypes it (br-frankenpandas-di8vx).
Sourcepub fn append(&self, other: &Self) -> Result<Self, FrameError>
pub fn append(&self, other: &Self) -> Result<Self, FrameError>
Append rows from another DataFrame.
Uses outer join on columns, filling missing with NaN.
⚠️ REMOVED, not deprecated: pd.DataFrame.append raises
AttributeError on 2.2.3 (deprecated in 1.4, dropped in 2.0). The
pandas spelling is pd.concat([a, b]). FP superset, not parity.
Sourcepub fn with_columns_at_positions(&self, columns: Vec<Column>) -> Self
pub fn with_columns_at_positions(&self, columns: Vec<Column>) -> Self
This frame with its columns replaced, position for position, by
columns (names, order, axes and labels kept). Rebuilding by POSITION
keeps repeated column keys apart: a name-keyed map kept one column per
key, so df.round() of columns [‘a’, ‘a’, ‘b’] - or of a column
MultiIndex whose leaf names repeat, as a multi-function agg makes -
lost columns (br-frankenpandas-i17d4).
Sourcepub fn drop(&self, labels: &[&str], axis: usize) -> Result<Self, FrameError>
pub fn drop(&self, labels: &[&str], axis: usize) -> Result<Self, FrameError>
Drop labels from rows or columns.
Matches df.drop(labels, axis=0) for row removal or
df.drop(columns=['a','b']) for column removal.
When axis=0, removes rows whose index labels match the given labels.
When axis=1, removes columns by name.
Sourcepub fn drop_rows_int(&self, labels: &[i64]) -> Result<Self, FrameError>
pub fn drop_rows_int(&self, labels: &[i64]) -> Result<Self, FrameError>
Drop rows by integer index label (Int64).
Convenience for dropping rows with Int64 index labels.
Sourcepub fn truncate(
&self,
before: Option<&IndexLabel>,
after: Option<&IndexLabel>,
) -> Result<Self, FrameError>
pub fn truncate( &self, before: Option<&IndexLabel>, after: Option<&IndexLabel>, ) -> Result<Self, FrameError>
Truncate the DataFrame by index label range.
Matches df.truncate(before=..., after=...). Keeps rows where
the index label is >= before and <= after.
Sourcepub fn first(&self, offset: &str) -> Result<Self, FrameError>
pub fn first(&self, offset: &str) -> Result<Self, FrameError>
Select rows from the start of a DatetimeIndex up to an offset.
Matches pd.DataFrame.first(offset) where offset is a string like
“3D” (days), “1M” (months), “2Y” (years). Selects all rows whose
index label falls within the offset from the first index value.
Sourcepub fn first_offset(&self, offset: &str) -> Result<Self, FrameError>
pub fn first_offset(&self, offset: &str) -> Result<Self, FrameError>
Explicit alias for Self::first.
Sourcepub fn last(&self, offset: &str) -> Result<Self, FrameError>
pub fn last(&self, offset: &str) -> Result<Self, FrameError>
Select rows from the end of a DatetimeIndex backward by an offset.
Matches pd.DataFrame.last(offset) where offset is a string like
“3D” (days), “1M” (months), “2Y” (years).
§Panics
Panics if the DataFrame reports non-empty but its index has no last label, which indicates internal index corruption.
Sourcepub fn last_offset(&self, offset: &str) -> Result<Self, FrameError>
pub fn last_offset(&self, offset: &str) -> Result<Self, FrameError>
Explicit alias for Self::last.
Per br-frankenpandas-a79h9: the missing-last-label case is reported as a CompatibilityRejected error rather than a panic, so callers can recover from inconsistent frame state instead of crashing.
Sourcepub fn insert(
&self,
loc: usize,
name: impl Into<String>,
column: Column,
) -> Result<Self, FrameError>
pub fn insert( &self, loc: usize, name: impl Into<String>, column: Column, ) -> Result<Self, FrameError>
Insert a column at a specific position.
Matches df.insert(loc, column, value). The column is placed at
position loc (0-indexed) in the column order.
Sourcepub fn insert_allow_duplicates(
&self,
loc: usize,
name: impl Into<String>,
column: Column,
allow_duplicates: bool,
) -> Result<Self, FrameError>
pub fn insert_allow_duplicates( &self, loc: usize, name: impl Into<String>, column: Column, allow_duplicates: bool, ) -> Result<Self, FrameError>
Insert a column at a specific position, optionally allowing duplicate labels.
Matches df.insert(loc, column, value, allow_duplicates=...).
Sourcepub fn isetitem(&self, loc: usize, column: Column) -> Result<Self, FrameError>
pub fn isetitem(&self, loc: usize, column: Column) -> Result<Self, FrameError>
Replace the column at a specific integer position.
Matches pd.DataFrame.isetitem(loc, value) for a single column. This
keeps the existing column label at loc and installs a new column array
rather than mutating the old array in place.
Sourcepub fn isetitem_values(
&self,
loc: usize,
values: Vec<Scalar>,
) -> Result<Self, FrameError>
pub fn isetitem_values( &self, loc: usize, values: Vec<Scalar>, ) -> Result<Self, FrameError>
Replace the column at loc from scalar values.
Convenience arraylike form for Self::isetitem.
Sourcepub fn isetitem_scalar(
&self,
loc: usize,
value: Scalar,
) -> Result<Self, FrameError>
pub fn isetitem_scalar( &self, loc: usize, value: Scalar, ) -> Result<Self, FrameError>
Replace the column at loc with a scalar broadcast across every row.
Convenience scalar form for Self::isetitem.
Sourcepub fn pop(&self, name: &str) -> Result<(Series, Self), FrameError>
pub fn pop(&self, name: &str) -> Result<(Series, Self), FrameError>
Remove and return a column as a Series.
Matches col = df.pop('column_name'). Returns the removed column
as a Series and the modified DataFrame (since we use immutable semantics).
Sourcepub fn replace(
&self,
replacements: &[(Scalar, Scalar)],
) -> Result<Self, FrameError>
pub fn replace( &self, replacements: &[(Scalar, Scalar)], ) -> Result<Self, FrameError>
Replace values element-wise across all columns.
Matches df.replace(to_replace, value). Applies scalar-to-scalar
replacement to every cell in the DataFrame.
Sourcepub fn replace_dict(
&self,
per_column: &BTreeMap<String, Vec<(Scalar, Scalar)>>,
) -> Result<Self, FrameError>
pub fn replace_dict( &self, per_column: &BTreeMap<String, Vec<(Scalar, Scalar)>>, ) -> Result<Self, FrameError>
Replace values on a per-column basis.
Matches df.replace({'col': {old: new, ...}, ...}).
Each entry maps a column name to its replacement pairs. Columns not
listed in the map are left unchanged.
Sourcepub fn replace_regex(&self, pat: &str, repl: &str) -> Result<Self, FrameError>
pub fn replace_regex(&self, pat: &str, repl: &str) -> Result<Self, FrameError>
Replace string values matching a regex pattern across all columns.
Matches df.replace(regex=pat, value=repl). Only applies to
Utf8 columns; non-string columns are left unchanged.
Sourcepub fn replace_regex_cells(
&self,
pat: &str,
value: &Scalar,
) -> Result<Self, FrameError>
pub fn replace_regex_cells( &self, pat: &str, value: &Scalar, ) -> Result<Self, FrameError>
Series::replace_regex_cells over every text column: a string
cell the pattern finds becomes the non-string value whole
(br-frankenpandas-otatv).
Sourcepub fn align_on_index(
&self,
other: &Self,
mode: AlignMode,
) -> Result<(Self, Self), FrameError>
pub fn align_on_index( &self, other: &Self, mode: AlignMode, ) -> Result<(Self, Self), FrameError>
Align two DataFrames on their indices.
Matches df1.align(df2, join='outer'|'inner'|'left'|'right').
Returns a tuple of two DataFrames aligned to a common index.
Columns are unioned — missing columns filled with NaN.
Sourcepub fn align(
&self,
other: &Self,
mode: AlignMode,
) -> Result<(Self, Self), FrameError>
pub fn align( &self, other: &Self, mode: AlignMode, ) -> Result<(Self, Self), FrameError>
pandas-named alias for Self::align_on_index.
Matches pd.DataFrame.align(other, join=...) for index-axis alignment.
Sourcepub fn compare(&self, other: &Self) -> Result<Self, FrameError>
pub fn compare(&self, other: &Self) -> Result<Self, FrameError>
Compare two DataFrames element-wise, showing differences.
Matches df.compare(other). Returns a DataFrame with multi-level-like
columns showing self and other values where they differ.
Only rows and columns with at least one difference are included.
Sourcepub fn compare_with_result_names(
&self,
other: &Self,
result_names: (&str, &str),
) -> Result<Self, FrameError>
pub fn compare_with_result_names( &self, other: &Self, result_names: (&str, &str), ) -> Result<Self, FrameError>
Matches df.compare(other, result_names=(left, right)).
Sourcepub fn compare_with_options(
&self,
other: &Self,
result_names: (&str, &str),
keep_shape: bool,
keep_equal: bool,
) -> Result<Self, FrameError>
pub fn compare_with_options( &self, other: &Self, result_names: (&str, &str), keep_shape: bool, keep_equal: bool, ) -> Result<Self, FrameError>
Matches df.compare(other, keep_shape=..., keep_equal=..., result_names=(left, right)) for align_axis=1 (the default, columns
axis). keep_shape=true keeps every row and column (equal cells are
NaN, or the original value when keep_equal=true); keep_equal=true
renders equal cells as their value instead of NaN. (align_axis=0 row
stacking is tracked separately under br-frankenpandas-lqu84.)
Sourcepub fn compare_with_align_axis(
&self,
other: &Self,
result_names: (&str, &str),
keep_shape: bool,
keep_equal: bool,
align_axis: i64,
) -> Result<Self, FrameError>
pub fn compare_with_align_axis( &self, other: &Self, result_names: (&str, &str), keep_shape: bool, keep_equal: bool, align_axis: i64, ) -> Result<Self, FrameError>
Matches df.compare(other, align_axis=..., keep_shape=..., keep_equal=..., result_names=(left, right)).
align_axis=1 (default) lays self/other side by side as
col_self/col_other columns; align_axis=0 stacks them as a 2-level
row MultiIndex (label, result_name) over the original columns.
keep_shape/keep_equal behave as in pandas.
Sourcepub fn select_dtypes(
&self,
include: &[DType],
exclude: &[DType],
) -> Result<Self, FrameError>
pub fn select_dtypes( &self, include: &[DType], exclude: &[DType], ) -> Result<Self, FrameError>
Select columns by data type.
Matches df.select_dtypes(include=['float64'], exclude=['bool']).
Pass empty slices to not filter on that criterion.
Sourcepub fn select_dtypes_by_name(
&self,
include: &[&str],
exclude: &[&str],
) -> Result<Self, FrameError>
pub fn select_dtypes_by_name( &self, include: &[&str], exclude: &[&str], ) -> Result<Self, FrameError>
Select columns by pandas-style dtype alias names.
Matches df.select_dtypes(include='number', exclude='object') and
its list-of-strings form. Each alias expands to the corresponding
set of DType variants; unknown aliases return an error consistent
with pandas’ TypeError: data type '...' not understood.
Recognized aliases (the crate’s expand_dtype_alias table):
"number"→ Int64 + Float64 + Timedelta64,"integer"→ Int64 + Timedelta64 (numpy’s timedelta64 is a signed integer)"int","int64","Int64"→ Int64"floating","float","float64","Float64"→ Float64"bool","boolean"→ Bool"object"→ the object columns,"string"pandas’ string ones"category","timedelta","datetime"(naive),"complex"- a narrow numpy name (
"int32","uint8","float32") or its masked form ("Int32") → the columns of exactly that width, while the exact 64-bit names ("int64","int","float64","float") leave those out and the abstract ones ("number","integer","floating") keep them (fvsao.23).
Include and exclude overlap - pandas’ error - only on one canonical
type (select_dtype_canonical): ‘int’ beside ‘integer’ selects
the int64 columns that are not integers, none (it was refused;
br-frankenpandas-cmv2p).
Sourcepub fn filter_labels(
&self,
items: Option<&[&str]>,
like: Option<&str>,
regex: Option<&str>,
axis: usize,
) -> Result<Self, FrameError>
pub fn filter_labels( &self, items: Option<&[&str]>, like: Option<&str>, regex: Option<&str>, axis: usize, ) -> Result<Self, FrameError>
Filter rows or columns by label.
Matches df.filter(items, like, regex, axis).
items: exact label matchlike: substring matchregex: regex match
Only one of items/like/regex should be provided at a time. axis=0 filters rows by index label, axis=1 filters columns.
Sourcepub fn take_columns(&self, indices: &[usize]) -> Result<Self, FrameError>
pub fn take_columns(&self, indices: &[usize]) -> Result<Self, FrameError>
Helper for selecting columns by normalized non-negative positional indices.
Used by df.take(indices, axis=1) after negative indices have been resolved.
Sourcepub fn isin(&self, values: &[Scalar]) -> Result<Self, FrameError>
pub fn isin(&self, values: &[Scalar]) -> Result<Self, FrameError>
Return a boolean DataFrame showing whether each element is in values.
Matches df.isin(values).
Sourcepub fn isin_dict(
&self,
per_column: &BTreeMap<String, Vec<Scalar>>,
) -> Result<Self, FrameError>
pub fn isin_dict( &self, per_column: &BTreeMap<String, Vec<Scalar>>, ) -> Result<Self, FrameError>
Element-wise membership test with per-column value sets.
Matches df.isin({'col': [v1, v2], ...}). Each column is tested
against its own set of allowed values. Columns not in per_column
get all-False.
Sourcepub fn equals(&self, other: &Self) -> bool
pub fn equals(&self, other: &Self) -> bool
Check whether this DataFrame is identical to another.
Matches df.equals(other). Compares shape, column names, index, and values.
Sourcepub fn assert_equals(
&self,
other: &Self,
options: &AssertEqualOptions,
) -> Result<(), AssertionError>
pub fn assert_equals( &self, other: &Self, options: &AssertEqualOptions, ) -> Result<(), AssertionError>
Assert that this DataFrame is equal to another according to the specified options (matching pandas.testing.assert_frame_equal).
§Errors
Returns testing::AssertionError if the DataFrames are not equal according to the options.
Sourcepub fn first_valid_index(&self) -> Option<IndexLabel>
pub fn first_valid_index(&self) -> Option<IndexLabel>
Return the index label of the first non-null row (checks all columns).
Matches df.first_valid_index().
Sourcepub fn last_valid_index(&self) -> Option<IndexLabel>
pub fn last_valid_index(&self) -> Option<IndexLabel>
Return the index label of the last non-null row (checks all columns).
Matches df.last_valid_index().
Sourcepub fn asof(
&self,
label: &IndexLabel,
subset: Option<&[&str]>,
) -> Result<Series, FrameError>
pub fn asof( &self, label: &IndexLabel, subset: Option<&[&str]>, ) -> Result<Series, FrameError>
Return the last row(s) without any NaNs before where.
Matches df.asof(where, subset=...).
Sourcepub fn crosstab(
index_series: &Series,
columns_series: &Series,
) -> Result<Self, FrameError>
pub fn crosstab( index_series: &Series, columns_series: &Series, ) -> Result<Self, FrameError>
Compute a crosstab (contingency table) from two columns.
Matches pd.crosstab(index, columns). Counts occurrences of each
(row, col) combination.
Sourcepub fn crosstab_normalize(
index_series: &Series,
columns_series: &Series,
normalize: &str,
) -> Result<Self, FrameError>
pub fn crosstab_normalize( index_series: &Series, columns_series: &Series, normalize: &str, ) -> Result<Self, FrameError>
Crosstab with optional normalization.
Matches pd.crosstab(index, columns, normalize=...).
normalize: “all” divides by grand total, “index” divides by row totals,
“columns” divides by column totals.
Sourcepub fn explode(&self, column: &str, sep: &str) -> Result<Self, FrameError>
pub fn explode(&self, column: &str, sep: &str) -> Result<Self, FrameError>
Explode a column containing delimited strings into multiple rows.
Matches df.explode(column) for string columns. Splits the specified
column by sep and replicates other columns accordingly.
Sourcepub fn explode_with_ignore_index(
&self,
column: &str,
sep: &str,
ignore_index: bool,
) -> Result<Self, FrameError>
pub fn explode_with_ignore_index( &self, column: &str, sep: &str, ignore_index: bool, ) -> Result<Self, FrameError>
Explode a column containing delimited strings into multiple rows.
Matches df.explode(column, ignore_index=...) for the current
string-delimited explode surface.
Sourcepub fn explode_lists(
&self,
columns: &[&str],
ignore_index: bool,
) -> Result<Self, FrameError>
pub fn explode_lists( &self, columns: &[&str], ignore_index: bool, ) -> Result<Self, FrameError>
pandas’ df.explode(columns, ignore_index) over list cells
(fvsao.33): a row whose cell in columns is a list becomes one row
per item (an empty list one row of NaN), a non-list value stays one
row; several columns must hold lists of the same length in each row
(pandas’ ValueError otherwise). The other columns repeat with their
dtypes, the exploded object ones are object, as pandas’, and the index
repeats its labels (a fresh RangeIndex with ignore_index). A column
of another dtype holds no list and keeps its dtype, as pandas’ (it
came back object, br-frankenpandas-xxryq).
Sourcepub fn xs(&self, key: &IndexLabel) -> Result<Self, FrameError>
pub fn xs(&self, key: &IndexLabel) -> Result<Self, FrameError>
Select a cross-section of rows by index label.
Matches df.xs(key). Returns all rows whose index matches key.
Sourcepub fn xs_level(
&self,
key: &IndexLabel,
level: usize,
) -> Result<Self, FrameError>
pub fn xs_level( &self, key: &IndexLabel, level: usize, ) -> Result<Self, FrameError>
Select a cross-section of rows by a specific row-MultiIndex level.
Matches df.xs(key, level=...) and drops the selected level from the
resulting row index.
Sourcepub fn droplevel(&self) -> Result<Self, FrameError>
pub fn droplevel(&self) -> Result<Self, FrameError>
Drop the index level (reset to default integer index).
Matches df.droplevel(0) for single-level index.
Sourcepub fn droplevel_level(&self, level: usize) -> Result<Self, FrameError>
pub fn droplevel_level(&self, level: usize) -> Result<Self, FrameError>
Drop a specific row-MultiIndex level.
Sourcepub fn swaplevel(&self) -> Self
pub fn swaplevel(&self) -> Self
Swap levels of a composite string index.
Matches df.swaplevel(). For indexes of the form “(a, b)”, swaps
the components to produce “(b, a)”. Non-composite labels are returned
unchanged.
Sourcepub fn swaplevel_levels(&self, i: usize, j: usize) -> Result<Self, FrameError>
pub fn swaplevel_levels(&self, i: usize, j: usize) -> Result<Self, FrameError>
Swap two row-MultiIndex levels.
Sourcepub fn reorder_levels(&self, order: &[usize]) -> Result<Self, FrameError>
pub fn reorder_levels(&self, order: &[usize]) -> Result<Self, FrameError>
Reorder row-MultiIndex levels.