sohailshk opened a new pull request, #41284:
URL: https://github.com/apache/beam/pull/41284

   Fixes #41283
   
   `Series.skew()` and `Series.kurtosis()` merge per-partition moments in 
`combine_moments`. The result used `combined_n`, which is only assigned when 
two non-empty partitions are merged, so when only one partition holds data (for 
example a small input processed in one bundle) the call raised 
`UnboundLocalError: cannot access local variable 'combined_n'`. After the merge 
loop `n` already holds the total count (it equals `combined_n` after every 
merge), so the result now uses `n`; results for several partitions are 
unchanged.
   
   Tests: `test_series_skew_kurtosis_single_partition` evaluates both on one 
partition (`distributed=False`); it fails on master with the 
`UnboundLocalError` and passes with the change. `pytest 
apache_beam/dataframe/frames_test.py`: 460 passed, 19 skipped. With 
`to_dataframe` on a `beam.Create` of 6 floats, both calls failed on master on 
the default runner and on the FnApiRunner; after the change they return 
0.9191843544212499 and -0.25414322711619963, the same as pandas.
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to