Skip to content

Commit

Permalink
Fix COMBED dataset converter for pandas>=0.23 (due to the bugfix pand…
Browse files Browse the repository at this point in the history
…as-dev/pandas#19497). Still compatible with 0.22 by using `pd.MultiIndex` directly.
  • Loading branch information
PMeira committed Jun 25, 2018
1 parent 4fd7e5f commit 3e6810f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions nilmtk/dataset_converters/combed/convert_combed.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,17 @@ def convert_combed(combed_path, output_filename, format='HDF'):
if exists:
total = pd.concat(dfs, axis=1)
total = total.tz_localize('UTC').tz_convert('Asia/Kolkata')
total.rename(columns=lambda x: column_mapping[x], inplace=True)
total.columns = pd.MultiIndex.from_tuples([column_mapping[x] for x in total.columns])
total.columns.set_names(LEVEL_NAMES, inplace=True)
assert total.index.is_unique
store.put(str(key), total)

convert_yaml_to_hdf5(join(_get_module_directory(), 'metadata'),
output_filename)

print("Done converting COMBED to HDF5!")


def _get_module_directory():
# Taken from http://stackoverflow.com/a/6098238/732596
path_to_this_file = dirname(getfile(currentframe()))
Expand Down

0 comments on commit 3e6810f

Please sign in to comment.