Skip to content

DOC: Fix quotes position in Series docstrings #24065

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
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
10 changes: 7 additions & 3 deletions pandas/core/accessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ def __dir__(self):


class PandasDelegate(object):
""" an abstract base class for delegating methods/properties """
"""
an abstract base class for delegating methods/properties
"""

def _delegate_property_get(self, name, *args, **kwargs):
raise TypeError("You cannot access the "
Expand Down Expand Up @@ -146,7 +148,8 @@ def add_delegate_accessors(cls):
# 2. We use a UserWarning instead of a custom Warning

class CachedAccessor(object):
"""Custom property-like object (descriptor) for caching accessors.
"""
Custom property-like object (descriptor) for caching accessors.

Parameters
----------
Expand Down Expand Up @@ -189,7 +192,8 @@ def decorator(accessor):
return decorator


_doc = """Register a custom accessor on %(klass)s objects.
_doc = """\
Register a custom accessor on %(klass)s objects.

Parameters
----------
Expand Down
75 changes: 50 additions & 25 deletions pandas/core/arrays/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@


class ExtensionArray(object):
"""Abstract base class for custom 1-D array types.
"""
Abstract base class for custom 1-D array types.

pandas will recognize instances of this class as proper arrays
with a custom type and will not attempt to coerce them to objects. They
Expand Down Expand Up @@ -100,7 +101,8 @@ class ExtensionArray(object):
# ------------------------------------------------------------------------
@classmethod
def _from_sequence(cls, scalars, dtype=None, copy=False):
"""Construct a new ExtensionArray from a sequence of scalars.
"""
Construct a new ExtensionArray from a sequence of scalars.

Parameters
----------
Expand All @@ -121,7 +123,8 @@ def _from_sequence(cls, scalars, dtype=None, copy=False):

@classmethod
def _from_factorized(cls, values, original):
"""Reconstruct an ExtensionArray after factorization.
"""
Reconstruct an ExtensionArray after factorization.

Parameters
----------
Expand All @@ -143,7 +146,8 @@ def _from_factorized(cls, values, original):

def __getitem__(self, item):
# type (Any) -> Any
"""Select a subset of self.
"""
Select a subset of self.

Parameters
----------
Expand Down Expand Up @@ -174,7 +178,8 @@ def __getitem__(self, item):

def __setitem__(self, key, value):
# type: (Union[int, np.ndarray], Any) -> None
"""Set one or more values inplace.
"""
Set one or more values inplace.

This method is not required to satisfy the pandas extension array
interface.
Expand Down Expand Up @@ -219,7 +224,8 @@ def __setitem__(self, key, value):

def __len__(self):
# type: () -> int
"""Length of this array
"""
Length of this array

Returns
-------
Expand All @@ -228,8 +234,8 @@ def __len__(self):
raise AbstractMethodError(self)

def __iter__(self):
"""Iterate over elements of the array.

"""
Iterate over elements of the array.
"""
# This needs to be implemented so that pandas recognizes extension
# arrays as list-like. The default implementation makes successive
Expand All @@ -243,26 +249,32 @@ def __iter__(self):
@property
def dtype(self):
# type: () -> ExtensionDtype
"""An instance of 'ExtensionDtype'."""
"""
An instance of 'ExtensionDtype'.
"""
raise AbstractMethodError(self)

@property
def shape(self):
# type: () -> Tuple[int, ...]
"""Return a tuple of the array dimensions."""
"""
Return a tuple of the array dimensions.
"""
return (len(self),)

@property
def ndim(self):
# type: () -> int
"""Extension Arrays are only allowed to be 1-dimensional."""
"""
Extension Arrays are only allowed to be 1-dimensional.
"""
return 1

@property
def nbytes(self):
# type: () -> int
"""The number of bytes needed to store this object in memory.

"""
The number of bytes needed to store this object in memory.
"""
# If this is expensive to compute, return an approximate lower bound
# on the number of bytes needed.
Expand All @@ -272,7 +284,8 @@ def nbytes(self):
# Additional Methods
# ------------------------------------------------------------------------
def astype(self, dtype, copy=True):
"""Cast to a NumPy array with 'dtype'.
"""
Cast to a NumPy array with 'dtype'.

Parameters
----------
Expand Down Expand Up @@ -315,7 +328,8 @@ def isna(self):

def _values_for_argsort(self):
# type: () -> ndarray
"""Return values for sorting.
"""
Return values for sorting.

Returns
-------
Expand Down Expand Up @@ -365,7 +379,8 @@ def argsort(self, ascending=True, kind='quicksort', *args, **kwargs):
return result

def fillna(self, value=None, method=None, limit=None):
""" Fill NA/NaN values using the specified method.
"""
Fill NA/NaN values using the specified method.

Parameters
----------
Expand Down Expand Up @@ -418,7 +433,8 @@ def fillna(self, value=None, method=None, limit=None):
return new_values

def dropna(self):
""" Return ExtensionArray without NA values
"""
Return ExtensionArray without NA values

Returns
-------
Expand Down Expand Up @@ -462,7 +478,8 @@ def shift(self, periods=1):
return self._concat_same_type([a, b])

def unique(self):
"""Compute the ExtensionArray of unique values.
"""
Compute the ExtensionArray of unique values.

Returns
-------
Expand All @@ -475,7 +492,8 @@ def unique(self):

def _values_for_factorize(self):
# type: () -> Tuple[ndarray, Any]
"""Return an array and missing value suitable for factorization.
"""
Return an array and missing value suitable for factorization.

Returns
-------
Expand All @@ -499,7 +517,8 @@ def _values_for_factorize(self):

def factorize(self, na_sentinel=-1):
# type: (int) -> Tuple[ndarray, ExtensionArray]
"""Encode the extension array as an enumerated type.
"""
Encode the extension array as an enumerated type.

Parameters
----------
Expand Down Expand Up @@ -552,7 +571,8 @@ def factorize(self, na_sentinel=-1):

def take(self, indices, allow_fill=False, fill_value=None):
# type: (Sequence[int], bool, Optional[Any]) -> ExtensionArray
"""Take elements from an array.
"""
Take elements from an array.

Parameters
----------
Expand Down Expand Up @@ -641,7 +661,8 @@ def take(self, indices, allow_fill=False, fill_value=None):

def copy(self, deep=False):
# type: (bool) -> ExtensionArray
"""Return a copy of the array.
"""
Return a copy of the array.

Parameters
----------
Expand All @@ -661,13 +682,16 @@ def copy(self, deep=False):
def _formatting_values(self):
# type: () -> np.ndarray
# At the moment, this has to be an array since we use result.dtype
"""An array of values to be printed in, e.g. the Series repr"""
"""
An array of values to be printed in, e.g. the Series repr
"""
return np.array(self)

@classmethod
def _concat_same_type(cls, to_concat):
# type: (Sequence[ExtensionArray]) -> ExtensionArray
"""Concatenate multiple array
"""
Concatenate multiple array

Parameters
----------
Expand All @@ -689,7 +713,8 @@ def _concat_same_type(cls, to_concat):
@property
def _ndarray_values(self):
# type: () -> np.ndarray
"""Internal pandas method for lossy conversion to a NumPy ndarray.
"""
Internal pandas method for lossy conversion to a NumPy ndarray.

This method is not part of the pandas interface.

Expand Down
Loading