@@ -580,9 +580,17 @@ Transformation
580
580
--------------
581
581
582
582
The ``transform `` method returns an object that is indexed the same (same size)
583
- as the one being grouped. Thus, the passed transform function should return a
584
- result that is the same size as the group chunk. For example, suppose we wished
585
- to standardize the data within each group:
583
+ as the one being grouped. The transform function must:
584
+
585
+ * Return a result that is either the same size as the group chunk or
586
+ broadcastable to the size of the group chunk.
587
+ * Operate column-by-column on the group chunk. A fast path is used if the
588
+ transform function also operates on the entire group chunk as a DataFrame.
589
+ * Does not perform in-place operations on the group chunk. Group chunks should
590
+ be treated as immutable, and changes to a group chunk may produce unexpected
591
+ results.
592
+
593
+ For example, suppose we wished to standardize the data within each group:
586
594
587
595
.. ipython :: python
588
596
@@ -664,8 +672,9 @@ and that the transformed data contains no NAs.
664
672
665
673
.. note ::
666
674
667
- Some functions when applied to a groupby object will automatically transform the input, returning
668
- an object of the same shape as the original. Passing ``as_index=False `` will not affect these transformation methods.
675
+ Some functions when applied to a groupby object will automatically transform
676
+ the input, returning an object of the same shape as the original. Passing
677
+ ``as_index=False `` will not affect these transformation methods.
669
678
670
679
For example: ``fillna, ffill, bfill, shift ``.
671
680
0 commit comments