ee.Array.reduce
संग्रह की मदद से व्यवस्थित रहें
अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
किसी ऐरे पर रिड्यूसर लागू करता है. इसके लिए, हर तय किए गए ऐक्सिस के साथ सभी इनपुट वैल्यू को एक ही आउटपुट वैल्यू में छोटा किया जाता है. यह वैल्यू, रिड्यूसर से कंप्यूट की जाती है.
आउटपुट का डाइमेंशन हमेशा इनपुट के डाइमेंशन के बराबर होता है. साथ ही, अलग-अलग ऐक्सिस पर इसका असर इस तरह पड़ता है:
'ऐक्सिस' पैरामीटर में दिए गए ऐक्सिस की लंबाई, रिड्यूसर लागू करने पर 1 हो जाती है.
अगर रिड्यूसर में कई इनपुट या कई आउटपुट हैं, तो 'fieldAxis' में तय किए गए ऐक्सिस का इस्तेमाल, रिड्यूसर के इनपुट देने और रिड्यूसर के आउटपुट सेव करने के लिए किया जाएगा.
अन्य सभी ऐक्सिस पर इसका कोई असर नहीं पड़ता. इनमें अलग-अलग तरह से कमी की जाती है.
इस्तेमाल | रिटर्न |
---|
Array.reduce(reducer, axes, fieldAxis) | Array |
आर्ग्यूमेंट | टाइप | विवरण |
---|
यह: array | Array | ऐरे. |
reducer | रेड्यूसर | लागू किया जाने वाला रिड्यूसर. इसके हर आउटपुट में कोई संख्या होनी चाहिए, न कि कोई ऐरे या अन्य टाइप. |
axes | सूची | उन ऐक्सिस की सूची जिनके हिसाब से कम करना है. आउटपुट में, इन सभी ऐक्सिस की लंबाई 1 होगी. |
fieldAxis | पूर्णांक, डिफ़ॉल्ट: null | इस ऐक्सिस का इस्तेमाल, रिड्यूसर के इनपुट और आउटपुट फ़ील्ड के तौर पर किया जाता है. इसकी ज़रूरत सिर्फ़ तब होती है, जब रिड्यूसर के कई इनपुट या कई आउटपुट हों. ऐसे में, ऐक्सिस की लंबाई, रिड्यूसर के इनपुट की संख्या के बराबर होनी चाहिए. साथ ही, नतीजे में इसकी लंबाई, रिड्यूसर के आउटपुट की संख्या के बराबर होगी. |
जब तक कुछ अलग से न बताया जाए, तब तक इस पेज की सामग्री को Creative Commons Attribution 4.0 License के तहत और कोड के नमूनों को Apache 2.0 License के तहत लाइसेंस मिला है. ज़्यादा जानकारी के लिए, Google Developers साइट नीतियां देखें. Oracle और/या इससे जुड़ी हुई कंपनियों का, Java एक रजिस्टर किया हुआ ट्रेडमार्क है.
आखिरी बार 2025-07-26 (UTC) को अपडेट किया गया.
[null,null,["आखिरी बार 2025-07-26 (UTC) को अपडेट किया गया."],[[["\u003cp\u003e\u003ccode\u003eArray.reduce\u003c/code\u003e collapses input values along specified axes into single output values using a reducer function.\u003c/p\u003e\n"],["\u003cp\u003eThe output array retains the original input dimensionality, with specified axes reduced to length 1.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003efieldAxis\u003c/code\u003e is used when your reducer has multiple inputs or outputs, aligning with those fields.\u003c/p\u003e\n"],["\u003cp\u003eIndependent reductions are performed along all other axes not specified in the \u003ccode\u003eaxes\u003c/code\u003e parameter.\u003c/p\u003e\n"]]],[],null,["# ee.Array.reduce\n\nApply a reducer to an array by collapsing all the input values along each specified axis into a single output value computed by the reducer.\n\n\u003cbr /\u003e\n\nThe output always has the same dimensionality as the input, and the individual axes are affected as follows:\n\n- The axes specified in the 'axes' parameter have their length reduced to 1 (by applying the reducer).\n\n- If the reducer has multiple inputs or multiple outputs, the axis specified in 'fieldAxis' will be used to provide the reducer's inputs and store the reducer's outputs.\n\n- All other axes are unaffected (independent reductions are performed).\n\n| Usage | Returns |\n|----------------------------------------------|---------|\n| Array.reduce`(reducer, axes, `*fieldAxis*`)` | Array |\n\n| Argument | Type | Details |\n|---------------|------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| this: `array` | Array | The array. |\n| `reducer` | Reducer | The reducer to apply. Each of its outputs must be a number, not an array or other type. |\n| `axes` | List | The list of axes over which to reduce. The output will have a length of 1 in all these axes. |\n| `fieldAxis` | Integer, default: null | The axis to use as the reducer's input and output fields. Only required if the reducer has multiple inputs or multiple outputs, in which case the axis must have length equal to the number of reducer inputs, and in the result it will have length equal to the number of reducer outputs. |"]]