@@ -1065,7 +1065,7 @@ def from_dict(cls, data, orient='columns', dtype=None, columns=None):
1065
1065
1066
1066
Returns
1067
1067
-------
1068
- pandas. DataFrame
1068
+ DataFrame
1069
1069
1070
1070
See Also
1071
1071
--------
@@ -1145,7 +1145,7 @@ def to_numpy(self, dtype=None, copy=False):
1145
1145
1146
1146
Returns
1147
1147
-------
1148
- array : numpy.ndarray
1148
+ numpy.ndarray
1149
1149
1150
1150
See Also
1151
1151
--------
@@ -1439,7 +1439,7 @@ def from_records(cls, data, index=None, exclude=None, columns=None,
1439
1439
1440
1440
Returns
1441
1441
-------
1442
- df : DataFrame
1442
+ DataFrame
1443
1443
"""
1444
1444
1445
1445
# Make a copy of the input columns so we can modify it
@@ -1755,7 +1755,7 @@ def from_items(cls, items, columns=None, orient='columns'):
1755
1755
1756
1756
Returns
1757
1757
-------
1758
- frame : DataFrame
1758
+ DataFrame
1759
1759
"""
1760
1760
1761
1761
warnings .warn ("from_items is deprecated. Please use "
@@ -1866,7 +1866,7 @@ def from_csv(cls, path, header=0, sep=',', index_col=0, parse_dates=True,
1866
1866
1867
1867
Returns
1868
1868
-------
1869
- y : DataFrame
1869
+ DataFrame
1870
1870
1871
1871
See Also
1872
1872
--------
@@ -1956,7 +1956,7 @@ def to_panel(self):
1956
1956
1957
1957
Returns
1958
1958
-------
1959
- panel : Panel
1959
+ Panel
1960
1960
"""
1961
1961
raise NotImplementedError ("Panel is being removed in pandas 0.25.0." )
1962
1962
@@ -2478,7 +2478,7 @@ def memory_usage(self, index=True, deep=False):
2478
2478
2479
2479
Returns
2480
2480
-------
2481
- sizes : Series
2481
+ Series
2482
2482
A Series whose index is the original column names and whose values
2483
2483
is the memory usage of each column in bytes.
2484
2484
@@ -2696,7 +2696,7 @@ def get_value(self, index, col, takeable=False):
2696
2696
2697
2697
Returns
2698
2698
-------
2699
- value : scalar value
2699
+ scalar value
2700
2700
"""
2701
2701
2702
2702
warnings .warn ("get_value is deprecated and will be removed "
@@ -2741,7 +2741,7 @@ def set_value(self, index, col, value, takeable=False):
2741
2741
2742
2742
Returns
2743
2743
-------
2744
- frame : DataFrame
2744
+ DataFrame
2745
2745
If label pair is contained, will be reference to calling DataFrame,
2746
2746
otherwise a new object
2747
2747
"""
@@ -3177,7 +3177,7 @@ def select_dtypes(self, include=None, exclude=None):
3177
3177
3178
3178
Returns
3179
3179
-------
3180
- subset : DataFrame
3180
+ DataFrame
3181
3181
The subset of the frame including the dtypes in ``include`` and
3182
3182
excluding the dtypes in ``exclude``.
3183
3183
@@ -3542,7 +3542,7 @@ def _sanitize_column(self, key, value, broadcast=True):
3542
3542
3543
3543
Returns
3544
3544
-------
3545
- sanitized_column : numpy-array
3545
+ numpy.ndarray
3546
3546
"""
3547
3547
3548
3548
def reindexer (value ):
@@ -3811,7 +3811,7 @@ def drop(self, labels=None, axis=0, index=None, columns=None,
3811
3811
3812
3812
Returns
3813
3813
-------
3814
- dropped : pandas. DataFrame
3814
+ DataFrame
3815
3815
3816
3816
Raises
3817
3817
------
@@ -3936,7 +3936,7 @@ def rename(self, *args, **kwargs):
3936
3936
3937
3937
Returns
3938
3938
-------
3939
- renamed : DataFrame
3939
+ DataFrame
3940
3940
3941
3941
See Also
3942
3942
--------
@@ -4579,7 +4579,7 @@ def drop_duplicates(self, subset=None, keep='first', inplace=False):
4579
4579
4580
4580
Returns
4581
4581
-------
4582
- deduplicated : DataFrame
4582
+ DataFrame
4583
4583
"""
4584
4584
if self .empty :
4585
4585
return self .copy ()
@@ -4613,7 +4613,7 @@ def duplicated(self, subset=None, keep='first'):
4613
4613
4614
4614
Returns
4615
4615
-------
4616
- duplicated : Series
4616
+ Series
4617
4617
"""
4618
4618
from pandas .core .sorting import get_group_index
4619
4619
from pandas ._libs .hashtable import duplicated_int64 , _SIZE_HINT_LIMIT
@@ -4981,7 +4981,7 @@ def swaplevel(self, i=-2, j=-1, axis=0):
4981
4981
4982
4982
Returns
4983
4983
-------
4984
- swapped : same type as caller (new object)
4984
+ DataFrame
4985
4985
4986
4986
.. versionchanged:: 0.18.1
4987
4987
@@ -5260,7 +5260,7 @@ def combine_first(self, other):
5260
5260
5261
5261
Returns
5262
5262
-------
5263
- combined : DataFrame
5263
+ DataFrame
5264
5264
5265
5265
See Also
5266
5266
--------
@@ -5621,7 +5621,7 @@ def pivot(self, index=None, columns=None, values=None):
5621
5621
5622
5622
Returns
5623
5623
-------
5624
- table : DataFrame
5624
+ DataFrame
5625
5625
5626
5626
See Also
5627
5627
--------
@@ -5907,7 +5907,7 @@ def unstack(self, level=-1, fill_value=None):
5907
5907
5908
5908
Returns
5909
5909
-------
5910
- unstacked : DataFrame or Series
5910
+ Series or DataFrame
5911
5911
5912
5912
See Also
5913
5913
--------
@@ -6073,7 +6073,7 @@ def diff(self, periods=1, axis=0):
6073
6073
6074
6074
Returns
6075
6075
-------
6076
- diffed : DataFrame
6076
+ DataFrame
6077
6077
6078
6078
See Also
6079
6079
--------
@@ -6345,7 +6345,7 @@ def apply(self, func, axis=0, broadcast=None, raw=False, reduce=None,
6345
6345
6346
6346
Returns
6347
6347
-------
6348
- applied : Series or DataFrame
6348
+ Series or DataFrame
6349
6349
6350
6350
See Also
6351
6351
--------
@@ -6538,7 +6538,7 @@ def append(self, other, ignore_index=False,
6538
6538
6539
6539
Returns
6540
6540
-------
6541
- appended : DataFrame
6541
+ DataFrame
6542
6542
6543
6543
See Also
6544
6544
--------
@@ -6956,12 +6956,13 @@ def corr(self, method='pearson', min_periods=1):
6956
6956
6957
6957
min_periods : int, optional
6958
6958
Minimum number of observations required per pair of columns
6959
- to have a valid result. Currently only available for pearson
6960
- and spearman correlation
6959
+ to have a valid result. Currently only available for Pearson
6960
+ and Spearman correlation.
6961
6961
6962
6962
Returns
6963
6963
-------
6964
- y : DataFrame
6964
+ DataFrame
6965
+ Correlation matrix.
6965
6966
6966
6967
See Also
6967
6968
--------
@@ -6970,14 +6971,15 @@ def corr(self, method='pearson', min_periods=1):
6970
6971
6971
6972
Examples
6972
6973
--------
6973
- >>> histogram_intersection = lambda a, b: np.minimum(a, b
6974
- ... ).sum().round(decimals=1)
6974
+ >>> def histogram_intersection(a, b):
6975
+ ... v = np.minimum(a, b).sum().round(decimals=1)
6976
+ ... return v
6975
6977
>>> df = pd.DataFrame([(.2, .3), (.0, .6), (.6, .0), (.2, .1)],
6976
6978
... columns=['dogs', 'cats'])
6977
6979
>>> df.corr(method=histogram_intersection)
6978
- dogs cats
6979
- dogs 1.0 0.3
6980
- cats 0.3 1.0
6980
+ dogs cats
6981
+ dogs 1.0 0.3
6982
+ cats 0.3 1.0
6981
6983
"""
6982
6984
numeric_df = self ._get_numeric_data ()
6983
6985
cols = numeric_df .columns
@@ -7140,10 +7142,11 @@ def corrwith(self, other, axis=0, drop=False, method='pearson'):
7140
7142
Parameters
7141
7143
----------
7142
7144
other : DataFrame, Series
7145
+ Object with which to compute correlations.
7143
7146
axis : {0 or 'index', 1 or 'columns'}, default 0
7144
- 0 or 'index' to compute column-wise, 1 or 'columns' for row-wise
7145
- drop : boolean , default False
7146
- Drop missing indices from result
7147
+ 0 or 'index' to compute column-wise, 1 or 'columns' for row-wise.
7148
+ drop : bool , default False
7149
+ Drop missing indices from result.
7147
7150
method : {'pearson', 'kendall', 'spearman'} or callable
7148
7151
* pearson : standard correlation coefficient
7149
7152
* kendall : Kendall Tau correlation coefficient
@@ -7155,7 +7158,8 @@ def corrwith(self, other, axis=0, drop=False, method='pearson'):
7155
7158
7156
7159
Returns
7157
7160
-------
7158
- correls : Series
7161
+ Series
7162
+ Pairwise correlations.
7159
7163
7160
7164
See Also
7161
7165
-------
@@ -7485,7 +7489,7 @@ def nunique(self, axis=0, dropna=True):
7485
7489
7486
7490
Returns
7487
7491
-------
7488
- nunique : Series
7492
+ Series
7489
7493
7490
7494
See Also
7491
7495
--------
@@ -7523,7 +7527,8 @@ def idxmin(self, axis=0, skipna=True):
7523
7527
7524
7528
Returns
7525
7529
-------
7526
- idxmin : Series
7530
+ Series
7531
+ Indexes of minima along the specified axis.
7527
7532
7528
7533
Raises
7529
7534
------
@@ -7559,7 +7564,8 @@ def idxmax(self, axis=0, skipna=True):
7559
7564
7560
7565
Returns
7561
7566
-------
7562
- idxmax : Series
7567
+ Series
7568
+ Indexes of maxima along the specified axis.
7563
7569
7564
7570
Raises
7565
7571
------
@@ -7706,7 +7712,7 @@ def quantile(self, q=0.5, axis=0, numeric_only=True,
7706
7712
7707
7713
Returns
7708
7714
-------
7709
- quantiles : Series or DataFrame
7715
+ Series or DataFrame
7710
7716
7711
7717
If ``q`` is an array, a DataFrame will be returned where the
7712
7718
index is ``q``, the columns are the columns of self, and the
@@ -7776,19 +7782,19 @@ def to_timestamp(self, freq=None, how='start', axis=0, copy=True):
7776
7782
7777
7783
Parameters
7778
7784
----------
7779
- freq : string , default frequency of PeriodIndex
7780
- Desired frequency
7785
+ freq : str , default frequency of PeriodIndex
7786
+ Desired frequency.
7781
7787
how : {'s', 'e', 'start', 'end'}
7782
7788
Convention for converting period to timestamp; start of period
7783
- vs. end
7789
+ vs. end.
7784
7790
axis : {0 or 'index', 1 or 'columns'}, default 0
7785
- The axis to convert (the index by default)
7786
- copy : boolean , default True
7787
- If false then underlying input data is not copied
7791
+ The axis to convert (the index by default).
7792
+ copy : bool , default True
7793
+ If False then underlying input data is not copied.
7788
7794
7789
7795
Returns
7790
7796
-------
7791
- df : DataFrame with DatetimeIndex
7797
+ DataFrame with DatetimeIndex
7792
7798
"""
7793
7799
new_data = self ._data
7794
7800
if copy :
@@ -7812,15 +7818,16 @@ def to_period(self, freq=None, axis=0, copy=True):
7812
7818
7813
7819
Parameters
7814
7820
----------
7815
- freq : string, default
7821
+ freq : str, default
7822
+ Frequency of the PeriodIndex.
7816
7823
axis : {0 or 'index', 1 or 'columns'}, default 0
7817
- The axis to convert (the index by default)
7818
- copy : boolean , default True
7819
- If False then underlying input data is not copied
7824
+ The axis to convert (the index by default).
7825
+ copy : bool , default True
7826
+ If False then underlying input data is not copied.
7820
7827
7821
7828
Returns
7822
7829
-------
7823
- ts : TimeSeries with PeriodIndex
7830
+ TimeSeries with PeriodIndex
7824
7831
"""
7825
7832
new_data = self ._data
7826
7833
if copy :
@@ -7893,7 +7900,7 @@ def isin(self, values):
7893
7900
match. Note that 'falcon' does not match based on the number of legs
7894
7901
in df2.
7895
7902
7896
- >>> other = pd.DataFrame({'num_legs': [8, 2],'num_wings': [0, 2]},
7903
+ >>> other = pd.DataFrame({'num_legs': [8, 2], 'num_wings': [0, 2]},
7897
7904
... index=['spider', 'falcon'])
7898
7905
>>> df.isin(other)
7899
7906
num_legs num_wings
0 commit comments