Skip to content

DOC: Capitalize docstring summaries of Series #23647

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

Merged
merged 16 commits into from
Nov 21, 2018
Merged
Show file tree
Hide file tree
Changes from 15 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
4 changes: 4 additions & 0 deletions pandas/core/arrays/sparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -1861,6 +1861,10 @@ def _make_index(length, indices, kind):
'sp_values'],
typ='property')
class SparseAccessor(PandasDelegate):
"""
Accessor for SparseSparse from other sparse matrix data types.
"""

def __init__(self, data=None):
self._validate(data)
# Store the Series since we need that for to_coo
Expand Down
57 changes: 38 additions & 19 deletions pandas/core/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -668,12 +668,14 @@ class IndexOpsMixin(object):
__array_priority__ = 1000

def transpose(self, *args, **kwargs):
""" return the transpose, which is by definition self """
"""
Return the transpose, which is by definition self.
"""
nv.validate_transpose(args, kwargs)
return self

T = property(transpose, doc="return the transpose, which is by "
"definition self")
T = property(transpose, doc="Return the transpose, which is by "
"definition self.")

@property
def _is_homogeneous_type(self):
Expand All @@ -692,19 +694,22 @@ def _is_homogeneous_type(self):

@property
def shape(self):
""" return a tuple of the shape of the underlying data """
"""
Return a tuple of the shape of the underlying data.
"""
return self._values.shape

@property
def ndim(self):
""" return the number of dimensions of the underlying data,
by definition 1
"""
Return the number of dimensions of the underlying data,
by definition 1.
"""
return 1

def item(self):
""" return the first element of the underlying data as a python
scalar
"""
Return the first element of the underlying data as a python scalar.
"""
try:
return self.values.item()
Expand All @@ -715,50 +720,62 @@ def item(self):

@property
def data(self):
""" return the data pointer of the underlying data """
"""
Return the data pointer of the underlying data.
"""
warnings.warn("{obj}.data is deprecated and will be removed "
"in a future version".format(obj=type(self).__name__),
FutureWarning, stacklevel=2)
return self.values.data

@property
def itemsize(self):
""" return the size of the dtype of the item of the underlying data """
"""
Return the size of the dtype of the item of the underlying data.
"""
warnings.warn("{obj}.itemsize is deprecated and will be removed "
"in a future version".format(obj=type(self).__name__),
FutureWarning, stacklevel=2)
return self._ndarray_values.itemsize

@property
def nbytes(self):
""" return the number of bytes in the underlying data """
"""
Return the number of bytes in the underlying data.
"""
return self._values.nbytes

@property
def strides(self):
""" return the strides of the underlying data """
"""
Return the strides of the underlying data.
"""
warnings.warn("{obj}.strides is deprecated and will be removed "
"in a future version".format(obj=type(self).__name__),
FutureWarning, stacklevel=2)
return self._ndarray_values.strides

@property
def size(self):
""" return the number of elements in the underlying data """
"""
Return the number of elements in the underlying data.
"""
return self._values.size

@property
def flags(self):
""" return the ndarray.flags for the underlying data """
"""
Return the ndarray.flags for the underlying data.
"""
warnings.warn("{obj}.flags is deprecated and will be removed "
"in a future version".format(obj=type(self).__name__),
FutureWarning, stacklevel=2)
return self.values.flags

@property
def base(self):
""" return the base object if the memory of the underlying data is
shared
"""
Return the base object if the memory of the underlying data is shared.
"""
warnings.warn("{obj}.base is deprecated and will be removed "
"in a future version".format(obj=type(self).__name__),
Expand Down Expand Up @@ -818,7 +835,7 @@ def max(self):

def argmax(self, axis=None):
"""
return a ndarray of the maximum argument indexer
Return a ndarray of the maximum argument indexer.

See Also
--------
Expand Down Expand Up @@ -861,7 +878,7 @@ def min(self):

def argmin(self, axis=None):
"""
return a ndarray of the minimum argument indexer
Return a ndarray of the minimum argument indexer.

See Also
--------
Expand Down Expand Up @@ -900,7 +917,9 @@ def __iter__(self):

@cache_readonly
def hasnans(self):
""" return if I have any nans; enables various perf speedups """
"""
Return if I have any nans; enables various perf speedups.
"""
return bool(isna(self).any())

def _reduce(self, op, name, axis=0, skipna=True, numeric_only=None,
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -2331,7 +2331,7 @@ def to_hdf(self, path_or_buf, key, **kwargs):

def to_msgpack(self, path_or_buf=None, encoding='utf-8', **kwargs):
"""
msgpack (serialize) object to input file path
Serialize object to input file path using msgpack format.

THIS IS AN EXPERIMENTAL LIBRARY and the storage format
may not be stable until a future release.
Expand Down
4 changes: 3 additions & 1 deletion pandas/core/indexes/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2243,7 +2243,9 @@ def _nan_idxs(self):

@cache_readonly
def hasnans(self):
""" return if I have any nans; enables various perf speedups """
"""
Return if I have any nans; enables various perf speedups.
"""
if self._can_hold_na:
return bool(self._isnan.any())
else:
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/indexes/datetimelike.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class TimelikeOps(object):

_round_doc = (
"""
{op} the data to the specified `freq`.
Perform {op} operation on the data to the specified `freq`.

Parameters
----------
Expand Down
34 changes: 23 additions & 11 deletions pandas/core/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class Series(base.IndexOpsMixin, generic.NDFrame):
Parameters
----------
data : array-like, Iterable, dict, or scalar value
Contains data stored in Series
Contains data stored in Series.

.. versionchanged :: 0.23.0
If data is a dict, argument order is maintained for Python 3.6
Expand All @@ -133,8 +133,8 @@ class Series(base.IndexOpsMixin, generic.NDFrame):
dtype : str, numpy.dtype, or ExtensionDtype, optional
dtype for the output Series. If not specified, this will be
inferred from `data`.
copy : boolean, default False
Copy input data
copy : bool, default False
Copy input data.
"""
_metadata = ['name']
_accessors = {'dt', 'cat', 'str', 'sparse'}
Expand Down Expand Up @@ -389,22 +389,30 @@ def name(self, value):
# ndarray compatibility
@property
def dtype(self):
""" return the dtype object of the underlying data """
"""
Return the dtype object of the underlying data.
"""
return self._data.dtype

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

@property
def ftype(self):
""" return if the data is sparse|dense """
"""
Return if the data is sparse|dense.
"""
return self._data.ftype

@property
def ftypes(self):
""" return if the data is sparse|dense """
"""
Return if the data is sparse|dense.
"""
return self._data.ftype

@property
Expand Down Expand Up @@ -441,7 +449,9 @@ def values(self):

@property
def _values(self):
""" return the internal repr of this data """
"""
Return the internal repr of this data.
"""
return self._data.internal_values()

def _formatting_values(self):
Expand All @@ -451,7 +461,9 @@ def _formatting_values(self):
return self._data.formatting_values()

def get_values(self):
""" same as values (but handles sparseness conversions); is a view """
"""
Same as values (but handles sparseness conversions); is a view.
"""
return self._data.get_values()

@property
Expand Down Expand Up @@ -3443,9 +3455,9 @@ def rename(self, index=None, **kwargs):
the index.
Scalar or hashable sequence-like will alter the ``Series.name``
attribute.
copy : boolean, default True
copy : bool, default True
Also copy underlying data
inplace : boolean, default False
inplace : bool, default False
Whether to return a new Series. If True then value of copy is
ignored.
level : int or level name, default None
Expand Down