print()
debug statements with Python’s logging module.
import logging
logger = logging.getLogger(__name__)
DEBUG
: For intermediate values.INFO
: For major steps.WARNING
/ERROR
: For issues.pandas.HDFStore
'r'
: Read-only.'w'
: Write (overwrites existing files).'a'
: Read/Write (creates the file if it does not exist).'r+'
: Read/Write (requires the file to already exist).with
context manager to ensure files are properly closed after operations.
with h5py.File('filename.hdf5', 'r') as f:
data = f['dataset_name'][:]
dataset = f.create_dataset('big_dataset', (1000, 1000), chunks=(100, 100))
dataset = f.create_dataset('compressed_dataset', (1000, 1000), compression="gzip")
dataset.attrs['description'] = "This dataset contains measurement data"
pytest
tests for every new function.