Skip to content

Commit

Permalink
docs: Fix some typos (#14394)
Browse files Browse the repository at this point in the history
  • Loading branch information
janosh authored Feb 9, 2024
1 parent 4d79e97 commit f6bbbdc
Show file tree
Hide file tree
Showing 17 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions crates/polars-arrow/src/array/primitive/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ impl<T: NativeType> PrimitiveArray<T> {
/// 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<Self, MutablePrimitiveArray<T>> {
use Either::*;
Expand Down Expand Up @@ -467,7 +467,7 @@ impl<T: NativeType> PrimitiveArray<T> {

/// 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() {
Expand Down
2 changes: 1 addition & 1 deletion crates/polars-arrow/src/array/static_array_collect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ impl<T: IntoBytes> ArrayFromIter<Option<T>> for BinaryViewArray {
// fn try_arr_from_iter_trusted<E, I>(iter: I) -> Result<Self, E>
}

/// 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<i64>) -> Utf8Array<i64> {
Expand Down
4 changes: 2 additions & 2 deletions crates/polars-compute/src/arity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ unsafe fn ptr_apply_binary_kernel<L: Copy, R: Copy, O, F: Fn(L, R) -> 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<I, O, F>(mut arr: PrimitiveArray<I>, op: F) -> PrimitiveArray<O>
where
I: NativeType,
Expand Down Expand Up @@ -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<L, R, O, F>(
mut lhs: PrimitiveArray<L>,
mut rhs: PrimitiveArray<R>,
Expand Down
2 changes: 1 addition & 1 deletion crates/polars-json/src/ndjson/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ fn read_rows<R: BufRead>(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.
Expand Down
2 changes: 1 addition & 1 deletion crates/polars-json/src/ndjson/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion crates/polars-lazy/src/dsl/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub(crate) fn concat_impl<L: AsRef<[LazyFrame]>>(
};

let lf = match &mut lf.logical_plan {
// re-use the same union
// reuse the same union
LogicalPlan::Union {
inputs: existing_inputs,
options: opts,
Expand Down
2 changes: 1 addition & 1 deletion crates/polars-parquet/src/parquet/read/compression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ impl streaming_decompression::Decompressed for Page {
/// A [`FallibleStreamingIterator`] that decompresses [`CompressedPage`] into [`DataPage`].
/// # Implementation
/// This decompressor uses an internal [`Vec<u8>`] 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<I: Iterator<Item = Result<CompressedPage>>> {
iter: _Decompressor<I>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pub struct IndexedPageReader<R: Read + Seek> {
// buffer to read the whole page [header][data] into memory
buffer: Vec<u8>,

// buffer to store the data [data] and re-use across pages
// buffer to store the data [data] and reuse across pages
data_buffer: Vec<u8>,

pages: VecDeque<FilteredPage>,
Expand Down
2 changes: 1 addition & 1 deletion crates/polars-plan/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ pub fn has_aexpr_literal(current_node: Node, arena: &Arena<AExpr>) -> 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<F>(current_expr: &Expr, matches: F) -> bool
where
F: Fn(&Expr) -> bool,
Expand Down
2 changes: 1 addition & 1 deletion crates/polars-time/src/chunkedarray/string/strptime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ pub(super) fn fmt_len(fmt: &[u8]) -> Option<u16> {

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,
Expand Down
2 changes: 1 addition & 1 deletion crates/polars/tests/it/lazy/group_by.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down
4 changes: 2 additions & 2 deletions docs/user-guide/concepts/data-types/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -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<Series>` and is useful to pack multiple/heterogenous values in a single column. |
| Nested | `Struct` | A struct array is represented as a `Vec<Series>` 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. |
Expand All @@ -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.
2 changes: 1 addition & 1 deletion docs/user-guide/expressions/structs.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion docs/user-guide/migration/pandas.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion py-polars/polars/dataframe/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion py-polars/polars/io/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion py-polars/polars/utils/_construction.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit f6bbbdc

Please sign in to comment.