Skip to content

Commit

Permalink
--amend
Browse files Browse the repository at this point in the history
  • Loading branch information
shadiakiki1986 committed Sep 22, 2018
1 parent 763dcaf commit df06de9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
7 changes: 2 additions & 5 deletions pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -6672,11 +6672,8 @@ def corr(self, method='pearson', min_periods=1):
Examples
--------
>>> import numpy as np
>>> histogram_intersection = lambda a, b: np.minimum(
... np.true_divide(a, a.sum()), np.true_divide(b, b.sum())
... ).sum()
>>> df = pd.DataFrame([(1, 3), (0, 6), (3, 0), (1, 1)],
>>> histogram_intersection = lambda a, b: np.minimum(a, b).sum().round(decimals=1)
>>> df = pd.DataFrame([(.2, .3), (.0, .6), (.6, .0), (.2, .1)],
... columns=['dogs', 'cats'])
>>> df.corr(method=histogram_intersection)
dogs cats
Expand Down
9 changes: 3 additions & 6 deletions pandas/core/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -1932,12 +1932,9 @@ def corr(self, other, method='pearson', min_periods=None):
Examples
--------
>>> import numpy as np
>>> histogram_intersection = lambda a, b: np.minimum(
... np.true_divide(a, a.sum()), np.true_divide(b, b.sum())
... ).sum()
>>> s1 = pd.Series([1, 0, 3, 1])
>>> s2 = pd.Series([3, 6, 0, 1])
>>> histogram_intersection = lambda a, b: np.minimum(a, b).sum().round(decimals=1)
>>> s1 = pd.Series([.2, .0, .6, .2])
>>> s2 = pd.Series([.3, .6, .0, .1])
>>> s1.corr(s2, method=histogram_intersection)
0.3
"""
Expand Down

0 comments on commit df06de9

Please sign in to comment.