cubewise-code / tm1py

TM1py is a Python package that wraps the TM1 REST API in a simple to use library.
http://tm1py.readthedocs.io/en/latest/
MIT License
189 stars 109 forks source link

get_elements_dataframe turns string arguments into floats when using use_blob #1069

Closed Kevin-Dekker closed 7 months ago

Kevin-Dekker commented 8 months ago

Describe the bug get_elements_dataframe turns string arguments into floats when using use_blob=True. get_elements_dataframe keeps string arguments as strings when using use_blob=False.

To Reproduce Add a string attr to any dimension. Fill it with only numeric strings. retrieve elements dataframe with skip_weights, and skip_parents:

df_from_use_blob_true = tm1.elements.get_elements_dataframe(
            dimension_name='account1',
            hierarchy_name='account1',
            elements=['Price', 'Units'],
            skip_weights=True,
            skip_parents=True,
            attributes=['StringAttr', ],
            use_blob=True)

Expected behavior I would expect the result to match the same query with use_blob=False.

df_from_use_blob_false = tm1.elements.get_elements_dataframe(
            dimension_name='account1',
            hierarchy_name='account1',
            elements=['Price', 'Units'],
            skip_weights=True,
            skip_parents=True,
            attributes=['StringAttr', ],
            use_blob=False)

Version TM1py: 2.0.2 TM1 Server Version: 11.8.01900.10

MariusWirtz commented 7 months ago

@Kevin-Dekker please verify that https://github.com/cubewise-code/tm1py/pull/1088 solves this issue

pip uninstall tm1py
pip install https://github.com/cubewise-code/tm1py/archive/refs/heads/1069-fix-dtypes-in-df.zip