<p dir="auto">The corr()  method attached to DataFrames is a great way to get a matrix of correlation coefficients. But for the Kendall and Spearman options, the p-value is discarded:</p>
<p dir="auto"><a href="https://github.com/pydata/pandas/blob/8ac0e11b59b65f0ac898dca2beebde5f87836649/pandas/core/nanops.py#L510-L517">https://github.com/pydata/pandas/blob/8ac0e11b59b65f0ac898dca2beebde5f87836649/pandas/core/nanops.py#L510-L517</a></p>
<p dir="auto">For a function called corr() this would certainly be expected behavior, but the problem remains that there is no other method (as far as I've been able to find) to get those significance values without going back to scipy and doing it myself.</p>
<h4 dir="auto">Code Sample, a copy-pastable example if possible</h4>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="data = pd.read_stata(&quot;myfile.dta&quot;)
data = data.set_index(['country', 'year'])
data_delta = data.groupby('count').diff()"><pre class="notranslate"><span class="pl-s1">data</span> <span class="pl-c1">=</span> <span class="pl-s1">pd</span>.<span class="pl-en">read_stata</span>(<span class="pl-s">"myfile.dta"</span>)
<span class="pl-s1">data</span> <span class="pl-c1">=</span> <span class="pl-s1">data</span>.<span class="pl-en">set_index</span>([<span class="pl-s">'country'</span>, <span class="pl-s">'year'</span>])
<span class="pl-s1">data_delta</span> <span class="pl-c1">=</span> <span class="pl-s1">data</span>.<span class="pl-en">groupby</span>(<span class="pl-s">'count'</span>).<span class="pl-en">diff</span>()</pre></div>
<h4 dir="auto">Problem description</h4>
<p dir="auto">Hi everyone! My first bug report :)</p>
<p dir="auto">I'm having some problems with the .diff() argument, and first thought I was just being an idiot, but now I'm fairly confident I've isolated the bug.</p>
<p dir="auto">Note, when I run this manually line-by-line it works fine, but I depend on this being inside a function (because I remove some columns before doing the differences and then reinstate them in a highly repetitive fashion).</p>
<p dir="auto">For a long time I was on pandas 0.18.x and was using the following command fine:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="data = data.groupby('country).diff().shift(-1)"><pre class="notranslate"><span class="pl-s1">data</span> <span class="pl-c1">=</span> <span class="pl-s1">data</span>.<span class="pl-en">groupby</span>('<span class="pl-s1">country</span>).<span class="pl-en">diff</span>().<span class="pl-en">shift</span>(<span class="pl-c1">-</span><span class="pl-c1">1</span>)</pre></div>
<p dir="auto">But after upgrading to pandas 0.20.1, the behavior of diff seems to have changed, and now takes a periods argument, which is very useful to me! Now, the problem is I get thrown a error everytime I use it. The traceback looks like this:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Traceback (most recent call last):
  File &quot;/Users/myname/anaconda/lib/python2.7/site-packages/IPython/core/interactiveshell.py&quot;, line 2881, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File &quot;&lt;ipython-input-7-5e1d634b8803&gt;&quot;, line 1, in &lt;module&gt;
    dat = feature_expand(data_everything, lags=2, lag_y=True, delta=True)
  File &quot;&lt;ipython-input-3-184a59b406db&gt;&quot;, line 126, in feature_expand
    data_delta = data_delta.diff()
  File &quot;&lt;string&gt;&quot;, line 21, in diff
  File &quot;/Users/myname/anaconda/lib/python2.7/site-packages/pandas/core/groupby.py&quot;, line 612, in wrapper
    *args, **kwargs)
  File &quot;/Users/myname/anaconda/lib/python2.7/site-packages/pandas/core/groupby.py&quot;, line 3481, in _aggregate_item_by_item
    raise errors
TypeError: diff() got an unexpected keyword argument 'axis'"><pre class="notranslate"><code class="notranslate">Traceback (most recent call last):
  File "/Users/myname/anaconda/lib/python2.7/site-packages/IPython/core/interactiveshell.py", line 2881, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "&lt;ipython-input-7-5e1d634b8803&gt;", line 1, in &lt;module&gt;
    dat = feature_expand(data_everything, lags=2, lag_y=True, delta=True)
  File "&lt;ipython-input-3-184a59b406db&gt;", line 126, in feature_expand
    data_delta = data_delta.diff()
  File "&lt;string&gt;", line 21, in diff
  File "/Users/myname/anaconda/lib/python2.7/site-packages/pandas/core/groupby.py", line 612, in wrapper
    *args, **kwargs)
  File "/Users/myname/anaconda/lib/python2.7/site-packages/pandas/core/groupby.py", line 3481, in _aggregate_item_by_item
    raise errors
TypeError: diff() got an unexpected keyword argument 'axis'
</code></pre></div>
<p dir="auto">Following the traceback I find a wrapper function in groupby.py under, _GroupBy._make_wrapper().wrapper, which says it does some "trickery for aggregation functions that need an axis", and seems to add the axis keyword argument by itself. This has probably been useful behaviour previously, but now it breaks .diff() as it doesn't take an axis argument anymore.</p>
<p dir="auto">I hope someone has time to help me and the community with this.</p>
<p dir="auto">Cheers :)</p>
<h4 dir="auto">Expected Output</h4>
<p dir="auto">A dataframe of country-level first differences.</p>
<h4 dir="auto">Output of <code class="notranslate">pd.show_versions()</code></h4>
<details>
<h2 dir="auto">INSTALLED VERSIONS</h2>
<p dir="auto">commit: None<br>
python: 2.7.13.final.0<br>
python-bits: 64<br>
OS: Darwin<br>
OS-release: 16.7.0<br>
machine: x86_64<br>
processor: i386<br>
byteorder: little<br>
LC_ALL: None<br>
LANG: None<br>
LOCALE: None.None<br>
pandas: 0.20.1<br>
pytest: 2.9.2<br>
pip: 9.0.1<br>
setuptools: 35.0.2<br>
Cython: 0.24.1<br>
numpy: 1.13.1<br>
scipy: 0.19.1<br>
xarray: None<br>
IPython: 5.1.0<br>
sphinx: 1.4.6<br>
patsy: 0.4.1<br>
dateutil: 2.6.1<br>
pytz: 2017.2<br>
blosc: None<br>
bottleneck: 1.1.0<br>
tables: 3.2.3.1<br>
numexpr: 2.6.2<br>
feather: None<br>
matplotlib: 2.0.2<br>
openpyxl: 2.3.2<br>
xlrd: 1.0.0<br>
xlwt: 1.1.2<br>
xlsxwriter: 0.9.3<br>
lxml: 3.7.3<br>
bs4: 4.5.3<br>
html5lib: 0.9999999<br>
sqlalchemy: 1.1.9<br>
pymysql: 0.7.9.None<br>
psycopg2: 2.7.1 (dt dec pq3 ext lo64)<br>
jinja2: 2.8<br>
s3fs: None<br>
pandas_gbq: None<br>
pandas_datareader: None</p>
</details>