Skip to content

DOC: Capitalize docstring summaries #23895

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

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 7 additions & 5 deletions pandas/_libs/tslibs/timedeltas.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ _no_input = object()
@cython.wraparound(False)
def ints_to_pytimedelta(int64_t[:] arr, box=False):
"""
convert an i8 repr to an ndarray of timedelta or Timedelta (if box ==
True)
Convert an i8 repr to an ndarray of timedelta or Timedelta (if box ==
True).

Parameters
----------
Expand Down Expand Up @@ -823,7 +823,9 @@ cdef class _Timedelta(timedelta):
return self.value / 1e9

def view(self, dtype):
""" array view compat """
"""
Array view compat.
"""
return np.timedelta64(self.value).view(dtype)

@property
Expand Down Expand Up @@ -1226,7 +1228,7 @@ class Timedelta(_Timedelta):

def floor(self, freq):
"""
return a new Timedelta floored to this resolution
Return a new Timedelta floored to this resolution.

Parameters
----------
Expand All @@ -1236,7 +1238,7 @@ class Timedelta(_Timedelta):

def ceil(self, freq):
"""
return a new Timedelta ceiled to this resolution
Return a new Timedelta ceiled to this resolution.

Parameters
----------
Expand Down
8 changes: 4 additions & 4 deletions pandas/_libs/tslibs/timestamps.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ class Timestamp(_Timestamp):
"""
Timestamp.fromordinal(ordinal, freq=None, tz=None)

passed an ordinal, translate and convert to a ts
Passed an ordinal, translate and convert to a ts.
note: by definition there cannot be any tz info on the ordinal itself

Parameters
Expand Down Expand Up @@ -802,7 +802,7 @@ class Timestamp(_Timestamp):

def floor(self, freq, ambiguous='raise', nonexistent='raise'):
"""
return a new Timestamp floored to this resolution
Return a new Timestamp floored to this resolution.

Parameters
----------
Expand Down Expand Up @@ -834,7 +834,7 @@ class Timestamp(_Timestamp):

def ceil(self, freq, ambiguous='raise', nonexistent='raise'):
"""
return a new Timestamp ceiled to this resolution
Return a new Timestamp ceiled to this resolution.

Parameters
----------
Expand Down Expand Up @@ -1148,7 +1148,7 @@ class Timestamp(_Timestamp):
hour=None, minute=None, second=None, microsecond=None,
nanosecond=None, tzinfo=object, fold=0):
"""
implements datetime.replace, handles nanoseconds
Implements datetime.replace, handles nanoseconds.

Parameters
----------
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -1953,7 +1953,7 @@ def to_stata(self, fname, convert_dates=None, write_index=True,

def to_feather(self, fname):
"""
write out the binary feather-format for DataFrames
Write out the binary feather-format for DataFrames

.. versionadded:: 0.20.0

Expand Down
8 changes: 6 additions & 2 deletions pandas/core/groupby/groupby.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,9 @@ def _assure_grouper(self):

@property
def groups(self):
""" dict {group name -> group labels} """
"""
Dict {group name -> group labels}.
"""
self._assure_grouper()
return self.grouper.groups

Expand All @@ -395,7 +397,9 @@ def ngroups(self):

@property
def indices(self):
""" dict {group name -> group indices} """
"""
Dict {group name -> group indices}
"""
self._assure_grouper()
return self.grouper.indices

Expand Down
49 changes: 30 additions & 19 deletions pandas/core/indexes/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -690,17 +690,23 @@ def __array_wrap__(self, result, context=None):

@cache_readonly
def dtype(self):
""" return the dtype object of the underlying data """
"""
Return the dtype object of the underlying data.
"""
return self._data.dtype

@cache_readonly
def dtype_str(self):
""" return the dtype str of the underlying data """
"""
Return the dtype str of the underlying data.
"""
return str(self.dtype)

@property
def values(self):
""" return the underlying data as an ndarray """
"""
Return the underlying data as an ndarray.
"""
return self._data.view(np.ndarray)

@property
Expand Down Expand Up @@ -825,12 +831,12 @@ def repeat(self, repeats, *args, **kwargs):
return self._shallow_copy(self._values.repeat(repeats))

_index_shared_docs['where'] = """
.. versionadded:: 0.19.0

Return an Index of same shape as self and whose corresponding
entries are from self where cond is True and otherwise are from
other.

.. versionadded:: 0.19.0

Parameters
----------
cond : boolean array-like with the same length as self
Expand Down Expand Up @@ -862,7 +868,7 @@ def where(self, cond, other=None):

def ravel(self, order='C'):
"""
return an ndarray of the flattened values of the underlying data
Return an ndarray of the flattened values of the underlying data

See Also
--------
Expand Down Expand Up @@ -1124,7 +1130,7 @@ def to_flat_index(self):
def to_series(self, index=None, name=None):
"""
Create a Series with both index and values equal to the index keys
useful with map for returning an indexer based on an index
useful with map for returning an indexer based on an index.

Parameters
----------
Expand Down Expand Up @@ -1493,13 +1499,15 @@ def _mpl_repr(self):
# introspection
@property
def is_monotonic(self):
""" alias for is_monotonic_increasing (deprecated) """
"""
Alias for is_monotonic_increasing (deprecated).
"""
return self.is_monotonic_increasing

@property
def is_monotonic_increasing(self):
"""
return if the index is monotonic increasing (only equal or
Return if the index is monotonic increasing (only equal or
increasing) values.

Examples
Expand All @@ -1516,7 +1524,7 @@ def is_monotonic_increasing(self):
@property
def is_monotonic_decreasing(self):
"""
return if the index is monotonic decreasing (only equal or
Return if the index is monotonic decreasing (only equal or
decreasing) values.

Examples
Expand Down Expand Up @@ -1567,7 +1575,9 @@ def is_lexsorted_for_tuple(self, tup):

@cache_readonly
def is_unique(self):
""" return if the index has unique values """
"""
Return if the index has unique values.
"""
return self._engine.is_unique

@property
Expand Down Expand Up @@ -1958,7 +1968,7 @@ def _get_level_number(self, level):

@cache_readonly
def inferred_type(self):
""" return a string of the type inferred from the values """
""" Return a string of the type inferred from the values. """
return lib.infer_dtype(self)

def _is_memory_usage_qualified(self):
Expand Down Expand Up @@ -2034,7 +2044,7 @@ def __contains__(self, key):
return False

_index_shared_docs['contains'] = """
return a boolean if this key is IN the index
Return a boolean if this key is IN the index.

Parameters
----------
Expand Down Expand Up @@ -2109,7 +2119,7 @@ def _can_hold_identifiers_and_holds_name(self, name):

def append(self, other):
"""
Append a collection of Index options together
Append a collection of Index options together.

Parameters
----------
Expand Down Expand Up @@ -2152,7 +2162,7 @@ def _concat_same_dtype(self, to_concat, name):
return _concat._concat_index_asobject(to_concat, name)

_index_shared_docs['take'] = """
return a new %(klass)s of the values selected by the indices
Return a new %(klass)s of the values selected by the indices.

For internal compatibility with numpy arrays.

Expand Down Expand Up @@ -2345,7 +2355,7 @@ def notna(self):

def putmask(self, mask, value):
"""
return a new Index of the values set with the mask
Return a new Index of the values set with the mask.

See Also
--------
Expand All @@ -2364,7 +2374,7 @@ def putmask(self, mask, value):

def format(self, name=False, formatter=None, **kwargs):
"""
Render a string representation of the Index
Render a string representation of the Index.
"""
header = []
if name:
Expand Down Expand Up @@ -2461,8 +2471,9 @@ def equals(self, other):
return False

def identical(self, other):
"""Similar to equals, but check that other comparable attributes are
also equal
"""
Similar to equals, but check that other comparable attributes are
also equal.
"""
return (self.equals(other) and
all((getattr(self, c, None) == getattr(other, c, None)
Expand Down
4 changes: 2 additions & 2 deletions pandas/core/indexes/multi.py
Original file line number Diff line number Diff line change
Expand Up @@ -1195,14 +1195,14 @@ def to_frame(self, index=True, name=None):

def to_hierarchical(self, n_repeat, n_shuffle=1):
"""
.. deprecated:: 0.24.0

Return a MultiIndex reshaped to conform to the
shapes given by n_repeat and n_shuffle.

Useful to replicate and rearrange a MultiIndex for combination
with another Index with n_repeat items.

.. deprecated:: 0.24.0

Parameters
----------
n_repeat : int
Expand Down
8 changes: 5 additions & 3 deletions pandas/core/indexes/range.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,9 @@ def ensure_int(value, field):

@classmethod
def from_range(cls, data, name=None, dtype=None, **kwargs):
""" create RangeIndex from a range (py3), or xrange (py2) object """
"""
Create RangeIndex from a range (py3), or xrange (py2) object.
"""
if not isinstance(data, range):
raise TypeError(
'{0}(...) must be called with object coercible to a '
Expand Down Expand Up @@ -206,14 +208,14 @@ def nbytes(self):
"""
Return the number of bytes in the underlying data
On implementations where this is undetermined (PyPy)
assume 24 bytes for each value
assume 24 bytes for each value.
"""
return sum(getsizeof(getattr(self, v), 24) for v in
['_start', '_stop', '_step'])

def memory_usage(self, deep=False):
"""
Memory usage of my values
Memory usage of my values.

Parameters
----------
Expand Down
10 changes: 5 additions & 5 deletions pandas/core/resample.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ def _wrap_result(self, result):

def pad(self, limit=None):
"""
Forward fill the values
Forward fill the values.

Parameters
----------
Expand Down Expand Up @@ -757,8 +757,8 @@ def interpolate(self, method='linear', axis=0, limit=None, inplace=False,

def asfreq(self, fill_value=None):
"""
return the values at the new freq,
essentially a reindex
Return the values at the new freq,
essentially a reindex.

Parameters
----------
Expand All @@ -777,7 +777,7 @@ def asfreq(self, fill_value=None):

def std(self, ddof=1, *args, **kwargs):
"""
Compute standard deviation of groups, excluding missing values
Compute standard deviation of groups, excluding missing values.

Parameters
----------
Expand All @@ -789,7 +789,7 @@ def std(self, ddof=1, *args, **kwargs):

def var(self, ddof=1, *args, **kwargs):
"""
Compute variance of groups, excluding missing values
Compute variance of groups, excluding missing values.

Parameters
----------
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -995,7 +995,7 @@ def sum(self, *args, **kwargs):
return self._apply('roll_sum', 'sum', **kwargs)

_shared_docs['max'] = dedent("""
%(name)s maximum
Calculate the %(name)s maximum.
""")

def max(self, *args, **kwargs):
Expand Down
2 changes: 1 addition & 1 deletion pandas/io/json/normalize.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def json_normalize(data, record_path=None, meta=None,
errors='raise',
sep='.'):
"""
"Normalize" semi-structured JSON data into a flat table
Normalize semi-structured JSON data into a flat table

Parameters
----------
Expand Down
2 changes: 1 addition & 1 deletion pandas/io/pytables.py
Original file line number Diff line number Diff line change
Expand Up @@ -1217,7 +1217,7 @@ def copy(self, file, mode='w', propindexes=True, keys=None, complib=None,

def info(self):
"""
print detailed information on the store
Print detailed information on the store

.. versionadded:: 0.21.0
"""
Expand Down