Skip to content

Commit

Permalink
Merge pull request #98 from fact-project/fix_mode
Browse files Browse the repository at this point in the history
Use mode='r' by default
  • Loading branch information
maxnoe authored Feb 13, 2018
2 parents ba602d1 + 66d99ef commit 8cbc6b2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions fact/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def to_native_byteorder(array):
return array


def read_h5py(file_path, key='data', columns=None, mode='r+'):
def read_h5py(file_path, key='data', columns=None, mode='r'):
'''
Read a hdf5 file written with h5py into a dataframe
Expand Down Expand Up @@ -135,7 +135,7 @@ def read_h5py(file_path, key='data', columns=None, mode='r+'):
return df


def h5py_get_n_rows(file_path, key='data', mode='r+'):
def h5py_get_n_rows(file_path, key='data', mode='r'):

with h5py.File(file_path, mode) as f:
group = f.get(key)
Expand All @@ -146,7 +146,7 @@ def h5py_get_n_rows(file_path, key='data', mode='r+'):
return group[next(iter(group.keys()))].shape[0]


def read_h5py_chunked(file_path, key='data', columns=None, chunksize=None, mode='r+'):
def read_h5py_chunked(file_path, key='data', columns=None, chunksize=None, mode='r'):
'''
Generator function to read from h5py hdf5 in chunks,
returns an iterator over pandas dataframes.
Expand Down

0 comments on commit 8cbc6b2

Please sign in to comment.