[ 
https://issues.apache.org/jira/browse/ARROW-9056?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17127710#comment-17127710
 ] 

Wes McKinney commented on ARROW-9056:
-------------------------------------

Seems reasonable. For NumPy it's a no-op except in the case where a minimum 
numbers of observations is required (e.g. standard deviation with ddof > 0)

{code}
In [1]: import numpy as np

In [2]: np.sum(5)
Out[2]: 5

In [3]: np.mean(5)
Out[3]: 5.0

In [4]: np.std(5)
Out[4]: 0.0

In [5]: np.std(5, ddof=1)
C:\Miniconda\envs\pyarrow-dev\lib\site-packages\numpy\core\_methods.py:217: 
RuntimeWarning: Degrees of freedom <= 0 for slice
  keepdims=keepdims)
C:\Miniconda\envs\pyarrow-dev\lib\site-packages\numpy\core\_methods.py:209: 
RuntimeWarning: invalid value encountered in double_scalars
  ret = ret.dtype.type(ret / rcount)
Out[5]: nan
{code}

so (sample) standard deviation would probably return null but the others would 
just return the scalar unmodifed

> [C++] Aggregation methods for Scalars?
> --------------------------------------
>
>                 Key: ARROW-9056
>                 URL: https://issues.apache.org/jira/browse/ARROW-9056
>             Project: Apache Arrow
>          Issue Type: Improvement
>          Components: C++
>            Reporter: Neal Richardson
>            Priority: Major
>             Fix For: 1.0.0
>
>
> See discussion on https://github.com/apache/arrow/pull/7308. Many/most would 
> no-op (sum, mean, min, max), but maybe they should exist and not error? Maybe 
> they're not needed, but I could see how you might invoke a function on the 
> result of a previous aggregation or something.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to