class_docstr: Namespace for bin related expressions.
class_docstr_tok: ["Namespace","for","bin","related","expressions","."]
docstr: Check if binaries in Series contain a binary substring.
  
  Parameters
  ----------
  literal
      The binary substring to look for
  
  Returns
  -------
  Expr
      Expression of data type :class:`Boolean`.
  
  See Also
  --------
  starts_with : Check if the binary substring exists at the start
  ends_with : Check if the binary substring exists at the end
  
  Examples
  --------
  >>> colors = pl.DataFrame(
  ...     {
  ...         "name": ["black", "yellow", "blue"],
  ...         "code": [b"\x00\x00\x00", b"\xff\xff\x00", b"\x00\x00\xff"],
  ...         "lit": [b"\x00", b"\xff\x00", b"\xff\xff"],
  ...     }
  ... )
  >>> colors.select(
  ...     "name",
  ...     pl.col("code").bin.contains(b"\xff").alias("contains_with_lit"),
  ...     pl.col("code").bin.contains(pl.col("lit")).alias("contains_with_expr"),
  ... )
  shape: (3, 3)
  ┌────────┬───────────────────┬────────────────────┐
  │ name   ┆ contains_with_lit ┆ contains_with_expr │
  │ ---    ┆ ---               ┆ ---                │
  │ str    ┆ bool              ┆ bool               │
  ╞════════╪═══════════════════╪════════════════════╡
  │ black  ┆ false             ┆ true               │
  │ yellow ┆ true              ┆ true               │
  │ blue   ┆ true              ┆ false              │
  └────────┴───────────────────┴────────────────────┘
docstr_tok: ["Check","if","binaries","in","Series","contain","a","binary","substring",".","Parameters","--","--","--","--","--","literal","The","binary","substring","to","look","for","Returns","--","--","--","-","Expr","Expression","of","data","type",":","class",":","`","Boolean","`",".","See","Also","--","--","--","--","starts_with",":","Check","if","the","binary","substring","exists","at","the","start","ends_with",":","Check","if","the","binary","substring","exists","at","the","end","Examples","--","--","--","--",">",">",">","colors","=","pl.DataFrame","(","...","{","...","``","name","''",":","[","``","black","''",",","``","yellow","''",",","``","blue","''","]",",","...","``","code","''",":","[","b","''","\\x00\\x00\\x00","''",",","b","''","\\xff\\xff\\x00","''",",","b","''","\\x00\\x00\\xff","''","]",",","...","``","lit","''",":","[","b","''","\\x00","''",",","b","''","\\xff\\x00","''",",","b","''","\\xff\\xff","''","]",",","...","}","...",")",">",">",">","colors.select","(","...","``","name","''",",","...","pl.col","(","``","code","''",")",".bin.contains","(","b","''","\\xff","''",")",".alias","(","``","contains_with_lit","''",")",",","...","pl.col","(","``","code","''",")",".bin.contains","(","pl.col","(","``","lit","''",")",")",".alias","(","``","contains_with_expr","''",")",",","...",")","shape",":","(","3",",","3",")","\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510","\u2502","name","\u2506","contains_with_lit","\u2506","contains_with_expr","\u2502","\u2502","--","-","\u2506","--","-","\u2506","--","-","\u2502","\u2502","str","\u2506","bool","\u2506","bool","\u2502","\u255e\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u256a\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u256a\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2561","\u2502","black","\u2506","false","\u2506","true","\u2502","\u2502","yellow","\u2506","true","\u2506","true","\u2502","\u2502","blue","\u2506","true","\u2506","false","\u2502","\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518"]
code: def contains(self, literal: IntoExpr) -> Expr:
      r"""
      Check if binaries in Series contain a binary substring.
  
      Parameters
      ----------
      literal
          The binary substring to look for
  
      Returns
      -------
      Expr
          Expression of data type :class:`Boolean`.
  
      See Also
      --------
      starts_with : Check if the binary substring exists at the start
      ends_with : Check if the binary substring exists at the end
  
      Examples
      --------
      >>> colors = pl.DataFrame(
      ...     {
      ...         "name": ["black", "yellow", "blue"],
      ...         "code": [b"\x00\x00\x00", b"\xff\xff\x00", b"\x00\x00\xff"],
      ...         "lit": [b"\x00", b"\xff\x00", b"\xff\xff"],
      ...     }
      ... )
      >>> colors.select(
      ...     "name",
      ...     pl.col("code").bin.contains(b"\xff").alias("contains_with_lit"),
      ...     pl.col("code").bin.contains(pl.col("lit")).alias("contains_with_expr"),
      ... )
      shape: (3, 3)
      ┌────────┬───────────────────┬────────────────────┐
      │ name   ┆ contains_with_lit ┆ contains_with_expr │
      │ ---    ┆ ---               ┆ ---                │
      │ str    ┆ bool              ┆ bool               │
      ╞════════╪═══════════════════╪════════════════════╡
      │ black  ┆ false             ┆ true               │
      │ yellow ┆ true              ┆ true               │
      │ blue   ┆ true              ┆ false              │
      └────────┴───────────────────┴────────────────────┘
      """
      literal = parse_as_expression(literal, str_as_lit=True)
      return wrap_expr(self._pyexpr.bin_contains(literal))
  
file_path: polars/py-polars/polars/expr/binary.py
imports: from __future__ import annotations
  from typing import TYPE_CHECKING
  from polars.utils._parse_expr_input import parse_as_expression
  from polars.utils._wrap import wrap_expr
label_desc: Use image node_id 2 for calling the ExprBinaryNameSpace obj's underlying member method code with example usage: obj.contains(literal) and returns: wrap_expr