ee.Reducer.group
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Nhóm các bản ghi giảm theo giá trị của một đầu vào nhất định và giảm mỗi nhóm bằng bộ giảm đã cho.
Cách sử dụng | Giá trị trả về |
---|
Reducer.group(groupField, groupName) | Bộ giảm tốc |
Đối số | Loại | Thông tin chi tiết |
---|
this: reducer | Bộ giảm tốc | Hàm giảm để áp dụng cho từng nhóm, không có trường nhóm. |
groupField | Số nguyên, mặc định: 0 | Trường chứa các nhóm bản ghi. |
groupName | Chuỗi, mặc định: "group" | Khoá từ điển chứa nhóm. Giá trị mặc định là "group". |
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2025-07-26 UTC.
[null,null,["Cập nhật lần gần đây nhất: 2025-07-26 UTC."],[[["\u003cp\u003eGroups records based on a specified field, creating separate groups for each unique value in that field.\u003c/p\u003e\n"],["\u003cp\u003eApplies a given reducer function to each group of records, effectively reducing each group to a single result.\u003c/p\u003e\n"],["\u003cp\u003eAssigns the original reducer to process individual records within each group, excluding the grouping field itself.\u003c/p\u003e\n"],["\u003cp\u003eOrganizes the grouped data within a dictionary-like structure, using 'group' as the default key to access the grouped records.\u003c/p\u003e\n"]]],["The `Reducer.group` function groups records based on a specified `groupField` (defaulting to field 0). It then applies a provided `reducer` to each group, excluding the grouping field. The result of the reducer on each group is stored under a `groupName` key (defaulting to \"group\"). The function itself returns a `Reducer` object. The `groupField` type can be an Integer.\n"],null,["# ee.Reducer.group\n\nGroups reducer records by the value of a given input and reduces each group with the given reducer.\n\n\u003cbr /\u003e\n\n| Usage | Returns |\n|-------------------------------------------------|---------|\n| Reducer.group`(`*groupField* `, `*groupName*`)` | Reducer |\n\n| Argument | Type | Details |\n|-----------------|--------------------------|------------------------------------------------------------------|\n| this: `reducer` | Reducer | The reducer to apply to each group, without the group field. |\n| `groupField` | Integer, default: 0 | The field that contains record groups. |\n| `groupName` | String, default: \"group\" | The dictionary key that contains the group. Defaults to 'group'. |"]]