Skip to content

Commit 41778b0

Browse files
alanderexjreback
authored andcommitted
Fix quotes position in pandas.core, typos and misspelled parameters. (#25093)
1 parent bb43726 commit 41778b0

File tree

7 files changed

+76
-44
lines changed

7 files changed

+76
-44
lines changed

pandas/core/accessor.py

+11-7
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,15 @@ class DirNamesMixin(object):
1616
['asobject', 'base', 'data', 'flags', 'itemsize', 'strides'])
1717

1818
def _dir_deletions(self):
19-
""" delete unwanted __dir__ for this object """
19+
"""
20+
Delete unwanted __dir__ for this object.
21+
"""
2022
return self._accessors | self._deprecations
2123

2224
def _dir_additions(self):
23-
""" add additional __dir__ for this object """
25+
"""
26+
Add additional __dir__ for this object.
27+
"""
2428
rv = set()
2529
for accessor in self._accessors:
2630
try:
@@ -33,7 +37,7 @@ def _dir_additions(self):
3337
def __dir__(self):
3438
"""
3539
Provide method name lookup and completion
36-
Only provide 'public' methods
40+
Only provide 'public' methods.
3741
"""
3842
rv = set(dir(type(self)))
3943
rv = (rv - self._dir_deletions()) | self._dir_additions()
@@ -42,7 +46,7 @@ def __dir__(self):
4246

4347
class PandasDelegate(object):
4448
"""
45-
an abstract base class for delegating methods/properties
49+
An abstract base class for delegating methods/properties.
4650
"""
4751

4852
def _delegate_property_get(self, name, *args, **kwargs):
@@ -65,10 +69,10 @@ def _add_delegate_accessors(cls, delegate, accessors, typ,
6569
----------
6670
cls : the class to add the methods/properties to
6771
delegate : the class to get methods/properties & doc-strings
68-
acccessors : string list of accessors to add
72+
accessors : string list of accessors to add
6973
typ : 'property' or 'method'
7074
overwrite : boolean, default False
71-
overwrite the method/property in the target class if it exists
75+
overwrite the method/property in the target class if it exists.
7276
"""
7377

7478
def _create_delegator_property(name):
@@ -117,7 +121,7 @@ def delegate_names(delegate, accessors, typ, overwrite=False):
117121
----------
118122
delegate : object
119123
the class to get methods/properties & doc-strings
120-
acccessors : Sequence[str]
124+
accessors : Sequence[str]
121125
List of accessor to add
122126
typ : {'property', 'method'}
123127
overwrite : boolean, default False

pandas/core/common.py

+29-11
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ class SettingWithCopyWarning(Warning):
3232

3333

3434
def flatten(l):
35-
"""Flatten an arbitrarily nested sequence.
35+
"""
36+
Flatten an arbitrarily nested sequence.
3637
3738
Parameters
3839
----------
@@ -160,44 +161,56 @@ def cast_scalar_indexer(val):
160161

161162

162163
def _not_none(*args):
163-
"""Returns a generator consisting of the arguments that are not None"""
164+
"""
165+
Returns a generator consisting of the arguments that are not None.
166+
"""
164167
return (arg for arg in args if arg is not None)
165168

166169

167170
def _any_none(*args):
168-
"""Returns a boolean indicating if any argument is None"""
171+
"""
172+
Returns a boolean indicating if any argument is None.
173+
"""
169174
for arg in args:
170175
if arg is None:
171176
return True
172177
return False
173178

174179

175180
def _all_none(*args):
176-
"""Returns a boolean indicating if all arguments are None"""
181+
"""
182+
Returns a boolean indicating if all arguments are None.
183+
"""
177184
for arg in args:
178185
if arg is not None:
179186
return False
180187
return True
181188

182189

183190
def _any_not_none(*args):
184-
"""Returns a boolean indicating if any argument is not None"""
191+
"""
192+
Returns a boolean indicating if any argument is not None.
193+
"""
185194
for arg in args:
186195
if arg is not None:
187196
return True
188197
return False
189198

190199

191200
def _all_not_none(*args):
192-
"""Returns a boolean indicating if all arguments are not None"""
201+
"""
202+
Returns a boolean indicating if all arguments are not None.
203+
"""
193204
for arg in args:
194205
if arg is None:
195206
return False
196207
return True
197208

198209

199210
def count_not_none(*args):
200-
"""Returns the count of arguments that are not None"""
211+
"""
212+
Returns the count of arguments that are not None.
213+
"""
201214
return sum(x is not None for x in args)
202215

203216

@@ -277,7 +290,9 @@ def maybe_make_list(obj):
277290

278291

279292
def is_null_slice(obj):
280-
""" we have a null slice """
293+
"""
294+
We have a null slice.
295+
"""
281296
return (isinstance(obj, slice) and obj.start is None and
282297
obj.stop is None and obj.step is None)
283298

@@ -291,7 +306,9 @@ def is_true_slices(l):
291306

292307
# TODO: used only once in indexing; belongs elsewhere?
293308
def is_full_slice(obj, l):
294-
""" we have a full length slice """
309+
"""
310+
We have a full length slice.
311+
"""
295312
return (isinstance(obj, slice) and obj.start == 0 and obj.stop == l and
296313
obj.step is None)
297314

@@ -316,7 +333,7 @@ def get_callable_name(obj):
316333
def apply_if_callable(maybe_callable, obj, **kwargs):
317334
"""
318335
Evaluate possibly callable input using obj and kwargs if it is callable,
319-
otherwise return as it is
336+
otherwise return as it is.
320337
321338
Parameters
322339
----------
@@ -333,7 +350,8 @@ def apply_if_callable(maybe_callable, obj, **kwargs):
333350

334351
def dict_compat(d):
335352
"""
336-
Helper function to convert datetimelike-keyed dicts to Timestamp-keyed dict
353+
Helper function to convert datetimelike-keyed dicts
354+
to Timestamp-keyed dict.
337355
338356
Parameters
339357
----------

pandas/core/internals/blocks.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ def __init__(self, values, placement, ndim=None):
8787
'{mgr}'.format(val=len(self.values), mgr=len(self.mgr_locs)))
8888

8989
def _check_ndim(self, values, ndim):
90-
"""ndim inference and validation.
90+
"""
91+
ndim inference and validation.
9192
9293
Infers ndim from 'values' if not provided to __init__.
9394
Validates that values.ndim and ndim are consistent if and only if

pandas/core/missing.py

+14-14
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Routines for filling missing data
2+
Routines for filling missing data.
33
"""
44
from distutils.version import LooseVersion
55
import operator
@@ -116,7 +116,7 @@ def interpolate_1d(xvalues, yvalues, method='linear', limit=None,
116116
xvalues and yvalues will each be 1-d arrays of the same length.
117117
118118
Bounds_error is currently hardcoded to False since non-scipy ones don't
119-
take it as an argumnet.
119+
take it as an argument.
120120
"""
121121
# Treat the original, non-scipy methods first.
122122

@@ -244,9 +244,9 @@ def interpolate_1d(xvalues, yvalues, method='linear', limit=None,
244244
def _interpolate_scipy_wrapper(x, y, new_x, method, fill_value=None,
245245
bounds_error=False, order=None, **kwargs):
246246
"""
247-
passed off to scipy.interpolate.interp1d. method is scipy's kind.
247+
Passed off to scipy.interpolate.interp1d. method is scipy's kind.
248248
Returns an array interpolated at new_x. Add any new methods to
249-
the list in _clean_interp_method
249+
the list in _clean_interp_method.
250250
"""
251251
try:
252252
from scipy import interpolate
@@ -314,7 +314,7 @@ def _interpolate_scipy_wrapper(x, y, new_x, method, fill_value=None,
314314

315315
def _from_derivatives(xi, yi, x, order=None, der=0, extrapolate=False):
316316
"""
317-
Convenience function for interpolate.BPoly.from_derivatives
317+
Convenience function for interpolate.BPoly.from_derivatives.
318318
319319
Construct a piecewise polynomial in the Bernstein basis, compatible
320320
with the specified values and derivatives at breakpoints.
@@ -325,7 +325,7 @@ def _from_derivatives(xi, yi, x, order=None, der=0, extrapolate=False):
325325
sorted 1D array of x-coordinates
326326
yi : array_like or list of array-likes
327327
yi[i][j] is the j-th derivative known at xi[i]
328-
orders : None or int or array_like of ints. Default: None.
328+
order: None or int or array_like of ints. Default: None.
329329
Specifies the degree of local polynomials. If not None, some
330330
derivatives are ignored.
331331
der : int or list
@@ -344,8 +344,7 @@ def _from_derivatives(xi, yi, x, order=None, der=0, extrapolate=False):
344344
Returns
345345
-------
346346
y : scalar or array_like
347-
The result, of length R or length M or M by R,
348-
347+
The result, of length R or length M or M by R.
349348
"""
350349
import scipy
351350
from scipy import interpolate
@@ -418,8 +417,9 @@ def _akima_interpolate(xi, yi, x, der=0, axis=0):
418417

419418
def interpolate_2d(values, method='pad', axis=0, limit=None, fill_value=None,
420419
dtype=None):
421-
""" perform an actual interpolation of values, values will be make 2-d if
422-
needed fills inplace, returns the result
420+
"""
421+
Perform an actual interpolation of values, values will be make 2-d if
422+
needed fills inplace, returns the result.
423423
"""
424424

425425
transf = (lambda x: x) if axis == 0 else (lambda x: x.T)
@@ -533,13 +533,13 @@ def clean_reindex_fill_method(method):
533533

534534
def fill_zeros(result, x, y, name, fill):
535535
"""
536-
if this is a reversed op, then flip x,y
536+
If this is a reversed op, then flip x,y
537537
538-
if we have an integer value (or array in y)
538+
If we have an integer value (or array in y)
539539
and we have 0's, fill them with the fill,
540-
return the result
540+
return the result.
541541
542-
mask the nan's from x
542+
Mask the nan's from x.
543543
"""
544544
if fill is None or is_float_dtype(result):
545545
return result

pandas/core/resample.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636

3737

3838
class Resampler(_GroupBy):
39-
4039
"""
4140
Class for resampling datetimelike data, a groupby-like operation.
4241
See aggregate, transform, and apply functions on this object.
@@ -107,7 +106,7 @@ def __iter__(self):
107106
Returns
108107
-------
109108
Generator yielding sequence of (name, subsetted object)
110-
for each group
109+
for each group.
111110
112111
See Also
113112
--------
@@ -286,8 +285,8 @@ def transform(self, arg, *args, **kwargs):
286285
287286
Parameters
288287
----------
289-
func : function
290-
To apply to each group. Should return a Series with the same index
288+
arg : function
289+
To apply to each group. Should return a Series with the same index.
291290
292291
Returns
293292
-------
@@ -423,7 +422,7 @@ def pad(self, limit=None):
423422
424423
Returns
425424
-------
426-
an upsampled Series
425+
An upsampled Series.
427426
428427
See Also
429428
--------

pandas/core/sparse/frame.py

+12-4
Original file line numberDiff line numberDiff line change
@@ -194,15 +194,19 @@ def sp_maker(x):
194194
return to_manager(sdict, columns, index)
195195

196196
def _init_matrix(self, data, index, columns, dtype=None):
197-
""" Init self from ndarray or list of lists """
197+
"""
198+
Init self from ndarray or list of lists.
199+
"""
198200
data = prep_ndarray(data, copy=False)
199201
index, columns = self._prep_index(data, index, columns)
200202
data = {idx: data[:, i] for i, idx in enumerate(columns)}
201203
return self._init_dict(data, index, columns, dtype)
202204

203205
def _init_spmatrix(self, data, index, columns, dtype=None,
204206
fill_value=None):
205-
""" Init self from scipy.sparse matrix """
207+
"""
208+
Init self from scipy.sparse matrix.
209+
"""
206210
index, columns = self._prep_index(data, index, columns)
207211
data = data.tocoo()
208212
N = len(index)
@@ -302,7 +306,9 @@ def __getstate__(self):
302306
_default_kind=self._default_kind)
303307

304308
def _unpickle_sparse_frame_compat(self, state):
305-
""" original pickle format """
309+
"""
310+
Original pickle format
311+
"""
306312
series, cols, idx, fv, kind = state
307313

308314
if not isinstance(cols, Index): # pragma: no cover
@@ -338,7 +344,9 @@ def to_dense(self):
338344
return DataFrame(data, index=self.index, columns=self.columns)
339345

340346
def _apply_columns(self, func):
341-
""" get new SparseDataFrame applying func to each columns """
347+
"""
348+
Get new SparseDataFrame applying func to each columns
349+
"""
342350

343351
new_data = {col: func(series)
344352
for col, series in compat.iteritems(self)}

pandas/core/sparse/scipy_sparse.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ def _get_index_subset_to_coord_dict(index, subset, sort_labels=False):
9090

9191
def _sparse_series_to_coo(ss, row_levels=(0, ), column_levels=(1, ),
9292
sort_labels=False):
93-
""" Convert a SparseSeries to a scipy.sparse.coo_matrix using index
93+
"""
94+
Convert a SparseSeries to a scipy.sparse.coo_matrix using index
9495
levels row_levels, column_levels as the row and column
9596
labels respectively. Returns the sparse_matrix, row and column labels.
9697
"""
@@ -116,7 +117,8 @@ def _sparse_series_to_coo(ss, row_levels=(0, ), column_levels=(1, ),
116117

117118

118119
def _coo_to_sparse_series(A, dense_index=False):
119-
""" Convert a scipy.sparse.coo_matrix to a SparseSeries.
120+
"""
121+
Convert a scipy.sparse.coo_matrix to a SparseSeries.
120122
Use the defaults given in the SparseSeries constructor.
121123
"""
122124
s = Series(A.data, MultiIndex.from_arrays((A.row, A.col)))

0 commit comments

Comments
 (0)