Skip to content

Commit

Permalink
WIP add missing includes for doctests
Browse files Browse the repository at this point in the history
  • Loading branch information
orlp committed Oct 19, 2023
1 parent 747217b commit f766fa9
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 16 deletions.
6 changes: 5 additions & 1 deletion crates/polars-ops/src/frame/join/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,13 @@ pub trait DataFrameJoinOps: IntoDf {
///
/// ```no_run
/// # use polars_core::prelude::*;
/// # use polars_ops::prelude::*;
/// let df1: DataFrame = df!("Fruit" => &["Apple", "Banana", "Pear"],
/// "Phosphorus (mg/100g)" => &[11, 22, 12])?;
/// let df2: DataFrame = df!("Name" => &["Apple", "Banana", "Pear"],
/// "Potassium (mg/100g)" => &[107, 358, 115])?;
///
/// let df3: DataFrame = df1.join(&df2, ["Fruit"], ["Name"], JoinType::Inner, None)?;
/// let df3: DataFrame = df1.join(&df2, ["Fruit"], ["Name"], JoinArgs::new(JoinType::Inner))?;
/// assert_eq!(df3.shape(), (3, 3));
/// println!("{}", df3);
/// # Ok::<(), PolarsError>(())
Expand Down Expand Up @@ -369,6 +370,7 @@ pub trait DataFrameJoinOps: IntoDf {
///
/// ```
/// # use polars_core::prelude::*;
/// # use polars_ops::prelude::*;
/// fn join_dfs(left: &DataFrame, right: &DataFrame) -> PolarsResult<DataFrame> {
/// left.inner_join(right, ["join_column_left"], ["join_column_right"])
/// }
Expand All @@ -391,6 +393,7 @@ pub trait DataFrameJoinOps: IntoDf {
///
/// ```no_run
/// # use polars_core::prelude::*;
/// # use polars_ops::prelude::*;
/// let df1: DataFrame = df!("Wavelength (nm)" => &[480.0, 650.0, 577.0, 1201.0, 100.0])?;
/// let df2: DataFrame = df!("Color" => &["Blue", "Yellow", "Red"],
/// "Wavelength nm" => &[480.0, 577.0, 650.0])?;
Expand Down Expand Up @@ -433,6 +436,7 @@ pub trait DataFrameJoinOps: IntoDf {
///
/// ```
/// # use polars_core::prelude::*;
/// # use polars_ops::prelude::*;
/// fn join_dfs(left: &DataFrame, right: &DataFrame) -> PolarsResult<DataFrame> {
/// left.outer_join(right, ["join_column_left"], ["join_column_right"])
/// }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
//! # Examples
//!
//! ```
//! # use polars_ops::prelude::*;
//! let mut hllp = HyperLogLog::new();
//! hllp.add(&12345);
//! hllp.add(&23456);
Expand Down
2 changes: 2 additions & 0 deletions crates/polars-plan/src/dsl/functions/temporal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ pub fn datetime(args: DatetimeArgs) -> Expr {
/// their default value of `lit(0)`, as demonstrated below.
///
/// ```
/// # use polars_plan::prelude::*;
/// let args = DurationArgs {
/// days: lit(5),
/// hours: col("num_hours"),
Expand All @@ -165,6 +166,7 @@ pub fn datetime(args: DatetimeArgs) -> Expr {
/// ```
/// If you prefer builder syntax, `with_*` methods are also available.
/// ```
/// # use polars_plan::prelude::*;
/// let args = DurationArgs::new().with_weeks(lit(42)).with_hours(lit(84));
/// ```
#[derive(Debug, Clone)]
Expand Down
16 changes: 1 addition & 15 deletions crates/polars-plan/src/dsl/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1141,6 +1141,7 @@ impl Expr {
/// Keep the original root name
///
/// ```rust,no_run
/// # use polars_core::prelude::*;
/// # use polars_plan::prelude::*;
/// fn example(df: LazyFrame) -> LazyFrame {
/// df.select([
Expand Down Expand Up @@ -1181,21 +1182,6 @@ impl Expr {
/// Exclude a column from a wildcard/regex selection.
///
/// You may also use regexes in the exclude as long as they start with `^` and end with `$`/
///
/// # Example
///
/// ```rust
/// use polars_core::prelude::*;
/// use polars_lazy::prelude::*;
///
/// // Select all columns except foo.
/// fn example(df: DataFrame) -> LazyFrame {
/// df.lazy()
/// .select(&[
/// col("*").exclude(&["foo"])
/// ])
/// }
/// ```
pub fn exclude(self, columns: impl IntoVec<String>) -> Expr {
let v = columns
.into_vec()
Expand Down

0 comments on commit f766fa9

Please sign in to comment.