pandas.to_hdf generates corrupt hd5 for categorical columns containing nan values
i am experiensing the following problem (pandas 0.23.4):

I have a dataframe that contains categorical columns. these columns have nan values.

I export using:

df.to_hdf(filename, 'hf', mode='w', compression='zlib', complevel=5, index=False, format='table')

when i read the file with:

df = pd.read_hdf(self.fileName, 'hf')

i get:

Traceback (most recent call last):
  File "Python\Main.py", line 453, in <module>
    if __name__ == "__main__": main(sys.argv[1:])
  File "Python\Main.py", line 94, in main
    df = LoadDesignSpace(os.path.join(input_dir, input_file), sample)
  File "W:\Geeglee\data\Python\designSpace\designSpaceLoader.py", line 26, in LoadDesignSpace
    df, header = storage.get_data_frame(sample)
  File "W:\Geeglee\data\Python\designSpace\storage\HDFSStorage.py", line 46, in get_data_frame
    df = pd.read_hdf(self.fileName, 'hf')
  File "W:\Geeglee\data\venv\lib\site-packages\pandas\io\pytables.py", line 372, in read_hdf
    return store.select(key, auto_close=auto_close, **kwargs)
  File "W:\Geeglee\data\venv\lib\site-packages\pandas\io\pytables.py", line 742, in select
    return it.get_result()
  File "W:\Geeglee\data\venv\lib\site-packages\pandas\io\pytables.py", line 1449, in get_result
    results = self.func(self.start, self.stop, where)
  File "W:\Geeglee\data\venv\lib\site-packages\pandas\io\pytables.py", line 735, in func
    columns=columns, **kwargs)
  File "W:\Geeglee\data\venv\lib\site-packages\pandas\io\pytables.py", line 4124, in read
    if not self.read_axes(where=where, **kwargs):
  File "W:\Geeglee\data\venv\lib\site-packages\pandas\io\pytables.py", line 3329, in read_axes
    a.convert(values, nan_rep=self.nan_rep, encoding=self.encoding)
  File "W:\Geeglee\data\venv\lib\site-packages\pandas\io\pytables.py", line 2135, in convert
    codes[codes != -1] -= mask.astype(int).cumsum().values
ValueError: operands could not be broadcast together with shapes (2622,) (2,) (2622,)

right now i have resolved the issue by tranforming the problematic columns to object.
but it looks like a bug since i have read other reports related to (but not exactly) this.
