Skip to content

Commit dc87331

Browse files
--amend
1 parent c0c6baf commit dc87331

File tree

2 files changed

+5
-11
lines changed

2 files changed

+5
-11
lines changed

pandas/core/frame.py

+2-5
Original file line numberDiff line numberDiff line change
@@ -6706,11 +6706,8 @@ def corr(self, method='pearson', min_periods=1):
67066706
Examples
67076707
--------
67086708
>>> import numpy as np
6709-
>>> histogram_intersection = lambda a, b: np.minimum(
6710-
... np.true_divide(a, a.sum()), np.true_divide(b, b.sum())
6711-
... ).sum()
6712-
6713-
>>> df = pd.DataFrame([(1, 3), (0, 6), (3, 0), (1, 1)],
6709+
>>> histogram_intersection = lambda a, b: np.minimum(a, b).sum().round(decimals=1)
6710+
>>> df = pd.DataFrame([(.2, .3), (.0, .6), (.6, .0), (.2, .1)],
67146711
... columns=['dogs', 'cats'])
67156712
>>> df.corr(method=histogram_intersection)
67166713
dogs cats

pandas/core/series.py

+3-6
Original file line numberDiff line numberDiff line change
@@ -1929,12 +1929,9 @@ def corr(self, other, method='pearson', min_periods=None):
19291929
Examples
19301930
--------
19311931
>>> import numpy as np
1932-
>>> histogram_intersection = lambda a, b: np.minimum(
1933-
... np.true_divide(a, a.sum()), np.true_divide(b, b.sum())
1934-
... ).sum()
1935-
1936-
>>> s1 = pd.Series([1, 0, 3, 1])
1937-
>>> s2 = pd.Series([3, 6, 0, 1])
1932+
>>> histogram_intersection = lambda a, b: np.minimum(a, b).sum().round(decimals=1)
1933+
>>> s1 = pd.Series([.2, .0, .6, .2])
1934+
>>> s2 = pd.Series([.3, .6, .0, .1])
19381935
>>> s1.corr(s2, method=histogram_intersection)
19391936
0.3
19401937
"""

0 commit comments

Comments
 (0)