Repository navigation
[FIX] Excel readers: Keep empty flags row of three-line header - #7334
Open
raashish1601 wants to merge 1 commit into
Open
raashish1601 wants to merge 1 commit into
raashish1601 wants to merge 1 commit into
Conversation
ExcelReader and XlsReader dropped all empty rows before parsing the header. A three-line header whose flags row is empty (e.g. data without class and metas saved with type annotations) then lost its third row, so the header was not recognized and the types row was read as data. Empty data rows are already skipped in data_table.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue
Fixes #7276
Description of changes
ExcelReader.get_cellsandXlsReader.get_cellsdropped every empty row (filter(any, ...)) before the header was parsed. A file saved with type annotations but without class, metas or weights has an empty third (flags) header row. That row was dropped, soparse_headerssaw the first data row in its place and did not recognize a three-line header. The names became a one-line header and the types row was read as data, which gives the strange table in the issue.The readers now keep empty rows.
ExcelReaderstill skips leading empty rows;XlsReaderalready starts at the first non-empty row. Empty data rows are still dropped, becauseadjust_data_widthindata_tablefilters them, which is also how the tab/csv reader handles them.Tests:
test_write_file_without_flagswrites iris without its class withwith_annotations=Trueand reads it back.test_read_empty_flagsreads newheader_3_no_flags.xlsx/.xlsfiles with an empty flags row through both readers. Both fail on master (the xlsx round trip gives 151 rows instead of 150, and the xls file readsaas a meta) and pass with the change.Orange.tests.test_io,test_tab_reader,test_txt_reader,test_xlsx_reader,test_table,Orange.data.tests.test_ioand the distance matrix xlsx tests pass locally.Includes