I found a in issue when sorting followed by indexing in pandas when reset_index() is not used. I'm not sure why but the ordering of the rows reverts back after indexing and hence results in dfList containing dataframes that are ordered differently.
reset_index() works and helped to overcome the problem. This is really subtle and rather difficult to troubleshoot. I hope this would be useful for others.
currentReadFile = pd.read_table(currentFile) matrix = currentReadFile.sort(['Ref','Var','Before','After']) matrix_out = matrix.ix[:,4:] dfList.append(matrix_out)
Comment From: sinhrks
Thanks for the report. I don't fully understand what the issue is. Can you attach:
- copy-pastable data
- current / expected result
- result of pd.show_versions()
Comment From: sinhrks
Closing as stale.