mesejo commented on code in PR #445:
URL: 
https://github.com/apache/arrow-datafusion-python/pull/445#discussion_r1289007307


##########
docs/source/user-guide/common-operations/aggregations.rst:
##########
@@ -0,0 +1,59 @@
+.. Licensed to the Apache Software Foundation (ASF) under one
+.. or more contributor license agreements.  See the NOTICE file
+.. distributed with this work for additional information
+.. regarding copyright ownership.  The ASF licenses this file
+.. to you under the Apache License, Version 2.0 (the
+.. "License"); you may not use this file except in compliance
+.. with the License.  You may obtain a copy of the License at
+
+..   http://www.apache.org/licenses/LICENSE-2.0
+
+.. Unless required by applicable law or agreed to in writing,
+.. software distributed under the License is distributed on an
+.. "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+.. KIND, either express or implied.  See the License for the
+.. specific language governing permissions and limitations
+.. under the License.
+
+Aggregation
+============
+
+An aggregate or aggregation is a function where the values of multiple rows 
are processed together to form a single summary value.
+For performing an aggregation, DataFusion provides the 
:meth:`.DataFrame.aggregate`
+
+.. ipython:: python
+
+    from datafusion import SessionContext
+    from datafusion import column, lit
+    from datafusion import functions as f
+    import random
+
+    ctx = SessionContext()
+    df = ctx.from_pydict(
+        {
+            "a": ["foo", "bar", "foo", "bar", "foo", "bar", "foo", "foo"],
+            "b": ["one", "one", "two", "three", "two", "two", "one", "three"],
+            "c": [random.randint(0, 100) for _ in range(8)],
+            "d": [random.random() for _ in range(8)],
+        }
+    )
+
+    col_a = column("a")
+    col_b = column("b")
+    col_c = column("c")
+    col_d = column("d")
+
+    df.aggregate([], [f.approx_distinct(col_c), f.approx_median(col_d), 
f.approx_percentile_cont(col_d, lit(0.5))])

Review Comment:
   Yes, I didn't know about the optional argument `name` 😅 



##########
docs/source/user-guide/common-operations/aggregations.rst:
##########
@@ -0,0 +1,59 @@
+.. Licensed to the Apache Software Foundation (ASF) under one
+.. or more contributor license agreements.  See the NOTICE file
+.. distributed with this work for additional information
+.. regarding copyright ownership.  The ASF licenses this file
+.. to you under the Apache License, Version 2.0 (the
+.. "License"); you may not use this file except in compliance
+.. with the License.  You may obtain a copy of the License at
+
+..   http://www.apache.org/licenses/LICENSE-2.0
+
+.. Unless required by applicable law or agreed to in writing,
+.. software distributed under the License is distributed on an
+.. "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+.. KIND, either express or implied.  See the License for the
+.. specific language governing permissions and limitations
+.. under the License.
+
+Aggregation
+============
+
+An aggregate or aggregation is a function where the values of multiple rows 
are processed together to form a single summary value.
+For performing an aggregation, DataFusion provides the 
:meth:`.DataFrame.aggregate`
+
+.. ipython:: python
+
+    from datafusion import SessionContext
+    from datafusion import column, lit
+    from datafusion import functions as f
+    import random
+
+    ctx = SessionContext()
+    df = ctx.from_pydict(
+        {
+            "a": ["foo", "bar", "foo", "bar", "foo", "bar", "foo", "foo"],
+            "b": ["one", "one", "two", "three", "two", "two", "one", "three"],
+            "c": [random.randint(0, 100) for _ in range(8)],
+            "d": [random.random() for _ in range(8)],
+        }
+    )
+
+    col_a = column("a")
+    col_b = column("b")
+    col_c = column("c")
+    col_d = column("d")
+
+    df.aggregate([], [f.approx_distinct(col_c), f.approx_median(col_d), 
f.approx_percentile_cont(col_d, lit(0.5))])

Review Comment:
   Yes, I didn't know about the optional argument `name` 😅 



-- 
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