@@ -316,7 +316,7 @@ def _to_dataset_whole(self, name=None, shallow_copy=True):
316
316
if name in self .coords :
317
317
raise ValueError ('cannot create a Dataset from a DataArray with '
318
318
'the same name as one of its coordinates' )
319
- # use private APIs here for speed: this is called by _to_temp_dataset(),
319
+ # use private APIs for speed: this is called by _to_temp_dataset(),
320
320
# which is used in the guts of a lot of operations (e.g., reindex)
321
321
variables = self ._coords .copy ()
322
322
variables [name ] = self .variable
@@ -428,9 +428,9 @@ def to_index(self):
428
428
def dims (self ):
429
429
"""Tuple of dimension names associated with this array.
430
430
431
- Note that the type of this property is inconsistent with `Dataset.dims`.
432
- See `Dataset.sizes` and `DataArray.sizes` for consistently named
433
- properties.
431
+ Note that the type of this property is inconsistent with
432
+ `Dataset.dims`. See `Dataset.sizes` and `DataArray.sizes` for
433
+ consistently named properties.
434
434
"""
435
435
return self .variable .dims
436
436
@@ -868,12 +868,11 @@ def reindex(self, method=None, tolerance=None, copy=True, **indexers):
868
868
Maximum distance between original and new labels for inexact
869
869
matches. The values of the index at the matching locations most
870
870
satisfy the equation ``abs(index[indexer] - target) <= tolerance``.
871
- Requires pandas>=0.17.
872
871
**indexers : dict
873
872
Dictionary with keys given by dimension names and values given by
874
- arrays of coordinates tick labels. Any mis-matched coordinate values
875
- will be filled in with NaN, and any mis-matched dimension names will
876
- simply be ignored.
873
+ arrays of coordinates tick labels. Any mis-matched coordinate
874
+ values will be filled in with NaN, and any mis-matched dimension
875
+ names will simply be ignored.
877
876
878
877
Returns
879
878
-------
@@ -943,8 +942,8 @@ def swap_dims(self, dims_dict):
943
942
return self ._from_temp_dataset (ds )
944
943
945
944
def expand_dims (self , dim , axis = None ):
946
- """Return a new object with an additional axis (or axes) inserted at the
947
- corresponding position in the array shape.
945
+ """Return a new object with an additional axis (or axes) inserted at
946
+ the corresponding position in the array shape.
948
947
949
948
If dim is already a scalar coordinate, it will be promoted to a 1D
950
949
coordinate consisting of a single value.
@@ -970,16 +969,17 @@ def expand_dims(self, dim, axis=None):
970
969
return self ._from_temp_dataset (ds )
971
970
972
971
def set_index (self , append = False , inplace = False , ** indexes ):
973
- """Set DataArray (multi-)indexes using one or more existing coordinates.
972
+ """Set DataArray (multi-)indexes using one or more existing
973
+ coordinates.
974
974
975
975
Parameters
976
976
----------
977
977
append : bool, optional
978
978
If True, append the supplied index(es) to the existing index(es).
979
979
Otherwise replace the existing index(es) (default).
980
980
inplace : bool, optional
981
- If True, set new index(es) in-place. Otherwise, return a new DataArray
982
- object.
981
+ If True, set new index(es) in-place. Otherwise, return a new
982
+ DataArray object.
983
983
**indexes : {dim: index, ...}
984
984
Keyword arguments with names matching dimensions and values given
985
985
by (lists of) the names of existing coordinates or variables to set
@@ -988,7 +988,7 @@ def set_index(self, append=False, inplace=False, **indexes):
988
988
Returns
989
989
-------
990
990
obj : DataArray
991
- Another dataarray, with this dataarray's data but replaced coordinates.
991
+ Another dataarray, with this data but replaced coordinates.
992
992
993
993
See Also
994
994
--------
@@ -1607,9 +1607,9 @@ def from_series(cls, series):
1607
1607
"""Convert a pandas.Series into an xarray.DataArray.
1608
1608
1609
1609
If the series's index is a MultiIndex, it will be expanded into a
1610
- tensor product of one-dimensional coordinates (filling in missing values
1611
- with NaN). Thus this operation should be the inverse of the `to_series`
1612
- method.
1610
+ tensor product of one-dimensional coordinates (filling in missing
1611
+ values with NaN). Thus this operation should be the inverse of the
1612
+ `to_series` method.
1613
1613
"""
1614
1614
# TODO: add a 'name' parameter
1615
1615
name = series .name
@@ -2089,16 +2089,16 @@ def quantile(self, q, dim=None, interpolation='linear', keep_attrs=False):
2089
2089
numpy.nanpercentile, pandas.Series.quantile, Dataset.quantile
2090
2090
"""
2091
2091
2092
- ds = self ._to_temp_dataset ().quantile (q , dim = dim , keep_attrs = keep_attrs ,
2093
- interpolation = interpolation )
2092
+ ds = self ._to_temp_dataset ().quantile (
2093
+ q , dim = dim , keep_attrs = keep_attrs , interpolation = interpolation )
2094
2094
return self ._from_temp_dataset (ds )
2095
2095
2096
2096
def rank (self , dim , pct = False , keep_attrs = False ):
2097
2097
"""Ranks the data.
2098
2098
2099
2099
Equal values are assigned a rank that is the average of the ranks that
2100
- would have been otherwise assigned to all of the values within that set.
2101
- Ranks begin at 1, not 0. If pct is True , computes percentage ranks.
2100
+ would have been otherwise assigned to all of the values within that
2101
+ set. Ranks begin at 1, not 0. If pct, computes percentage ranks.
2102
2102
2103
2103
NaNs in the input array are returned as NaNs.
2104
2104
0 commit comments