Missing Field within a level in a multiindex column df using data_frame_to_rows().
I have a dataframe with a multiindex column structure as:
| Field 1 | Field 2 | BLANK | BLANK | BLANK | Field 3 | BLANK | BLANK | BLANK |
| | ABC1 | ABC2 | ABC3 | ABC4 | ABC1 | ABC2 | ABC3 | ABC4 |
Written as tuples:
MultiIndex([('Field 1', ''), ('Field 2', 'ABC1'), ('Field 2', 'ABC2'), ('Field 2', 'ABC3'), ('Field 2', 'ABC4'), ('Field 3', 'ABC1'), ('Field 3', 'ABC2'), ('Field 3', 'ABC3'), ('Field 3', 'ABC4')], )
When using the dataframe_to_rows, it will register 'Field 2' as None. I narrowed it down to the expand_index() function. Specifically when this bit of code is used:
if inx % length:
For whatever reason, that logic always hits when it's enumerating through the 'Field 2' entries, but 'Field 1' and 'Field 3' work just fine.