Skip to content

Commit 51e39b8

Browse files
committed
moved implementation
1 parent 0c6a759 commit 51e39b8

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

python/pyspark/sql/dataframe.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -883,7 +883,11 @@ def cov(self, col1, col2):
883883
:param col1: The name of the first column
884884
:param col2: The name of the second column
885885
"""
886-
return self.stat.cov(col1, col2)
886+
if not isinstance(col1, str):
887+
raise ValueError("col1 should be a string.")
888+
if not isinstance(col2, str):
889+
raise ValueError("col2 should be a string.")
890+
return self.df._jdf.stat().cov(col1, col2)
887891

888892
@ignore_unicode_prefix
889893
def withColumn(self, colName, col):
@@ -1336,11 +1340,7 @@ def __init__(self, df):
13361340
self.df = df
13371341

13381342
def cov(self, col1, col2):
1339-
if not isinstance(col1, str):
1340-
raise ValueError("col1 should be a string.")
1341-
if not isinstance(col2, str):
1342-
raise ValueError("col2 should be a string.")
1343-
return self.df._jdf.stat().cov(col1, col2)
1343+
return self.stat.cov(col1, col2)
13441344

13451345
cov.__doc__ = DataFrame.cov.__doc__
13461346

0 commit comments

Comments
 (0)