From 2c7e128d1fe861594f4dc9f784dbb2d1d065041f Mon Sep 17 00:00:00 2001 From: star1327p Date: Tue, 28 Oct 2025 19:28:31 -0700 Subject: [PATCH 1/2] DOC: Correct grammatical issues with a/an usage --- doc/make.py | 2 +- pandas/_config/localization.py | 2 +- pandas/core/arrays/categorical.py | 6 +++--- pandas/core/arrays/timedeltas.py | 2 +- pandas/core/dtypes/base.py | 2 +- pandas/core/dtypes/dtypes.py | 2 +- pandas/core/internals/construction.py | 2 +- pandas/core/window/expanding.py | 2 +- pandas/io/excel/_odswriter.py | 2 +- pandas/io/json/_normalize.py | 2 +- pandas/plotting/_misc.py | 4 ++-- pandas/tests/indexes/datetimes/test_date_range.py | 2 +- pandas/tests/reshape/test_melt.py | 2 +- pandas/tests/scalar/timestamp/test_constructors.py | 2 +- 14 files changed, 17 insertions(+), 17 deletions(-) diff --git a/doc/make.py b/doc/make.py index 9542563dc037b..9e627f9a8137b 100755 --- a/doc/make.py +++ b/doc/make.py @@ -105,7 +105,7 @@ def _process_single_doc(self, single_doc): @staticmethod def _run_os(*args) -> None: """ - Execute a command as a OS terminal. + Execute a command as an OS terminal. Parameters ---------- diff --git a/pandas/_config/localization.py b/pandas/_config/localization.py index 6602633f20399..8e2af78f68eb2 100644 --- a/pandas/_config/localization.py +++ b/pandas/_config/localization.py @@ -79,7 +79,7 @@ def can_set_locale(lc: str, lc_var: int = locale.LC_ALL) -> bool: with set_locale(lc, lc_var=lc_var): pass except (ValueError, locale.Error): - # horrible name for a Exception subclass + # horrible name for an Exception subclass return False else: return True diff --git a/pandas/core/arrays/categorical.py b/pandas/core/arrays/categorical.py index 6f572d0f72df5..41e5c6f65dbb9 100644 --- a/pandas/core/arrays/categorical.py +++ b/pandas/core/arrays/categorical.py @@ -269,7 +269,7 @@ class Categorical(NDArrayBackedExtensionArray, PandasObject, ObjectStringArrayMi categories are assumed to be the unique values of `values` (sorted, if possible, otherwise in the order in which they appear). ordered : bool, default False - Whether or not this categorical is treated as a ordered categorical. + Whether or not this categorical is treated as an ordered categorical. If True, the resulting categorical will be ordered. An ordered categorical respects, when sorted, the order of its `categories` attribute (which in turn is the `categories` argument, if @@ -1103,7 +1103,7 @@ def set_categories( new_categories : Index-like The categories in new order. ordered : bool, default None - Whether or not the categorical is treated as a ordered categorical. + Whether or not the categorical is treated as an ordered categorical. If not given, do not change the ordered information. rename : bool, default False Whether or not the new_categories should be considered as a rename @@ -1277,7 +1277,7 @@ def reorder_categories(self, new_categories, ordered=None) -> Self: new_categories : Index-like The categories in new order. ordered : bool, optional - Whether or not the categorical is treated as a ordered categorical. + Whether or not the categorical is treated as an ordered categorical. If not given, do not change the ordered information. Returns diff --git a/pandas/core/arrays/timedeltas.py b/pandas/core/arrays/timedeltas.py index 9b3452c318f9c..c081d6190204e 100644 --- a/pandas/core/arrays/timedeltas.py +++ b/pandas/core/arrays/timedeltas.py @@ -1212,7 +1212,7 @@ def _objects_to_td64ns( data, unit=None, errors: DateTimeErrorChoices = "raise" ) -> np.ndarray: """ - Convert a object-dtyped or string-dtyped array into an + Convert an object-dtyped or string-dtyped array into a timedelta64[ns]-dtyped array. Parameters diff --git a/pandas/core/dtypes/base.py b/pandas/core/dtypes/base.py index ee48cf45c6c9f..59f360650ff8c 100644 --- a/pandas/core/dtypes/base.py +++ b/pandas/core/dtypes/base.py @@ -517,7 +517,7 @@ class Registry: """ Registry for dtype inference. - The registry allows one to map a string repr of a extension + The registry allows one to map a string repr of an extension dtype to an extension dtype. The string alias can be used in several places, including diff --git a/pandas/core/dtypes/dtypes.py b/pandas/core/dtypes/dtypes.py index 6d99f9df73282..2e3d73edcdf4f 100644 --- a/pandas/core/dtypes/dtypes.py +++ b/pandas/core/dtypes/dtypes.py @@ -176,7 +176,7 @@ class CategoricalDtype(PandasExtensionDtype, ExtensionDtype): The categories are stored in an Index, and if an index is provided the dtype of that index will be used. ordered : bool or None, default False - Whether or not this categorical is treated as a ordered categorical. + Whether or not this categorical is treated as an ordered categorical. None can be used to maintain the ordered value of existing categoricals when used in operations that combine categoricals, e.g. astype, and will resolve to False if there is no existing ordered to maintain. diff --git a/pandas/core/internals/construction.py b/pandas/core/internals/construction.py index 84ec9d2a344f5..8db37f24cdbb9 100644 --- a/pandas/core/internals/construction.py +++ b/pandas/core/internals/construction.py @@ -215,7 +215,7 @@ def ndarray_to_mgr( # GH#19157 if isinstance(values, (np.ndarray, ExtensionArray)) and values.ndim > 1: - # GH#12513 a EA dtype passed with a 2D array, split into + # GH#12513 an EA dtype passed with a 2D array, split into # multiple EAs that view the values # error: No overload variant of "__getitem__" of "ExtensionArray" # matches argument type "Tuple[slice, int]" diff --git a/pandas/core/window/expanding.py b/pandas/core/window/expanding.py index 567ede27949d5..2527a5dd508d8 100644 --- a/pandas/core/window/expanding.py +++ b/pandas/core/window/expanding.py @@ -1454,7 +1454,7 @@ def corr( class ExpandingGroupby(BaseWindowGroupby, Expanding): """ - Provide a expanding groupby implementation. + Provide an expanding groupby implementation. """ __module__ = "pandas.api.typing" diff --git a/pandas/io/excel/_odswriter.py b/pandas/io/excel/_odswriter.py index ba4919c9298ed..e9a06076f3aff 100644 --- a/pandas/io/excel/_odswriter.py +++ b/pandas/io/excel/_odswriter.py @@ -246,7 +246,7 @@ def _process_style(self, style: dict[str, Any]) -> str: ... def _process_style(self, style: None) -> None: ... def _process_style(self, style: dict[str, Any] | None) -> str | None: - """Convert a style dictionary to a OpenDocument style sheet + """Convert a style dictionary to an OpenDocument style sheet Parameters ---------- diff --git a/pandas/io/json/_normalize.py b/pandas/io/json/_normalize.py index 16ec73ddeb743..583db03262769 100644 --- a/pandas/io/json/_normalize.py +++ b/pandas/io/json/_normalize.py @@ -219,7 +219,7 @@ def _simple_json_normalize( sep: str = ".", ) -> dict | list[dict] | Any: """ - A optimized basic json_normalize + An optimized basic json_normalize Converts a nested dict into a flat dict ("record"), unlike json_normalize and nested_to_record it doesn't do anything clever. diff --git a/pandas/plotting/_misc.py b/pandas/plotting/_misc.py index 42b02ce99cb3c..4c445c570ae33 100644 --- a/pandas/plotting/_misc.py +++ b/pandas/plotting/_misc.py @@ -282,12 +282,12 @@ def radviz( """ Plot a multidimensional dataset in 2D. - Each Series in the DataFrame is represented as a evenly distributed + Each Series in the DataFrame is represented as an evenly distributed slice on a circle. Each data point is rendered in the circle according to the value on each Series. Highly correlated `Series` in the `DataFrame` are placed closer on the unit circle. - RadViz allow to project a N-dimensional data set into a 2D space where the + RadViz allow to project an N-dimensional data set into a 2D space where the influence of each dimension can be interpreted as a balance between the influence of all dimensions. diff --git a/pandas/tests/indexes/datetimes/test_date_range.py b/pandas/tests/indexes/datetimes/test_date_range.py index 85e2f6a8070e0..45f43f9bf9760 100644 --- a/pandas/tests/indexes/datetimes/test_date_range.py +++ b/pandas/tests/indexes/datetimes/test_date_range.py @@ -215,7 +215,7 @@ def test_date_range_multiplication_overflow(self): # check that overflows in calculating `addend = periods * stride` # are caught with tm.assert_produces_warning(None): - # we should _not_ be seeing a overflow RuntimeWarning + # we should _not_ be seeing an overflow RuntimeWarning dti = date_range(start="1677-09-22", periods=213503, freq="D") assert dti[0] == Timestamp("1677-09-22") diff --git a/pandas/tests/reshape/test_melt.py b/pandas/tests/reshape/test_melt.py index 02544c9518d10..fba9c28282e94 100644 --- a/pandas/tests/reshape/test_melt.py +++ b/pandas/tests/reshape/test_melt.py @@ -933,7 +933,7 @@ def test_character_overlap(self): tm.assert_frame_equal(result.sort_index(axis=1), expected.sort_index(axis=1)) def test_invalid_separator(self): - # if an invalid separator is supplied a empty data frame is returned + # if an invalid separator is supplied an empty data frame is returned sep = "nope!" df = DataFrame( { diff --git a/pandas/tests/scalar/timestamp/test_constructors.py b/pandas/tests/scalar/timestamp/test_constructors.py index d9defd47b6620..5c89cb3a66c2f 100644 --- a/pandas/tests/scalar/timestamp/test_constructors.py +++ b/pandas/tests/scalar/timestamp/test_constructors.py @@ -49,7 +49,7 @@ def test_constructor_int_float_with_YM_unit(self, typ): @pytest.mark.parametrize("typ", [int, float]) def test_construct_from_int_float_with_unit_out_of_bound_raises(self, typ): - # GH#50870 make sure we get a OutOfBoundsDatetime instead of OverflowError + # GH#50870 make sure we get an OutOfBoundsDatetime instead of OverflowError val = typ(150000000000000) msg = f"cannot convert input {val} with the unit 'D'" From d74cdf0144dbd4d43cebd0d4375977f5403559ec Mon Sep 17 00:00:00 2001 From: "Christine P. Chai" Date: Tue, 28 Oct 2025 19:34:10 -0700 Subject: [PATCH 2/2] DOC: a M window -> an M window --- pandas/core/window/numba_.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/core/window/numba_.py b/pandas/core/window/numba_.py index 171d3bc1d1c35..89ad94a6ccab2 100644 --- a/pandas/core/window/numba_.py +++ b/pandas/core/window/numba_.py @@ -189,7 +189,7 @@ def generate_numba_table_func( """ Generate a numba jitted function to apply window calculations table-wise. - Func will be passed a M window size x N number of columns array, and + Func will be passed an M window size x N number of columns array, and must return a 1 x N number of columns array. 1. jit the user's function