You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/05/16 08:23:26 UTC
[GitHub] [spark] zhengruifeng opened a new pull request, #36560: [SPARK-39192][PYTHON] make pandas-on-spark's kurt consistent with pandas
zhengruifeng opened a new pull request, #36560:
URL: https://github.com/apache/spark/pull/36560
### What changes were proposed in this pull request?
make pandas-on-spark's kurt consistent with pandas
### Why are the changes needed?
1, the formulas of Kurtosis were different between spark sql and pandas;
2, pandas zeros out small `numerator` and `denominator` for better numerical stability;
### Does this PR introduce _any_ user-facing change?
yes, the logic of kurt changed
### How was this patch tested?
added UT
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] zhengruifeng commented on pull request #36560: [SPARK-39192][PYTHON] Make pandas-on-spark's kurt consistent with pandas
Posted by GitBox <gi...@apache.org>.
zhengruifeng commented on PR #36560:
URL: https://github.com/apache/spark/pull/36560#issuecomment-1128288307
oh, the test failed, let me look into it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] zhengruifeng commented on pull request #36560: [SPARK-39192][PYTHON] make pandas-on-spark's kurt consistent with pandas
Posted by GitBox <gi...@apache.org>.
zhengruifeng commented on PR #36560:
URL: https://github.com/apache/spark/pull/36560#issuecomment-1127383653
cc @HyukjinKwon
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] zhengruifeng commented on a diff in pull request #36560: [SPARK-39192][PYTHON] Make pandas-on-spark's kurt consistent with pandas
Posted by GitBox <gi...@apache.org>.
zhengruifeng commented on code in PR #36560:
URL: https://github.com/apache/spark/pull/36560#discussion_r874287345
##########
python/pyspark/pandas/tests/test_generic_functions.py:
##########
@@ -150,8 +150,8 @@ def test_stat_functions(self):
self.assert_eq(pdf.a.kurtosis(skipna=False), psdf.a.kurtosis(skipna=False))
self.assert_eq(pdf.a.kurtosis(), psdf.a.kurtosis())
self.assert_eq(pdf.b.kurtosis(skipna=False), psdf.b.kurtosis(skipna=False))
- # self.assert_eq(pdf.b.kurtosis(), psdf.b.kurtosis()) AssertionError: nan != -2.0
- self.assert_eq(-1.5, psdf.c.kurtosis())
+ self.assert_eq(pdf.b.kurtosis(), psdf.b.kurtosis())
+ self.assert_eq(pdf.c.kurtosis(), psdf.c.kurtosis())
Review Comment:
also cc @xinrong-databricks since this UT is changed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] zhengruifeng commented on pull request #36560: [SPARK-39192][PS][SQL] Make pandas-on-spark's kurt consistent with pandas
Posted by GitBox <gi...@apache.org>.
zhengruifeng commented on PR #36560:
URL: https://github.com/apache/spark/pull/36560#issuecomment-1129453466
Thanks all!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] HyukjinKwon closed pull request #36560: [SPARK-39192][PS][SQL] Make pandas-on-spark's kurt consistent with pandas
Posted by GitBox <gi...@apache.org>.
HyukjinKwon closed pull request #36560: [SPARK-39192][PS][SQL] Make pandas-on-spark's kurt consistent with pandas
URL: https://github.com/apache/spark/pull/36560
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] xinrong-databricks commented on a diff in pull request #36560: [SPARK-39192][PS][SQL] Make pandas-on-spark's kurt consistent with pandas
Posted by GitBox <gi...@apache.org>.
xinrong-databricks commented on code in PR #36560:
URL: https://github.com/apache/spark/pull/36560#discussion_r875138420
##########
python/pyspark/pandas/tests/test_generic_functions.py:
##########
@@ -150,8 +150,8 @@ def test_stat_functions(self):
self.assert_eq(pdf.a.kurtosis(skipna=False), psdf.a.kurtosis(skipna=False))
self.assert_eq(pdf.a.kurtosis(), psdf.a.kurtosis())
self.assert_eq(pdf.b.kurtosis(skipna=False), psdf.b.kurtosis(skipna=False))
- # self.assert_eq(pdf.b.kurtosis(), psdf.b.kurtosis()) AssertionError: nan != -2.0
- self.assert_eq(-1.5, psdf.c.kurtosis())
+ self.assert_eq(pdf.b.kurtosis(), psdf.b.kurtosis())
+ self.assert_eq(pdf.c.kurtosis(), psdf.c.kurtosis())
Review Comment:
Thanks!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] zhengruifeng commented on pull request #36560: [SPARK-39192][PYTHON] make pandas-on-spark's kurt consistent with pandas
Posted by GitBox <gi...@apache.org>.
zhengruifeng commented on PR #36560:
URL: https://github.com/apache/spark/pull/36560#issuecomment-1127378942
before this pr
```
In [2]: df = ps.DataFrame({'a': [1, 2, 3, np.nan], 'b': [0.1, 0.2, 0.3, np.nan]}, columns=['a', 'b'])
In [3]: df.kurtosis()
Out[3]:
a -1.5
b -1.5
dtype: float64
In [4]: df.to_pandas().kurtosis()
/d0/Dev/Opensource/spark/python/pyspark/pandas/utils.py:976: PandasAPIOnSparkAdviceWarning: `to_pandas` loads all data into the driver's memory. It should only be used if the resulting pandas DataFrame is expected to be small.
warnings.warn(message, PandasAPIOnSparkAdviceWarning)
Out[4]:
a NaN
b NaN
dtype: float64
In [5]: df = ps.DataFrame({'a': [1, 2, 3, np.nan, 6], 'b': [0.1, 0.2, 0.3, np.nan, 0.8]}, columns=['a', 'b'])
In [6]: df.kurtosis()
Out[6]:
a -1.000000
b -0.839477
dtype: float64
In [7]: df.to_pandas().kurtosis()
/d0/Dev/Opensource/spark/python/pyspark/pandas/utils.py:976: PandasAPIOnSparkAdviceWarning: `to_pandas` loads all data into the driver's memory. It should only be used if the resulting pandas DataFrame is expected to be small.
warnings.warn(message, PandasAPIOnSparkAdviceWarning)
Out[7]:
a 1.500000
b 2.703924
dtype: float64
```
after this pr, pandas and pandas-on-spark return the same results
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] HyukjinKwon commented on pull request #36560: [SPARK-39192][PS][SQL] Make pandas-on-spark's kurt consistent with pandas
Posted by GitBox <gi...@apache.org>.
HyukjinKwon commented on PR #36560:
URL: https://github.com/apache/spark/pull/36560#issuecomment-1129421096
Merged to master.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org