Replies: 1 comment
-
Hello you can access array elements as described in the following code and in the documentation: import atoti as tt
import pandas as pd
session = tt.Session()
table = session.read_pandas(
pd.DataFrame({
"id": ["a", "b"],
"array": [[1,2], [3,4]]
}),
table_name="Table"
)
cube = session.create_cube(table)
l, m = cube.levels, cube.measures
m["first element of array"] = tt.agg.single_value(table["array"])[0]
cube.query(m["first element of array"], levels=[l["id"]])
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello, we have one doubt about if its possible to compare values beetwen two vectors at component level to obtain the Scenario and PLN at Date values in which the tiebreaker occurs.
To put in context , we Explain the problem:
we have one measure which get the components of PNL at Date,
Scenary index PLN at date
2022-05-01 1 {-99500,-80000, -70000,-50000}
2022-05-02 2 {-99500,-80000, -60000,-40000}
2022-05-03 3 {-99500,-70000, -30000,-10000}
we want to obtain the Scenary in which the tiebreaker occurs, for that we need one form to compare the vector components in the three Scenarys.
The first step is to compare the first element of the three vectors and if the result is they have the same value then, in this situation, cannot discard any scenario
the second step is to compare second Element of three vectors, in this situation we have two components at the same values but the third one is diferent so that we can discard the scenary to the next interaction.
And third step
finally we compare the third component of the vector PLN but now beetwen two scenarios (2022-05-01 and 20022-05-03 ) in this case the value of the PLN at Date is diferent, we want the minor value in which the tiebreaker occurs ,in this case the scenario value = 2022-05-01 and value of the PNL Vector is -70000.
That is the logic we want to implement to obtain the PNL At DAte values and Scenary in which the tiebreaker is done
Beta Was this translation helpful? Give feedback.
All reactions