ee.List.frequency
Stay organized with collections
Save and categorize content based on your preferences.
Returns the number of elements in list equal to element.
Usage | Returns | List.frequency(element) | Integer |
Argument | Type | Details | this: list | List | |
element | Object | |
Examples
Code Editor (JavaScript)
// An ee.Image list object.
var list = ee.List([0, 1, 2, 2, 3, 4]);
print('List of integers', list);
// The ee.List.frequency function is used to determine how many times a value is
// present in a list, e.g. what is the frequency of 0, 2, and 9 in the list.
print('Frequency of value 0', list.frequency(0));
print('Frequency of value 2', list.frequency(2));
print('Frequency of value 9', list.frequency(9));
Python setup
See the
Python Environment page for information on the Python API and using
geemap
for interactive development.
import ee
import geemap.core as geemap
Colab (Python)
# An ee.Image list object.
ee_list = ee.List([0, 1, 2, 2, 3, 4])
print('List of integer:', ee_list.getInfo())
# The ee.List.frequency function is used to determine how many times a value is
# present in a list, e.g. what is the frequency of 0, 2, and 9 in the list.
print('Frequency of value 0:', ee_list.frequency(0).getInfo())
print('Frequency of value 2:', ee_list.frequency(2).getInfo())
print('Frequency of value 9:', ee_list.frequency(9).getInfo())
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2023-10-06 UTC.
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"Missing the information I need"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"Too complicated / too many steps"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"Out of date"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"Samples / code issue"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]