Skip to content

Commit

Permalink
Fix string conversion for h5py >= 3
Browse files Browse the repository at this point in the history
  • Loading branch information
maxnoe committed Apr 7, 2021
1 parent 65201e6 commit e65bce6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion fact/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.26.1
0.26.2
6 changes: 3 additions & 3 deletions fact/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,9 @@ def read_h5py(
dataset = group[col]
array = to_native_byteorder(dataset[first:last])

# pandas cannot handle bytes, convert to str
if array.dtype.kind == 'S':
array = array.astype(str)
# decode unicode strings to str
if array.dtype.kind in {'S', 'O'}:
array = array.astype('U')

if parse_dates and dataset.attrs.get('timeformat') is not None:
array = pd.to_datetime(array, infer_datetime_format=True)
Expand Down

0 comments on commit e65bce6

Please sign in to comment.