Skip to content
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

Implement get_elements_dataframe function #818

Merged
merged 2 commits into from
Oct 28, 2022
Merged

Implement get_elements_dataframe function #818

merged 2 commits into from
Oct 28, 2022

Conversation

MariusWirtz
Copy link
Collaborator

Fixes #815

@MariusWirtz
Copy link
Collaborator Author

Also resolves #442

@MariusWirtz
Copy link
Collaborator Author

Function get_elements_dataframe inspired by existing get_member_properties but more flexible.
It doens't require dimension_name, hierarchy_name and can retrieve weights to the parents.

from TM1py import TM1Service

with TM1Service(address="", port=12354, ssl=True, user="admin", password="apple") as tm1:
    df = tm1.elements.get_elements_dataframe(
        elements="HEAD({TM1SubsetAll([Airport])},3)",
        attributes=["City", "Hub", "Country"],
        skip_weights=False)

    print(df.to_markdown())
Airport Type City Hub Country level002 level002_Weight level001 level001_Weight level000 level000_Weight
1 ADL Numeric Adelaide Asia Australia Australia 1 Asia 1 ALL AIRPORT 1
2 AVV Numeric Melbourne Asia Australia Australia 1 Asia 1 ALL AIRPORT 1
3 BNE Numeric Brisbane Asia Australia Australia 1 Asia 1 ALL AIRPORT 1

@MariusWirtz MariusWirtz merged commit c188d6a into master Oct 28, 2022
@MariusWirtz MariusWirtz deleted the feature/815 branch April 9, 2023 18:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor get_member_proprties and add columns for weights
1 participant