From 4213421e9242ace1a98bdc59d919f5bf18fd5015 Mon Sep 17 00:00:00 2001 From: Josiah Baker Date: Tue, 1 Oct 2019 11:01:06 -0400 Subject: [PATCH 1/2] DOC: fix pr09,pr08 errors in frame.py fixing methods defined in this file this is part of a larger clean up of the dataframe class --- pandas/core/frame.py | 55 +++++++++++++++++++++++--------------------- 1 file changed, 29 insertions(+), 26 deletions(-) diff --git a/pandas/core/frame.py b/pandas/core/frame.py index 16f34fee5e1ff..e60aa41166847 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -304,7 +304,7 @@ class DataFrame(NDFrame): Parameters ---------- data : ndarray (structured or homogeneous), Iterable, dict, or DataFrame - Dict can contain Series, arrays, constants, or list-like objects + Dict can contain Series, arrays, constants, or list-like objects. .. versionchanged:: 0.23.0 If data is a dict, column order follows insertion-order for @@ -316,14 +316,14 @@ class DataFrame(NDFrame): index : Index or array-like Index to use for resulting frame. Will default to RangeIndex if - no indexing information part of input data and no index provided + no indexing information part of input data and no index provided. columns : Index or array-like Column labels to use for resulting frame. Will default to - RangeIndex (0, 1, 2, ..., n) if no column labels are provided + RangeIndex (0, 1, 2, ..., n) if no column labels are provided. dtype : dtype, default None - Data type to force. Only a single dtype is allowed. If None, infer + Data type to force. Only a single dtype is allowed. If None, infer. copy : bool, default False - Copy data from inputs. Only affects DataFrame / 2d ndarray input + Copy data from inputs. Only affects DataFrame / 2d ndarray input. See Also -------- @@ -1544,20 +1544,20 @@ def from_records( data : ndarray (structured dtype), list of tuples, dict, or DataFrame index : str, list of fields, array-like Field of array to use as the index, alternately a specific set of - input labels to use + input labels to use. exclude : sequence, default None - Columns or fields to exclude + Columns or fields to exclude. columns : sequence, default None Column names to use. If the passed data do not have names associated with them, this argument provides names for the columns. Otherwise this argument indicates the order of the columns in the result (any names not found in the data will become all-NA - columns) + columns). coerce_float : bool, default False Attempt to convert values of non-string, non-numeric objects (like - decimal.Decimal) to floating point, useful for SQL result sets + decimal.Decimal) to floating point, useful for SQL result sets. nrows : int, default None - Number of rows to read if data is an iterator + Number of rows to read if data is an iterator. Returns ------- @@ -2118,8 +2118,8 @@ def to_parquet( .. versionadded:: 0.24.0 partition_cols : list, optional, default None - Column names by which to partition the dataset - Columns are partitioned in the order they are given + Column names by which to partition the dataset. + Columns are partitioned in the order they are given. .. versionadded:: 0.24.0 @@ -3460,9 +3460,9 @@ def insert(self, loc, column, value, allow_duplicates=False): Parameters ---------- loc : int - Insertion index. Must verify 0 <= loc <= len(columns) + Insertion index. Must verify 0 <= loc <= len(columns). column : str, number, or hashable object - label of the inserted column + Label of the inserted column. value : int, Series, or array-like allow_duplicates : bool, optional """ @@ -3681,9 +3681,9 @@ def lookup(self, row_labels, col_labels): Parameters ---------- row_labels : sequence - The row labels to use for lookup + The row labels to use for lookup. col_labels : sequence - The column labels to use for lookup + The column labels to use for lookup. Returns ------- @@ -4770,14 +4770,14 @@ def drop_duplicates(self, subset=None, keep="first", inplace=False): ---------- subset : column label or sequence of labels, optional Only consider certain columns for identifying duplicates, by - default use all of the columns + default use all of the columns. keep : {'first', 'last', False}, default 'first' Determines which duplicates (if any) to keep. - ``first`` : Drop duplicates except for the first occurrence. - ``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 drop duplicates in place or to return a copy. Returns ------- @@ -4805,7 +4805,7 @@ def duplicated(self, subset=None, keep="first"): ---------- subset : column label or sequence of labels, optional Only consider certain columns for identifying duplicates, by - default use all of the columns + default use all of the columns. keep : {'first', 'last', False}, default 'first' Determines which duplicates (if any) to mark. @@ -6233,9 +6233,9 @@ def unstack(self, level=-1, fill_value=None): Parameters ---------- level : int, str, or list of these, default -1 (last level) - Level(s) of index to unstack, can pass level name + Level(s) of index to unstack, can pass level name. fill_value : int, string or dict - Replace NaN with this value if the unstack produces missing values + Replace NaN with this value if the unstack produces missing values. Returns ------- @@ -7368,7 +7368,7 @@ def corr(self, method="pearson", min_periods=1): * callable: callable with input two 1d ndarrays and returning a float. Note that the returned matrix from corr will have 1 along the diagonals and will be symmetric - regardless of the callable's behavior + regardless of the callable's behavior. .. versionadded:: 0.24.0 min_periods : int, optional @@ -7572,7 +7572,7 @@ def corrwith(self, other, axis=0, drop=False, method="pearson"): * kendall : Kendall Tau correlation coefficient * spearman : Spearman rank correlation * callable: callable with input two 1d ndarrays - and returning a float + and returning a float. .. versionadded:: 0.24.0 @@ -7947,7 +7947,8 @@ def idxmin(self, axis=0, skipna=True): Parameters ---------- axis : {0 or 'index', 1 or 'columns'}, default 0 - The axis to use. 0 or 'index' for row-wise, 1 or 'columns' for column-wise + The axis to use. 0 or 'index' for row-wise, 1 or 'columns' for + column-wise. skipna : boolean, default True Exclude NA/null values. If an entire row/column is NA, the result will be NA. @@ -7984,7 +7985,8 @@ def idxmax(self, axis=0, skipna=True): Parameters ---------- axis : {0 or 'index', 1 or 'columns'}, default 0 - The axis to use. 0 or 'index' for row-wise, 1 or 'columns' for column-wise + The axis to use. 0 or 'index' for row-wise, 1 or 'columns' for + column-wise. skipna : boolean, default True Exclude NA/null values. If an entire row/column is NA, the result will be NA. @@ -8037,7 +8039,8 @@ def mode(self, axis=0, numeric_only=False, dropna=True): The axis to iterate over while searching for the mode: * 0 or 'index' : get mode of each column - * 1 or 'columns' : get mode of each row + * 1 or 'columns' : get mode of each row. + numeric_only : bool, default False If True, only apply to numeric columns. dropna : bool, default True From d33fdfe5c65f8c6e87f73355dda0b6d8eb6f50a3 Mon Sep 17 00:00:00 2001 From: Josiah Baker Date: Tue, 1 Oct 2019 11:35:49 -0400 Subject: [PATCH 2/2] move sphinx directive down one line if its on the next line, the validation script doesnt know to remove it before checking for periods --- pandas/core/frame.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pandas/core/frame.py b/pandas/core/frame.py index e60aa41166847..c47c95aab390b 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -7369,6 +7369,7 @@ def corr(self, method="pearson", min_periods=1): and returning a float. Note that the returned matrix from corr will have 1 along the diagonals and will be symmetric regardless of the callable's behavior. + .. versionadded:: 0.24.0 min_periods : int, optional