Closed Ankesh-Jain closed 4 years ago
Hello @Ankesh-Jain ,
you are getting these errors because you are using an old version of TM1. TM1 10.2.2 FP5 has a limited scope of functionality in the REST API, and I believe it may actually be out of support already.
I would recommend you to upgrade to a recent version of TM1 11.x (a.k.a PA 2.x). In TM 11 you will have no constraints in terms of functionality of TM1py and the REST API. Also, TM1 11 comes with lots of enhancements, like alternative hierarchies and reduced locking.
If upgrading is not a short term solution for you, you can still generate a data frame from TM1. You need to do these two steps:
cells = tm1.cubes.cells.execute_view("SaleCube", "Default", private=False)
df = build_pandas_dataframe_from_cellset(cells, multiindex=False)
The resulting data frame will contain all dimensions as columns + one column with the values.
Cheers,
Marius
Dear All,
First of all, I am very new with learning scripting through TM1Py and very excited to explore more. I have started following few sample scripts, I was trying to extract a cube view into a csv using "tm1.cubes.cells.execute_view_csv" and using Panda dataframe but every time it throws some error and I am unable to debug the same.
Note: I am using Jupyter Notebook to run the code.
The script is very simple and as below:
`from TM1py.Services import TM1Service
tm1 = TM1Service(address='localhost', port=36360, user='admin', password='apple', ssl=True)
csv = tm1.cubes.cells.execute_view_csv(cube_name = 'plan_BudgetPlan', view_name = 'Budget Input Total', private = False)
csv[0:200]`
from TM1py.Services import TM1Service tm1 = TM1Service(address='localhost', port=36360, user='admin', password='apple', ssl=True) df = tm1.cubes.cells.execute_view_dataframe(cube_name = 'plan_BudgetPlan', view_name = 'Budget Input Total', private = False) df.head()
The simple extract view using "tm1.cubes.cells.execute_view" is working fine and displays the results.
Version
I am getting the below error while running the above 2 codes: Using "tm1.cubes.cells.execute_view_csv":
TM1pyException Traceback (most recent call last)