Skip to content

Conversation

cubewise-gng
Copy link
Contributor

Fix #1234 get_elements_dataframe with attribute same name as dimension

@MariusWirtz MariusWirtz requested a review from Copilot September 3, 2025 07:51
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes an issue where get_elements_dataframe fails when an attribute has the same name as a dimension. The fix moves column renaming logic to occur before DataFrame operations and handles the dimension/hierarchy name separately from attribute renaming.

  • Moved attribute column renaming logic to execute before DataFrame pivot operations
  • Separated dimension name handling from attribute renaming to prevent conflicts
  • Added comprehensive test coverage for the edge case scenario

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
Tests/ElementService_test.py Adds test setup and test cases for dimension with same-named attribute
TM1py/Services/ElementService.py Refactors column renaming logic to handle attribute names matching dimension names

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@MariusWirtz
Copy link
Collaborator

Good catch! Thanks for the contribution Gary!

@MariusWirtz MariusWirtz merged commit c312c9f into cubewise-code:master Sep 3, 2025
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.

Get_Elements_Dataframe fails when an attribute has the same name as the dimension/hierarchy
2 participants