From fd45ab23ef77c55c80744e440ac17440d0ea631e Mon Sep 17 00:00:00 2001 From: Ehsan Shirvanian Date: Sun, 6 Feb 2022 21:31:06 -0400 Subject: [PATCH 1/2] Fixing documentation format in read_csv add a mising ` in on_bad_lines option description in " New in version 1.3.0: " section , that was causing to make couple of lines red --- pandas/io/parsers/readers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/io/parsers/readers.py b/pandas/io/parsers/readers.py index 5f93eef4fd977..c5b84dd18ec13 100644 --- a/pandas/io/parsers/readers.py +++ b/pandas/io/parsers/readers.py @@ -374,7 +374,7 @@ - callable, function with signature ``(bad_line: list[str]) -> list[str] | None`` that will process a single bad line. ``bad_line`` is a list of strings split by the ``sep``. - If the function returns ``None`, the bad line will be ignored. + If the function returns ``None``, the bad line will be ignored. If the function returns a new list of strings with more elements than expected, a ``ParserWarning`` will be emitted while dropping extra elements. Only supported when ``engine="python"`` From 3dd926101bd3e42bc957415f724321d29eaf00f7 Mon Sep 17 00:00:00 2001 From: Ehsan Shirvanian Date: Wed, 25 May 2022 16:34:35 -0400 Subject: [PATCH 2/2] sync 'inplace' doc everyhwere possible --- pandas/core/frame.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/pandas/core/frame.py b/pandas/core/frame.py index d563aa8b06ca5..fd1f7a3767b33 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -240,7 +240,7 @@ If 1 or 'columns': apply function to each row.""", "inplace": """ inplace : bool, default False - If True, performs operation inplace and returns None.""", + Whether to modify the DataFrame rather than creating a new one.""", "optional_by": """ by : str or list of str Name or list of names to sort by. @@ -4071,8 +4071,7 @@ def query(self, expr: str, inplace: bool = False, **kwargs): Expanding functionality of backtick quoting for more than only spaces. inplace : bool - Whether the query should modify the data in place or return - a modified copy. + Whether to modify the DataFrame rather than creating a new one. **kwargs See the documentation for :func:`eval` for complete details on the keyword arguments accepted by :meth:`DataFrame.query`. @@ -5175,8 +5174,8 @@ def rename( copy : bool, default True Also copy underlying data. inplace : bool, default False - Whether to return a new DataFrame. If True then value of copy is - ignored. + Whether to modify the DataFrame rather than creating a new one. + If True then value of copy is ignored. level : int or level name, default None In case of a MultiIndex, only rename labels in the specified level. @@ -5607,7 +5606,7 @@ def set_index( append : bool, default False Whether to append columns to existing index. inplace : bool, default False - If True, modifies the DataFrame in place (do not create a new object). + Whether to modify the DataFrame rather than creating a new one. verify_integrity : bool, default False Check the new index for duplicates. Otherwise defer the check until necessary. Setting to False will improve the performance of this @@ -5884,7 +5883,7 @@ def reset_index( Do not try to insert index into dataframe columns. This resets the index to the default integer index. inplace : bool, default False - Modify the DataFrame in place (do not create a new object). + Whether to modify the DataFrame rather than creating a new one. col_level : int or str, default 0 If the columns have multiple levels, determines which level the labels are inserted into. By default it is inserted into the first @@ -6171,7 +6170,7 @@ def dropna( Labels along other axis to consider, e.g. if you are dropping rows these would be a list of columns to include. inplace : bool, default False - If True, do operation inplace and return None. + Whether to modify the DataFrame rather than creating a new one. Returns ------- @@ -6317,7 +6316,7 @@ def drop_duplicates( - ``last`` : Drop duplicates except for the last occurrence. - False : Drop all duplicates. inplace : bool, default False - Whether to drop duplicates in place or to return a copy. + Whether to modify the DataFrame rather than creating a new one. ignore_index : bool, default False If True, the resulting axis will be labeled 0, 1, …, n - 1. @@ -6691,7 +6690,7 @@ def sort_index( # type: ignore[override] Sort ascending vs. descending. When the index is a MultiIndex the sort direction can be controlled for each level individually. inplace : bool, default False - If True, perform operation in-place. + Whether to modify the DataFrame rather than creating a new one. kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, default 'quicksort' Choice of sorting algorithm. See also :func:`numpy.sort` for more information. `mergesort` and `stable` are the only stable algorithms. For