Skip to content

Commit de10a52

Browse files
committed
Fix COMBED dataset converter for pandas>=0.23 (due to the bugfix pandas-dev/pandas#19497). Still compatible with 0.22 by using pd.MultiIndex directly.
1 parent 117d09e commit de10a52

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

nilmtk/dataset_converters/combed/convert_combed.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,16 +74,17 @@ def convert_combed(combed_path, output_filename, format='HDF'):
7474
if exists:
7575
total = pd.concat(dfs, axis=1)
7676
total = total.tz_localize('UTC').tz_convert('Asia/Kolkata')
77-
total.rename(columns=lambda x: column_mapping[x], inplace=True)
77+
total.columns = pd.MultiIndex.from_tuples([column_mapping[x] for x in total.columns])
7878
total.columns.set_names(LEVEL_NAMES, inplace=True)
7979
assert total.index.is_unique
8080
store.put(str(key), total)
81+
8182
convert_yaml_to_hdf5(join(_get_module_directory(), 'metadata'),
8283
output_filename)
8384

8485
print("Done converting COMBED to HDF5!")
8586

86-
87+
8788
def _get_module_directory():
8889
# Taken from http://stackoverflow.com/a/6098238/732596
8990
path_to_this_file = dirname(getfile(currentframe()))

0 commit comments

Comments
 (0)