Skip to content

Commit df06de9

Browse files
--amend
1 parent 763dcaf commit df06de9

File tree

2 files changed

+5
-11
lines changed

2 files changed

+5
-11
lines changed

pandas/core/frame.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6672,11 +6672,8 @@ def corr(self, method='pearson', min_periods=1):
66726672
Examples
66736673
--------
66746674
>>> import numpy as np
6675-
>>> histogram_intersection = lambda a, b: np.minimum(
6676-
... np.true_divide(a, a.sum()), np.true_divide(b, b.sum())
6677-
... ).sum()
6678-
6679-
>>> df = pd.DataFrame([(1, 3), (0, 6), (3, 0), (1, 1)],
6675+
>>> histogram_intersection = lambda a, b: np.minimum(a, b).sum().round(decimals=1)
6676+
>>> df = pd.DataFrame([(.2, .3), (.0, .6), (.6, .0), (.2, .1)],
66806677
... columns=['dogs', 'cats'])
66816678
>>> df.corr(method=histogram_intersection)
66826679
dogs cats

pandas/core/series.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1932,12 +1932,9 @@ def corr(self, other, method='pearson', min_periods=None):
19321932
Examples
19331933
--------
19341934
>>> import numpy as np
1935-
>>> histogram_intersection = lambda a, b: np.minimum(
1936-
... np.true_divide(a, a.sum()), np.true_divide(b, b.sum())
1937-
... ).sum()
1938-
1939-
>>> s1 = pd.Series([1, 0, 3, 1])
1940-
>>> s2 = pd.Series([3, 6, 0, 1])
1935+
>>> histogram_intersection = lambda a, b: np.minimum(a, b).sum().round(decimals=1)
1936+
>>> s1 = pd.Series([.2, .0, .6, .2])
1937+
>>> s2 = pd.Series([.3, .6, .0, .1])
19411938
>>> s1.corr(s2, method=histogram_intersection)
19421939
0.3
19431940
"""

0 commit comments

Comments
 (0)