Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix PR10 error and Clean up docstrings from functions related to RT05 errors #25132

Merged
merged 34 commits into from
Mar 1, 2019
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
2c4455c
Fix validation error RT05
thoo Feb 4, 2019
c87102f
Fix pep8
thoo Feb 4, 2019
d552569
Merge remote-tracking branch 'upstream/master' into Rt05
thoo Feb 4, 2019
03aaa92
fix merge conflict
thoo Feb 4, 2019
36a610a
fix RT04
thoo Feb 4, 2019
c2e24b3
fix as recommended
thoo Feb 5, 2019
f5cfc8a
Merge remote-tracking branch 'upstream/master' into Rt05
thoo Feb 5, 2019
6e658f8
fix bullets
thoo Feb 5, 2019
5304b9c
fix upon suggestions
thoo Feb 6, 2019
7601aed
fix upon suggestions
thoo Feb 6, 2019
128dadb
fix failing tests
thoo Feb 6, 2019
3d3e408
replace with bullet
thoo Feb 6, 2019
522e76d
typo
thoo Feb 6, 2019
163e9e3
Retrigger :pandas-dev conda 27 failed
thoo Feb 6, 2019
b55b270
Merge remote-tracking branch 'upstream/master' into Rt05
thoo Feb 7, 2019
ba4f001
Merge remote-tracking branch 'upstream/master' into Rt05
thoo Feb 8, 2019
25e7503
update code_checks.sh
thoo Feb 8, 2019
1824b99
Merge remote-tracking branch 'upstream/master' into Rt05
thoo Feb 11, 2019
1262632
Merge remote-tracking branch 'upstream/master' into Rt05
thoo Feb 16, 2019
e12ee2a
fix as recommended
thoo Feb 16, 2019
bfe30f8
fix some leftover
thoo Feb 16, 2019
d5d270b
Retrigger :pandas-devs failed
thoo Feb 17, 2019
6ac909b
Retrigger :pandas-devs failed second time
thoo Feb 17, 2019
4e4f24a
Retrigger :pandas-devs failed second time
thoo Feb 17, 2019
283861f
Merge remote-tracking branch 'upstream/master' into Rt05
thoo Feb 17, 2019
953159c
fix at Series.unique
thoo Feb 20, 2019
15fde16
Merge remote-tracking branch 'upstream/master' into Rt05
thoo Feb 20, 2019
94e5279
add PR10
thoo Feb 21, 2019
39ab010
drop PR10
thoo Feb 21, 2019
64bd51b
fix PR10 error
thoo Feb 21, 2019
7051e3c
fix as recommended
thoo Feb 22, 2019
a35f869
Merge remote-tracking branch 'upstream/master' into Rt05
thoo Feb 22, 2019
b847e4e
fix as recommended
thoo Feb 22, 2019
2d62018
Merge remote-tracking branch 'upstream/master' into Rt05
thoo Feb 28, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ci/code_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,8 @@ fi
### DOCSTRINGS ###
if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then

MSG='Validate docstrings (GL06, GL07, GL09, SS04, PR03, PR05, PR10, EX04, RT04, SS05, SA05)' ; echo $MSG
$BASE_DIR/scripts/validate_docstrings.py --format=azure --errors=GL06,GL07,GL09,SS04,PR03,PR04,PR05,EX04,RT04,SS05,SA05
MSG='Validate docstrings (GL06, GL07, GL09, SS04, SS05, PR03, PR04, PR05, EX04, RT04, RT05, SA05)' ; echo $MSG
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was there a reason for removing PR10 here or just mistake?

Copy link
Contributor Author

@thoo thoo Feb 20, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is just a mistake from merge.

Copy link
Contributor Author

@thoo thoo Feb 20, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR10 is actually not included in the current check at line 245. So I wasn't sure someone exclude PR10 but forgot to remove from the message.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. I think this was just missed in #25109 so makes sense to update here accordingly

Copy link
Contributor Author

@thoo thoo Feb 21, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

##[error]pandas/io/excel/_base.py(492,): error PR10: pandas.ExcelWriter: Parameter ".. versionadded" requires a space before the colon separating the parameter name and type

PR10 is not passing the check with .. versionadded:: 0.24.. I am going to leave PR10 for now. Update pandas.ExcelWriter

$BASE_DIR/scripts/validate_docstrings.py --format=azure --errors=GL06,GL07,GL09,SS04,SS05,PR03,PR04,PR05,EX04,RT04,RT05,SA05
RET=$(($RET + $?)) ; echo $MSG "DONE"

fi
Expand Down
11 changes: 7 additions & 4 deletions pandas/core/algorithms.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,10 +288,13 @@ def unique(values):

Returns
-------
unique values.
If the input is an Index, the return is an Index
If the input is a Categorical dtype, the return is a Categorical
If the input is a Series/ndarray, the return will be an ndarray
unique values
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be the type, can you find out what's the returned Python type, and move this to the description please?


The return can be:

- If the input is an Index, the return is an Index.
- If the input is a Categorical dtype, the return is a Categorical.
- If the input is a Series/ndarray, the return will be an ndarray.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment here around periods for bullet points


See Also
--------
Expand Down
4 changes: 2 additions & 2 deletions pandas/core/arrays/categorical.py
Original file line number Diff line number Diff line change
Expand Up @@ -1292,7 +1292,7 @@ def __array__(self, dtype=None):
values : numpy array
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
values : numpy array
numpy.array

A numpy array of either the specified dtype or,
if dtype==None (default), the same dtype as
categorical.categories.dtype
categorical.categories.dtype.
"""
ret = take_1d(self.categories.values, self._codes)
if dtype and not is_dtype_equal(dtype, self.categories.dtype):
Expand Down Expand Up @@ -1501,7 +1501,7 @@ def get_values(self):
-------
values : numpy array
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
values : numpy array
numpy.array

A numpy array of the same dtype as categorical.categories.dtype or
Index if datetime / periods
Index if datetime / periods.
"""
# if we are a datetime and period index, return Index to keep metadata
if is_datetimelike(self.categories):
Expand Down
8 changes: 4 additions & 4 deletions pandas/core/arrays/datetimelike.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def strftime(self, date_format):
Return an Index of formatted strings specified by date_format, which
supports the same string format as the python standard library. Details
of the string format can be found in `python string format
doc <%(URL)s>`__
doc <%(URL)s>`__.

Parameters
----------
Expand All @@ -154,7 +154,7 @@ def strftime(self, date_format):
Returns
-------
Index
Index of formatted strings
Index of formatted strings.

See Also
--------
Expand Down Expand Up @@ -748,7 +748,7 @@ def _maybe_mask_results(self, result, fill_value=iNaT, convert=None):
mask the result if needed, convert to the provided dtype if its not
None

This is an internal routine
This is an internal routine.
"""

if self._hasnans:
Expand Down Expand Up @@ -1047,7 +1047,7 @@ def _sub_period_array(self, other):
Returns
-------
result : np.ndarray[object]
Array of DateOffset objects; nulls represented by NaT
Array of DateOffset objects; nulls represented by NaT.
"""
if not is_period_dtype(self):
raise TypeError("cannot subtract {dtype}-dtype from {cls}"
Expand Down
62 changes: 31 additions & 31 deletions pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -1145,7 +1145,7 @@ def to_numpy(self, dtype=None, copy=False):

Returns
-------
array : numpy.ndarray
numpy.ndarray

See Also
--------
Expand Down Expand Up @@ -1439,7 +1439,7 @@ def from_records(cls, data, index=None, exclude=None, columns=None,

Returns
-------
df : DataFrame
DataFrame
"""

# Make a copy of the input columns so we can modify it
Expand Down Expand Up @@ -1755,7 +1755,7 @@ def from_items(cls, items, columns=None, orient='columns'):

Returns
-------
frame : DataFrame
DataFrame
"""

warnings.warn("from_items is deprecated. Please use "
Expand Down Expand Up @@ -1866,7 +1866,7 @@ def from_csv(cls, path, header=0, sep=',', index_col=0, parse_dates=True,

Returns
-------
y : DataFrame
DataFrame

See Also
--------
Expand Down Expand Up @@ -1956,7 +1956,7 @@ def to_panel(self):

Returns
-------
panel : Panel
Panel
"""
raise NotImplementedError("Panel is being removed in pandas 0.25.0.")

Expand Down Expand Up @@ -2478,7 +2478,7 @@ def memory_usage(self, index=True, deep=False):

Returns
-------
sizes : Series
Series
A Series whose index is the original column names and whose values
is the memory usage of each column in bytes.

Expand Down Expand Up @@ -2696,7 +2696,7 @@ def get_value(self, index, col, takeable=False):

Returns
-------
value : scalar value
scalar value
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
scalar value
scalar

"""

warnings.warn("get_value is deprecated and will be removed "
Expand Down Expand Up @@ -2741,9 +2741,9 @@ def set_value(self, index, col, value, takeable=False):

Returns
-------
frame : DataFrame
DataFrame
If label pair is contained, will be reference to calling DataFrame,
otherwise a new object
otherwise a new object.
"""
warnings.warn("set_value is deprecated and will be removed "
"in a future release. Please use "
Expand Down Expand Up @@ -3177,7 +3177,7 @@ def select_dtypes(self, include=None, exclude=None):

Returns
-------
subset : DataFrame
DataFrame
The subset of the frame including the dtypes in ``include`` and
excluding the dtypes in ``exclude``.

Expand Down Expand Up @@ -3542,7 +3542,7 @@ def _sanitize_column(self, key, value, broadcast=True):

Returns
-------
sanitized_column : numpy-array
numpy-array
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
numpy-array
numpy.array

"""

def reindexer(value):
Expand Down Expand Up @@ -3811,7 +3811,7 @@ def drop(self, labels=None, axis=0, index=None, columns=None,

Returns
-------
dropped : pandas.DataFrame
pandas.DataFrame
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pandas.DataFrame
DataFrame


Raises
------
Expand Down Expand Up @@ -3936,7 +3936,7 @@ def rename(self, *args, **kwargs):

Returns
-------
renamed : DataFrame
DataFrame

See Also
--------
Expand Down Expand Up @@ -4579,7 +4579,7 @@ def drop_duplicates(self, subset=None, keep='first', inplace=False):

Returns
-------
deduplicated : DataFrame
DataFrame
"""
if self.empty:
return self.copy()
Expand Down Expand Up @@ -4613,7 +4613,7 @@ def duplicated(self, subset=None, keep='first'):

Returns
-------
duplicated : Series
Series
"""
from pandas.core.sorting import get_group_index
from pandas._libs.hashtable import duplicated_int64, _SIZE_HINT_LIMIT
Expand Down Expand Up @@ -4981,7 +4981,7 @@ def swaplevel(self, i=-2, j=-1, axis=0):

Returns
-------
swapped : same type as caller (new object)
same type as caller (new object)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you replace this by the Python type? I guess DataFrame, but better check the code


.. versionchanged:: 0.18.1

Expand Down Expand Up @@ -5260,7 +5260,7 @@ def combine_first(self, other):

Returns
-------
combined : DataFrame
DataFrame

See Also
--------
Expand Down Expand Up @@ -5621,7 +5621,7 @@ def pivot(self, index=None, columns=None, values=None):

Returns
-------
table : DataFrame
DataFrame

See Also
--------
Expand Down Expand Up @@ -5907,7 +5907,7 @@ def unstack(self, level=-1, fill_value=None):

Returns
-------
unstacked : DataFrame or Series
DataFrame or Series
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
DataFrame or Series
Series or DataFrame


See Also
--------
Expand Down Expand Up @@ -6073,7 +6073,7 @@ def diff(self, periods=1, axis=0):

Returns
-------
diffed : DataFrame
DataFrame

See Also
--------
Expand Down Expand Up @@ -6345,7 +6345,7 @@ def apply(self, func, axis=0, broadcast=None, raw=False, reduce=None,

Returns
-------
applied : Series or DataFrame
Series or DataFrame

See Also
--------
Expand Down Expand Up @@ -6538,7 +6538,7 @@ def append(self, other, ignore_index=False,

Returns
-------
appended : DataFrame
DataFrame

See Also
--------
Expand Down Expand Up @@ -6848,7 +6848,7 @@ def round(self, decimals=0, *args, **kwargs):

Returns
-------
DataFrame :
DataFrame
A DataFrame with the affected columns rounded to the specified
number of decimal places.

Expand Down Expand Up @@ -6961,7 +6961,7 @@ def corr(self, method='pearson', min_periods=1):

Returns
-------
y : DataFrame
DataFrame

See Also
--------
Expand Down Expand Up @@ -7155,7 +7155,7 @@ def corrwith(self, other, axis=0, drop=False, method='pearson'):

Returns
-------
correls : Series
Series

See Also
-------
Expand Down Expand Up @@ -7485,7 +7485,7 @@ def nunique(self, axis=0, dropna=True):

Returns
-------
nunique : Series
Series

See Also
--------
Expand Down Expand Up @@ -7523,7 +7523,7 @@ def idxmin(self, axis=0, skipna=True):

Returns
-------
idxmin : Series
Series

Raises
------
Expand Down Expand Up @@ -7559,7 +7559,7 @@ def idxmax(self, axis=0, skipna=True):

Returns
-------
idxmax : Series
Series

Raises
------
Expand Down Expand Up @@ -7706,7 +7706,7 @@ def quantile(self, q=0.5, axis=0, numeric_only=True,

Returns
-------
quantiles : Series or DataFrame
Series or DataFrame

If ``q`` is an array, a DataFrame will be returned where the
index is ``q``, the columns are the columns of self, and the
Expand Down Expand Up @@ -7788,7 +7788,7 @@ def to_timestamp(self, freq=None, how='start', axis=0, copy=True):

Returns
-------
df : DataFrame with DatetimeIndex
DataFrame with DatetimeIndex
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you leave just DataFrame and explain about DatetimeIndex in the description

"""
new_data = self._data
if copy:
Expand Down Expand Up @@ -7820,7 +7820,7 @@ def to_period(self, freq=None, axis=0, copy=True):

Returns
-------
ts : TimeSeries with PeriodIndex
TimeSeries with PeriodIndex
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this returns a DataFrame, please check it and leave that as the type. And explain that it's a time series... in the description.

"""
new_data = self._data
if copy:
Expand Down
Loading