Skip to content

Report DFs now get combined as a flattened list #175

Merged
Matt-From-AnswerRocket merged 1 commit intomainfrom
bugfix/report_dfs_as_flattened_list
Dec 11, 2025
Merged

Report DFs now get combined as a flattened list #175
Matt-From-AnswerRocket merged 1 commit intomainfrom
bugfix/report_dfs_as_flattened_list

Conversation

@Matt-From-AnswerRocket
Copy link
Contributor

This resolves the index out of bounds error on the get_dataframes_for_entry method by combining and flattening all DF results. It also means that we now get DFs for ALL reports instead of just the first one.


df_dicts = result.chat_entry.answer.report_results[0].gzipped_dataframes_and_metadata
df_dicts = [report.gzipped_dataframes_and_metadata for report in result.chat_entry.answer.report_results if report.gzipped_dataframes_and_metadata]
# flatten
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I know this could be a single list comp, but I think these are hard enough to read as is, so I went with 2

Copy link

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 index out of bounds error in the get_dataframes_for_entry method by collecting dataframes from all report results instead of only accessing the first report. The solution uses list comprehension with filtering and flattening to combine all dataframes into a single flat list.

Key Changes:

  • Replaced direct indexing [0] with list comprehension to iterate through all reports
  • Added filtering to exclude reports without dataframe metadata
  • Implemented list flattening to convert nested list structure into a single flat list

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


df_dicts = result.chat_entry.answer.report_results[0].gzipped_dataframes_and_metadata
df_dicts = [report.gzipped_dataframes_and_metadata for report in result.chat_entry.answer.report_results if report.gzipped_dataframes_and_metadata]
# flatten
Copy link

Copilot AI Dec 11, 2025

Choose a reason for hiding this comment

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

The comment "flatten" is too brief and doesn't explain what's being flattened or why. Consider expanding this to clarify that we're flattening the nested list of dataframes from multiple reports into a single flat list.

Suggested change
# flatten
# Flatten the nested list of dataframes and metadata dictionaries from multiple reports
# into a single flat list for easier processing.

Copilot uses AI. Check for mistakes.
@Matt-From-AnswerRocket Matt-From-AnswerRocket merged commit b40dabe into main Dec 11, 2025
9 checks passed
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.

4 participants