ee.Dictionary.fromLists
Construct a dictionary from two parallel lists of keys and values.
Usage | Returns |
---|
ee.Dictionary.fromLists(keys, values) | Dictionary |
Argument | Type | Details |
---|
keys | List | A list of keys. |
values | List | A list of values. |
Examples
// Corresponding lists of keys and values.
var keys = ['B1', 'B2', 'B3'];
var values = [182, 219, 443];
print('Dictionary from lists of keys and values',
ee.Dictionary.fromLists(keys, values));
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
# Corresponding lists of keys and values.
keys = ['B1', 'B2', 'B3']
values = [182, 219, 443]
print('Dictionary from lists of keys and values:',
ee.Dictionary.fromLists(keys, values).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 2024-07-13 UTC.
[null,null,["Last updated 2024-07-13 UTC."],[[["`ee.Dictionary.fromLists()` creates an Earth Engine Dictionary object from two parallel lists, where the first list provides the keys and the second list provides the corresponding values."],["This function is useful for organizing data in a key-value structure, allowing for easy access to values using their associated keys within the Earth Engine environment."],["The function accepts two arguments: `keys` (a list of keys) and `values` (a list of values), which must be of the same length to ensure proper pairing."]]],["The function `ee.Dictionary.fromLists(keys, values)` creates a dictionary from two lists. The `keys` list provides the dictionary's keys, while the `values` list supplies the corresponding values. Both arguments require list types. The function returns a dictionary. In the provided examples, a dictionary is created using keys `['B1', 'B2', 'B3']` and corresponding values `[182, 219, 443]`.\n"]]