diff --git a/crates/polars-arrow/src/array/primitive/mod.rs b/crates/polars-arrow/src/array/primitive/mod.rs index dc37a1170aaf..0dc6992918fb 100644 --- a/crates/polars-arrow/src/array/primitive/mod.rs +++ b/crates/polars-arrow/src/array/primitive/mod.rs @@ -341,7 +341,7 @@ impl PrimitiveArray { /// This function returns a [`MutablePrimitiveArray`] (via [`std::sync::Arc::get_mut`]) iff both values /// and validity have not been cloned / are unique references to their underlying vectors. /// - /// This function is primarily used to re-use memory regions. + /// This function is primarily used to reuse memory regions. #[must_use] pub fn into_mut(self) -> Either> { use Either::*; @@ -467,7 +467,7 @@ impl PrimitiveArray { /// Fills this entire array with the given value, leaving the validity mask intact. /// - /// Re-uses the memory of the PrimitiveArray if possible. + /// Reuses the memory of the PrimitiveArray if possible. pub fn fill_with(mut self, value: T) -> Self { if let Some(values) = self.get_mut_values() { for x in values.iter_mut() { diff --git a/crates/polars-arrow/src/array/static_array_collect.rs b/crates/polars-arrow/src/array/static_array_collect.rs index 27f86fec1f5b..2da262cce3a0 100644 --- a/crates/polars-arrow/src/array/static_array_collect.rs +++ b/crates/polars-arrow/src/array/static_array_collect.rs @@ -552,7 +552,7 @@ impl ArrayFromIter> for BinaryViewArray { // fn try_arr_from_iter_trusted(iter: I) -> Result } -/// We use this to re-use the binary collect implementation for strings. +/// We use this to reuse the binary collect implementation for strings. /// # Safety /// The array must be valid UTF-8. unsafe fn into_utf8array(arr: BinaryArray) -> Utf8Array { diff --git a/crates/polars-compute/src/arity.rs b/crates/polars-compute/src/arity.rs index ec6c2e976c71..8fec0d3a513c 100644 --- a/crates/polars-compute/src/arity.rs +++ b/crates/polars-compute/src/arity.rs @@ -42,7 +42,7 @@ unsafe fn ptr_apply_binary_kernel O>( /// Applies a function to all the values (regardless of nullability). /// -/// May re-use the memory of the array if possible. +/// May reuse the memory of the array if possible. pub fn prim_unary_values(mut arr: PrimitiveArray, op: F) -> PrimitiveArray where I: NativeType, @@ -75,7 +75,7 @@ where /// Apply a binary function to all the values (regardless of nullability) /// in (lhs, rhs). Combines the validities with a bitand. /// -/// May re-use the memory of one of its arguments if possible. +/// May reuse the memory of one of its arguments if possible. pub fn prim_binary_values( mut lhs: PrimitiveArray, mut rhs: PrimitiveArray, diff --git a/crates/polars-json/src/ndjson/file.rs b/crates/polars-json/src/ndjson/file.rs index 0e47342274da..35700c1a6001 100644 --- a/crates/polars-json/src/ndjson/file.rs +++ b/crates/polars-json/src/ndjson/file.rs @@ -41,7 +41,7 @@ fn read_rows(reader: &mut R, rows: &mut [String], limit: usize) -> P /// /// This iterator is used to read chunks of an NDJSON in batches. /// This iterator is guaranteed to yield at least one row. -/// # Implementantion +/// # Implementation /// Advancing this iterator is IO-bounded, but does require parsing each byte to find end of lines. /// # Error /// Advancing this iterator errors iff the reader errors. diff --git a/crates/polars-json/src/ndjson/write.rs b/crates/polars-json/src/ndjson/write.rs index 10589cac3d80..90f202b02360 100644 --- a/crates/polars-json/src/ndjson/write.rs +++ b/crates/polars-json/src/ndjson/write.rs @@ -95,7 +95,7 @@ where /// /// There are two use-cases for this function: /// * to continue writing to its writer - /// * to re-use an internal buffer of its iterator + /// * to reuse an internal buffer of its iterator pub fn into_inner(self) -> (W, I) { (self.writer, self.iterator) } diff --git a/crates/polars-lazy/src/dsl/functions.rs b/crates/polars-lazy/src/dsl/functions.rs index 4252c48f3d2a..5642c02ddf12 100644 --- a/crates/polars-lazy/src/dsl/functions.rs +++ b/crates/polars-lazy/src/dsl/functions.rs @@ -32,7 +32,7 @@ pub(crate) fn concat_impl>( }; let lf = match &mut lf.logical_plan { - // re-use the same union + // reuse the same union LogicalPlan::Union { inputs: existing_inputs, options: opts, diff --git a/crates/polars-parquet/src/parquet/read/compression.rs b/crates/polars-parquet/src/parquet/read/compression.rs index fbe2ef938f82..d5ea2e8f400e 100644 --- a/crates/polars-parquet/src/parquet/read/compression.rs +++ b/crates/polars-parquet/src/parquet/read/compression.rs @@ -246,7 +246,7 @@ impl streaming_decompression::Decompressed for Page { /// A [`FallibleStreamingIterator`] that decompresses [`CompressedPage`] into [`DataPage`]. /// # Implementation /// This decompressor uses an internal [`Vec`] to perform decompressions which -/// is re-used across pages, so that a single allocation is required. +/// is reused across pages, so that a single allocation is required. /// If the pages are not compressed, the internal buffer is not used. pub struct BasicDecompressor>> { iter: _Decompressor, diff --git a/crates/polars-parquet/src/parquet/read/page/indexed_reader.rs b/crates/polars-parquet/src/parquet/read/page/indexed_reader.rs index e72bc5de82e1..8a37566e1456 100644 --- a/crates/polars-parquet/src/parquet/read/page/indexed_reader.rs +++ b/crates/polars-parquet/src/parquet/read/page/indexed_reader.rs @@ -30,7 +30,7 @@ pub struct IndexedPageReader { // buffer to read the whole page [header][data] into memory buffer: Vec, - // buffer to store the data [data] and re-use across pages + // buffer to store the data [data] and reuse across pages data_buffer: Vec, pages: VecDeque, diff --git a/crates/polars-plan/src/utils.rs b/crates/polars-plan/src/utils.rs index 7dd68dffba01..55686d6e9f37 100644 --- a/crates/polars-plan/src/utils.rs +++ b/crates/polars-plan/src/utils.rs @@ -116,7 +116,7 @@ pub fn has_aexpr_literal(current_node: Node, arena: &Arena) -> bool { } /// Can check if an expression tree has a matching_expr. This -/// requires a dummy expression to be created that will be used to patter match against. +/// requires a dummy expression to be created that will be used to pattern match against. pub(crate) fn has_expr(current_expr: &Expr, matches: F) -> bool where F: Fn(&Expr) -> bool, diff --git a/crates/polars-time/src/chunkedarray/string/strptime.rs b/crates/polars-time/src/chunkedarray/string/strptime.rs index abe6c2b3df8c..922f2accbac3 100644 --- a/crates/polars-time/src/chunkedarray/string/strptime.rs +++ b/crates/polars-time/src/chunkedarray/string/strptime.rs @@ -209,7 +209,7 @@ pub(super) fn fmt_len(fmt: &[u8]) -> Option { while let Some(&val) = iter.next() { match val { - b'%' => match iter.next().expect("invalid patter") { + b'%' => match iter.next().expect("invalid pattern") { b'Y' => cnt += 4, b'y' => cnt += 2, b'd' => cnt += 2, diff --git a/crates/polars/tests/it/lazy/group_by.rs b/crates/polars/tests/it/lazy/group_by.rs index 16459855ea3f..4e24e1d24fa8 100644 --- a/crates/polars/tests/it/lazy/group_by.rs +++ b/crates/polars/tests/it/lazy/group_by.rs @@ -9,7 +9,7 @@ use super::*; #[test] #[cfg(feature = "rank")] fn test_filter_sort_diff_2984() -> PolarsResult<()> { - // make sort that sort doest not oob if filter returns no values + // make sure that sort does not oob if filter returns no values let df = df![ "group"=> ["A" ,"A", "A", "B", "B", "B", "B"], "id"=> [1, 2, 1, 4, 5, 4, 6], diff --git a/docs/user-guide/concepts/data-types/overview.md b/docs/user-guide/concepts/data-types/overview.md index 30e7073bccc5..86c705605031 100644 --- a/docs/user-guide/concepts/data-types/overview.md +++ b/docs/user-guide/concepts/data-types/overview.md @@ -16,7 +16,7 @@ from Arrow, with the exception of `String` (this is actually `LargeUtf8`), `Cate | | `UInt64` | 64-bit unsigned integer. | | | `Float32` | 32-bit floating point. | | | `Float64` | 64-bit floating point. | -| Nested | `Struct` | A struct array is represented as a `Vec` and is useful to pack multiple/heterogenous values in a single column. | +| Nested | `Struct` | A struct array is represented as a `Vec` and is useful to pack multiple/heterogeneous values in a single column. | | | `List` | A list array contains a child array containing the list values and an offset array. (this is actually Arrow `LargeList` internally). | | Temporal | `Date` | Date representation, internally represented as days since UNIX epoch encoded by a 32-bit signed integer. | | | `Datetime` | Datetime representation, internally represented as microseconds since UNIX epoch encoded by a 64-bit signed integer. | @@ -41,6 +41,6 @@ Polars generally follows the IEEE 754 floating point standard for `Float32` and e.g. a sort or group by operation may canonicalize all zeroes to +0 and all NaNs to a positive NaN without payload for efficient equality checks. -Polars always attempts to provide reasonably accurate results for floating point computations, but does not provide guarantees +Polars always attempts to provide reasonably accurate results for floating point computations but does not provide guarantees on the error unless mentioned otherwise. Generally speaking 100% accurate results are infeasibly expensive to acquire (requiring much larger internal representations than 64-bit floats), and thus some error is always to be expected. diff --git a/docs/user-guide/expressions/structs.md b/docs/user-guide/expressions/structs.md index 61978bbc25e7..056c1b2e21b7 100644 --- a/docs/user-guide/expressions/structs.md +++ b/docs/user-guide/expressions/structs.md @@ -31,7 +31,7 @@ Quite unexpected an output, especially if coming from tools that do not have suc !!! note "Why `value_counts` returns a `Struct`" - Polars expressions always have a `Fn(Series) -> Series` signature and `Struct` is thus the data type that allows us to provide multiple columns as input/ouput of an expression. In other words, all expressions have to return a `Series` object, and `Struct` allows us to stay consistent with that requirement. + Polars expressions always have a `Fn(Series) -> Series` signature and `Struct` is thus the data type that allows us to provide multiple columns as input/output of an expression. In other words, all expressions have to return a `Series` object, and `Struct` allows us to stay consistent with that requirement. ## Structs as `dict`s diff --git a/docs/user-guide/migration/pandas.md b/docs/user-guide/migration/pandas.md index d0d2f292e447..164cfd389176 100644 --- a/docs/user-guide/migration/pandas.md +++ b/docs/user-guide/migration/pandas.md @@ -368,7 +368,7 @@ df.with_columns( ) ``` -If you need the schema in the functions that generate the expressions, you an utilize a single `pipe`: +If you need the schema in the functions that generate the expressions, you can utilize a single `pipe`: ```python from collections import OrderedDict diff --git a/py-polars/polars/dataframe/frame.py b/py-polars/polars/dataframe/frame.py index 46bd46c26f41..f4c62545f866 100644 --- a/py-polars/polars/dataframe/frame.py +++ b/py-polars/polars/dataframe/frame.py @@ -2903,7 +2903,7 @@ def write_excel( "A2" indicates the split occurs at the top-left of cell A2, which is the equivalent of (1, 0). * If (row, col, top_row, top_col) are supplied, the panes are split based on - the `row` and `col`, and the scrolling region is inititalized to begin at + the `row` and `col`, and the scrolling region is initialized to begin at the `top_row` and `top_col`. Thus, to freeze only the top row and have the scrolling region begin at row 10, column D (5th col), supply (1, 0, 9, 4). Using cell notation for (row, col), supplying ("A2", 9, 4) is equivalent. diff --git a/py-polars/polars/io/database.py b/py-polars/polars/io/database.py index 8ed49bd69216..fe05ef1029dc 100644 --- a/py-polars/polars/io/database.py +++ b/py-polars/polars/io/database.py @@ -151,7 +151,7 @@ def __exit__( exc_val: BaseException | None, exc_tb: TracebackType | None, ) -> None: - # iif we created it and are finished with it, we can + # if we created it and are finished with it, we can # close the cursor (but NOT the connection) if self.can_close_cursor: self.cursor.close() diff --git a/py-polars/polars/utils/_construction.py b/py-polars/polars/utils/_construction.py index 444d55b86e56..3f34ae9ae833 100644 --- a/py-polars/polars/utils/_construction.py +++ b/py-polars/polars/utils/_construction.py @@ -231,7 +231,7 @@ def arrow_to_pyseries(name: str, values: pa.Array, *, rechunk: bool = True) -> P else: if array.num_chunks > 1: # somehow going through ffi with a structarray - # returns the first chunk everytime + # returns the first chunk every time if isinstance(array.type, pa.StructType): pys = PySeries.from_arrow(name, array.combine_chunks()) else: