Skip to content

Commit

Permalink
Sort DataFrames by their index when reading them.
Browse files Browse the repository at this point in the history
  • Loading branch information
kboone committed May 18, 2019
1 parent 0a62644 commit 4cff943
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions avocado/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,9 @@ def read_dataframes(path, keys, chunk=None, num_chunks=None,
# Not loading in chunks, just load all of the datasets normally.
dataframes = []
for key in keys:
dataframes.append(pd.read_hdf(store, key))
dataframe = pd.read_hdf(store, key)
dataframe.sort_index(inplace=True)
dataframes.append(dataframe)
store.close()
return dataframes

Expand Down Expand Up @@ -197,7 +199,10 @@ def read_dataframes(path, keys, chunk=None, num_chunks=None,
"(%s >= '%s') & (%s <= '%s')"
% (use_name, start_object_id, use_name, end_object_id)
)
dataframes.append(pd.read_hdf(store, key, where=match_str))
dataframe = pd.read_hdf(store, key, where=match_str)
dataframe.sort_index(inplace=True)

dataframes.append(dataframe)

store.close()
return dataframes
Expand Down

0 comments on commit 4cff943

Please sign in to comment.