diff --git a/py-polars/polars/dataframe/frame.py b/py-polars/polars/dataframe/frame.py index 1812b073bbe4..141718c9b9ce 100644 --- a/py-polars/polars/dataframe/frame.py +++ b/py-polars/polars/dataframe/frame.py @@ -3907,9 +3907,9 @@ def estimated_size(self, unit: SizeUnit = "b") -> int | float: ... schema=[("x", pl.UInt32), ("y", pl.Float64), ("z", pl.String)], ... ) >>> df.estimated_size() - 25888898 + 28000000 >>> df.estimated_size("mb") - 24.689577102661133 + 26.702880859375 """ sz = self._df.estimated_size() return scale_bytes(sz, unit) diff --git a/py-polars/polars/expr/binary.py b/py-polars/polars/expr/binary.py index 1503493cea7d..16172ba97a72 100644 --- a/py-polars/polars/expr/binary.py +++ b/py-polars/polars/expr/binary.py @@ -206,17 +206,17 @@ def encode(self, encoding: TransferEncoding) -> Expr: ... ) >>> colors.with_columns( ... pl.col("code").bin.encode("hex").alias("code_encoded_hex"), - ... ) + ... ) # doctest: +IGNORE_RESULT shape: (3, 3) - ┌────────┬───────────────┬──────────────────┐ - │ name ┆ code ┆ code_encoded_hex │ - │ --- ┆ --- ┆ --- │ - │ str ┆ binary ┆ str │ - ╞════════╪═══════════════╪══════════════════╡ - │ black ┆ [binary data] ┆ 000000 │ - │ yellow ┆ [binary data] ┆ ffff00 │ - │ blue ┆ [binary data] ┆ 0000ff │ - └────────┴───────────────┴──────────────────┘ + ┌────────┬────────┬──────────────────┐ + │ name ┆ code ┆ code_encoded_hex │ + │ --- ┆ --- ┆ --- │ + │ str ┆ binary ┆ str │ + ╞════════╪════════╪══════════════════╡ + │ black ┆ b"" ┆ 000000 │ + │ yellow ┆ b"��" ┆ ffff00 │ + │ blue ┆ b"�" ┆ 0000ff │ + └────────┴────────┴──────────────────┘ """ if encoding == "hex": return wrap_expr(self._pyexpr.bin_hex_encode()) diff --git a/py-polars/polars/selectors.py b/py-polars/polars/selectors.py index 10a6a7e4d6b1..0793f5b9ee57 100644 --- a/py-polars/polars/selectors.py +++ b/py-polars/polars/selectors.py @@ -435,13 +435,13 @@ def binary() -> SelectorType: >>> df = pl.DataFrame({"a": [b"hello"], "b": ["world"], "c": [b"!"], "d": [":)"]}) >>> df shape: (1, 4) - ┌───────────────┬───────┬───────────────┬─────┐ - │ a ┆ b ┆ c ┆ d │ - │ --- ┆ --- ┆ --- ┆ --- │ - │ binary ┆ str ┆ binary ┆ str │ - ╞═══════════════╪═══════╪═══════════════╪═════╡ - │ [binary data] ┆ world ┆ [binary data] ┆ :) │ - └───────────────┴───────┴───────────────┴─────┘ + ┌──────────┬───────┬────────┬─────┐ + │ a ┆ b ┆ c ┆ d │ + │ --- ┆ --- ┆ --- ┆ --- │ + │ binary ┆ str ┆ binary ┆ str │ + ╞══════════╪═══════╪════════╪═════╡ + │ b"hello" ┆ world ┆ b"!" ┆ :) │ + └──────────┴───────┴────────┴─────┘ Select binary columns and export as a dict: