pub fn join<I, S>(
        &self,
        other: &DataFrame,
        left_on: I,
        right_on: I,
        how: JoinType,
        suffix: Option<String>,
    ) -> Result<DataFrame>
    where
        I: IntoIterator<Item = S>,
        S: AsRef<str>,
    {
        #[cfg(feature = "cross_join")]
        if let JoinType::Cross = how {
            return self.cross_join(other, suffix);
        }
        let selected_left = self.select_series(left_on)?;
        let selected_right = other.select_series(right_on)?;
        self._join_impl(
            other,
            selected_left,
            selected_right,
            how,
            suffix,
            None,
            true,
            false,
        )
    }
/// Generic join method. Can be used to join on multiple columns.
///
/// # Example
///
/// ```no_run
/// # use polars_core::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)?;
/// assert_eq!(df3.shape(), (3, 3));
/// println!("{}", df3);
/// # Ok::<(), PolarsError>(())
/// ```
///
/// Output:
///
/// ```text
/// shape: (3, 3)
/// +--------+----------------------+---------------------+
/// | Fruit  | Phosphorus (mg/100g) | Potassium (mg/100g) |
/// | ---    | ---                  | ---                 |
/// | str    | i32                  | i32                 |
/// +========+======================+=====================+
/// | Apple  | 11                   | 107                 |
/// +--------+----------------------+---------------------+
/// | Banana | 22                   | 358                 |
/// +--------+----------------------+---------------------+
/// | Pear   | 12                   | 115                 |
/// +--------+----------------------+---------------------+
/// ```
Generic join method. Can be used to join on multiple columns.
Generic join method . Can be used to join on multiple columns .
pub fn join<I, S>(
        &self,
        other: &DataFrame,
        left_on: I,
        right_on: I,
        how: JoinType,
        suffix: Option<String>,
    ) -> Result<DataFrame>
    where
        I: IntoIterator<Item = S>,
        S: AsRef<str>,
    {
        #[cfg(feature = "cross_join")]
        if let JoinType::Cross = how {
            return self.cross_join(other, suffix);
        }
        let selected_left = self.select_series(left_on)?;
        let selected_right = other.select_series(right_on)?;
        self._join_impl(
            other,
            selected_left,
            selected_right,
            how,
            suffix,
            None,
            true,
            false,
        )
    }
pub fn join < I , S > ( & self , other : & DataFrame , left_on : I , right_on : I , how : JoinType , suffix : Option < String > , ) -> Result < DataFrame > where I : IntoIterator < Item = S > , S : AsRef < str > , { # [ cfg ( feature " " ) ] if let JoinType :: Cross = how { return self . cross_join ( other , suffix ) ; } let selected_left = self . select_series ( left_on ) ? ; let selected_right = other . select_series ( right_on ) ? ; self . _join_impl ( other , selected_left , selected_right , how , suffix , None , true , false , ) }
Generic join method.
Generic join method .
&self
other
&DataFrame
left_on
I
right_on
I
how
JoinType
suffix
Option<String>
&self
other
&DataFrame
left_on
I
right_on
I
how
JoinType
suffix
Option<String>
example
None
use polars_core::prelude::*;
None
ok::<(), polarserror>(())
None