xpressinsight.scenario.ArrayUpdate
class xpressinsight.scenario.ArrayUpdate(scenario.EntityUpdate)
entity_name: str
|
The name of the entity being updated.
|
add: Dict[Tuple[str | int | bool, Ellipsis] | str | int | bool, int | str | float | bool] | pandas.Series | polars.DataFrame | NoneType
|
The list of values to add or update in the array. May be a Dictionary, a Pandas Series or a Polars DataFrame. If a Polars DataFrame, it's assumed the rightmost column is the value, and the other columns are the index values, in the same order as specified in the Insight schema. If a Dictionary, the keys may be single values (for a single-index array), or tuples (for a multi-index array).
|
remove: Iterable[Tuple[str | int | bool, Ellipsis]] | Iterable[str] | Iterable[int] | Iterable[bool] | pandas.Index | polars.DataFrame | NoneType
|
A list of index entries to remove from the array. May be an Iterable, a Pandas Index or a Polars DataFrame. If a Pandas Index, it should be a MultiIndex if the array has multiple indexes. If a Polars DataFrame, it's assumed that each column represents one of the index entities, in the same other as specified in the Insight schema. Otherwise, it should be an iterable containing either the index values to remove (for a single-index array), or tuples (for a multi-index array).
|
>>> with ins.InsightRestClient(insight_url='http://localhost:8080/') as client: ... entries_to_add = {6: 'Saturday', 7: 'Sunday'} ... client.update_scenario_data('570b9100-46e3-4643-baee-2e24aa538f25', [ ... ArrayUpdate('DAY_NAMES', add=entries_to_add)])
>>> with ins.InsightRestClient(insight_url='http://localhost:8080/') as client: ... entries_to_add = {('Washington', 'January'): 25.1, ... ('Washington', 'February'): 30.7, ... ('Delaware', 'January'): 2.0} ... client.update_scenario_data('570b9100-46e3-4643-baee-2e24aa538f25', [ ... ArrayUpdate('SALES', add=entries_to_add)])
>>> with ins.InsightRestClient(insight_url='http://localhost:8080/') as client: ... entries_to_add = pd.Series([25.1, 30.7, 2.0], ... index=pd.MultiIndex.from_tuples([('Washington', 'January'), ... ('Washington', 'February'), ... ('Delaware', 'January')]) ... client.update_scenario_data('570b9100-46e3-4643-baee-2e24aa538f25', [ ... ArrayUpdate('SALES', add=entries_to_add)])
>>> with ins.InsightRestClient(insight_url='http://localhost:8080/') as client: ... entries_to_add = pl.DataFrame({ ... 'Location': ['Washington', 'Washington', 'Delaware'], ... 'Month': ['January', 'February', 'January'], ... 'Value': [25.1, 30.7, 2.0]}) ... client.update_scenario_data('570b9100-46e3-4643-baee-2e24aa538f25', [ ... ArrayUpdate('SALES', add=entries_to_add)])
>>> with ins.InsightRestClient(insight_url='http://localhost:8080/') as client: ... client.update_scenario_data('570b9100-46e3-4643-baee-2e24aa538f25', [ ... ArrayUpdate('DAY_NAMES', remove=[6, 7])])
>>> with ins.InsightRestClient(insight_url='http://localhost:8080/') as client: ... client.update_scenario_data('570b9100-46e3-4643-baee-2e24aa538f25', [ ... ArrayUpdate('SALES', remove=[('Toronto', 'January'), ... ('Toronto', 'February'), ... ('Toronto', 'March')])])
>>> with ins.InsightRestClient(insight_url='http://localhost:8080/') as client: ... entries_to_remove = pd.MultiIndex.from_product([['Toronto'], ... ['January', 'February', 'March']]) ... client.update_scenario_data('570b9100-46e3-4643-baee-2e24aa538f25', [ ... ArrayUpdate('SALES', remove=entries_to_remove)])
>>> with ins.InsightRestClient(insight_url='http://localhost:8080/') as client: ... entries_to_remove = pl.DataFrame({ ... 'Location': ['Toronto', 'Toronto', 'Toronto'], ... 'Month': ['January', 'February', 'March']}) ... client.update_scenario_data('570b9100-46e3-4643-baee-2e24aa538f25', [ ... ArrayUpdate('SALES', remove=entries_to_remove)])
© 2001-2025 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.