Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python3
- # coding=utf-8
- import numpy as np
- import pandas as pd
- import numpy.random
- import h5py as h5
- result = None
- global_dtype = np.dtype('<f8')
- animals = ('cat', 'dog')
- somethings = ('42', '43', '44', '45')
- for animal in animals:
- layer = None
- for something in somethings:
- # В реальности layer_data ты откуда-то читаешь
- layer_data = numpy.random.rand(5) * 10
- print(layer_data)
- if layer is None:
- layer = layer_data
- else:
- layer = np.vstack([layer, layer_data])
- if result is None:
- result = layer
- else:
- result = np.stack([result, layer])
- print('---')
- print(result)
- panel = pd.Panel(result, items=animals, major_axis=somethings)
- f = h5.File('test.hdf5', 'w')
- dset = f.create_dataset('riboseq', result.shape, dtype=result.dtype, data=panel)
- import pdb; pdb.set_trace()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement