From b6fe33b1126de189ef8f00fc3ee2c531c6aa7825 Mon Sep 17 00:00:00 2001 From: Jeff Reback Date: Thu, 6 Apr 2017 20:56:31 -0400 Subject: [PATCH] remove Panel from doc-strings, catch internal warning on Panel construction --- pandas/core/window.py | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/pandas/core/window.py b/pandas/core/window.py index a61d5b6d90daea..ba565aee305177 100644 --- a/pandas/core/window.py +++ b/pandas/core/window.py @@ -927,8 +927,9 @@ def f(arg, *args, **kwargs): If False then only matching columns between self and other will be used and the output will be a DataFrame. If True then all pairwise combinations will be calculated and the - output will be a Panel in the case of DataFrame inputs. In the case of - missing elements, only complete pairwise observations will be used. + output will be a MultiIndexed DataFrame in the case of DataFrame + inputs. In the case of missing elements, only complete pairwise + observations will be used. ddof : int, default 1 Delta Degrees of Freedom. The divisor used in calculations is ``N - ddof``, where ``N`` represents the number of elements.""") @@ -964,11 +965,12 @@ def _get_cov(X, Y): other : Series, DataFrame, or ndarray, optional if not supplied then will default to self and produce pairwise output pairwise : bool, default None - If False then only matching columns between self and other will be used - and the output will be a DataFrame. + If False then only matching columns between self and other will be + used and the output will be a DataFrame. If True then all pairwise combinations will be calculated and the - output will be a Panel in the case of DataFrame inputs. In the case of - missing elements, only complete pairwise observations will be used.""") + output will be a MultiIndex DataFrame in the case of DataFrame inputs. + In the case of missing elements, only complete pairwise observations + will be used.""") def corr(self, other=None, pairwise=None, **kwargs): if other is None: @@ -1397,8 +1399,9 @@ def _constructor(self): If False then only matching columns between self and other will be used and the output will be a DataFrame. If True then all pairwise combinations will be calculated and the output - will be a Panel in the case of DataFrame inputs. In the case of missing - elements, only complete pairwise observations will be used. + will be a MultiIndex DataFrame in the case of DataFrame inputs. + In the case of missing elements, only complete pairwise observations will + be used. bias : boolean, default False Use a standard estimation bias correction """ @@ -1708,11 +1711,12 @@ def dataframe_from_int_dict(data, frame_template): # TODO: not the most efficient (perf-wise) # though not bad code-wise from pandas import Panel, MultiIndex, Index - p = Panel.from_dict(results).swapaxes('items', 'major') - if len(p.major_axis) > 0: - p.major_axis = arg1.columns[p.major_axis] - if len(p.minor_axis) > 0: - p.minor_axis = arg2.columns[p.minor_axis] + with warnings.catch_warnings(record=True): + p = Panel.from_dict(results).swapaxes('items', 'major') + if len(p.major_axis) > 0: + p.major_axis = arg1.columns[p.major_axis] + if len(p.minor_axis) > 0: + p.minor_axis = arg2.columns[p.minor_axis] if len(p.items): result = pd.concat(