We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0c6a759 commit 51e39b8Copy full SHA for 51e39b8
python/pyspark/sql/dataframe.py
@@ -883,7 +883,11 @@ def cov(self, col1, col2):
883
:param col1: The name of the first column
884
:param col2: The name of the second column
885
"""
886
- return self.stat.cov(col1, col2)
+ 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)
891
892
@ignore_unicode_prefix
893
def withColumn(self, colName, col):
@@ -1336,11 +1340,7 @@ def __init__(self, df):
1336
1340
self.df = df
1337
1341
1338
1342
def cov(self, col1, col2):
1339
- if not isinstance(col1, str):
- raise ValueError("col1 should be a string.")
- if not isinstance(col2, str):
- raise ValueError("col2 should be a string.")
1343
- return self.df._jdf.stat().cov(col1, col2)
+ return self.stat.cov(col1, col2)
1344
1345
cov.__doc__ = DataFrame.cov.__doc__
1346
0 commit comments