-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting Cell Property other than "Value" from dataframe functions in CellService #1115
Comments
Can you provide an example of what you would want the DF to look like? Would it have more columns, more rows? |
I wonder how we can support cell properties in a convenient way in the Perhaps if we introduced two additional args:
Would that help in your case? Re the |
Yeah, I think it's not an easy thing to add in a clean way. The Personally, my default is always to use I can't really speak on the maintainability of the function, but I find it very useful. |
Have you tried to include properties in the execute_mdx_dataframe method and set the shaped parameter as true? It takes a different approach, but also returns data frame that is pivoted to match the view spec: https://github.com/cubewise-code/tm1py/blob/75598adde5103d1b635faa0639ebc153b930be29/TM1py/Utils/Utils.py#L584
From: bennybooo22 ***@***.***>
Reply-To: cubewise-code/tm1py ***@***.***>
Date: Tuesday, May 14, 2024 at 9:25 AM
To: cubewise-code/tm1py ***@***.***>
Cc: "Clapp, Ryan" ***@***.***>, Comment ***@***.***>
Subject: Re: [cubewise-code/tm1py] Getting Cell Property other than "Value" from dataframe functions in CellService (Issue #1115)
Yeah, I think it's not an easy thing to add in a clean way. The cell_properties and cell_properties_axis seems like a good way to make an easy implementation. I think that would help in my case.
Personally, my default is always to use execute_mdx_dataframe_pivot over execute_mdx_dataframe. When using python for some sort of data analysis, I will typically construct the MDX to be the cubeview that I plan on analyzing. For example, if I am comparing 3 dimensions in a cube, and want to take the average across 2 dimensions. This may just be my lack of familiarity with pandas but it is much easier to do the aforementioned operation when the dataframe has been pivoted than in the default returned dataframe from execute_mdx_dataframe. Back before execute_mdx_dataframe_pivot existed or before I knew it existed, the following line after execute_mdx_dataframe was always ....pivot_table().
I can't really speak on the maintainability of the function, but I find it very useful.
—
Reply to this email directly, view it on GitHub<#1115 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AEK7GZSZEOUMKX3BWTSP3IDZCIGEFAVCNFSM6AAAAABHJK5H4WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMJQGI2DEMZQGM>.
You are receiving this because you commented.Message ID: ***@***.***>
|
I just tried that by running In CellService.py the function Also worth noting that the behavior of a dataframe that has been created using pivot vs. shaped are different. I think pivot makes the row dimension the index and shaped makes the row dimension a column. To @MariusWirtz 's point about maintainability, if the shaped function is considered maintainable, it might be possible to have the pivot function just run |
Describe the bug
The all the execute dataframe functions only ever return "Value", no matter what cell_properties is passed
To Reproduce
Run the following code with a valid MDX: tm1.cells.execute_mdx_dataframe_pivot(mdx, cell_properties=['Updateable', 'Value'])
(After fixing the previously posted bug or doing a execute_view_dataframe_pivot instead)
Expected behavior
Return of BOTH the "Value" and "Updateable" property.
Version
TM1py: 2.0.2
TM1 Server Version: 11.8
Additional context
Possible steps to fix:
Note: This will make the dataframe return 'Value' as Value title instead of what was previously 'Values'. I imagine many python scripts have df = df['Values'] hard coded into them, so there is an issue of backwards compatability
The text was updated successfully, but these errors were encountered: