Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- array(['Subject_ID', 'tube_label', 'sample_#', 'Relabel',
- 'sample_ID','cortisol_value', 'Group'], dtype='<U14')
- array([['STM002', '170714_STM002_1', 1, 1, 1, 1.98, 'HC'],
- ['STM002', '170714_STM002_2', 2, 2, 2, 2.44, 'HC'],], dtype=object)
- testing = np.concatenate((header, body), axis=0)
- A = np.array(['Subject_ID', 'tube_label', 'sample_#', 'Relabel',
- 'sample_ID','cortisol_value', 'Group'], dtype='<U14')
- B = np.array([['STM002', '170714_STM002_1', 1, 1, 1, 1.98, 'HC'],
- ['STM002', '170714_STM002_2', 2, 2, 2, 2.44, 'HC'],], dtype=object)
- res = np.vstack((np.array([A]), B))
- print(res)
- array([['Subject_ID', 'tube_label', 'sample_#', 'Relabel', 'sample_ID',
- 'cortisol_value', 'Group'],
- ['STM002', '170714_STM002_1', 1, 1, 1, 1.98, 'HC'],
- ['STM002', '170714_STM002_2', 2, 2, 2, 2.44, 'HC']], dtype=object)
- In [1]: import numpy as np
- In [2]: arr1 = np.array(['Subject_ID', 'tube_label', 'sample_#', 'Relabel',
- ...: 'sample_ID','cortisol_value', 'Group'], dtype='<U14')
- ...:
- In [3]: arr2 = np.array([['STM002', '170714_STM002_1', 1, 1, 1, 1.98, 'HC'],
- ...: ['STM002', '170714_STM002_2', 2, 2, 2, 2.44, 'HC'],], dtype=object)
- ...:
- In [4]: arr1.shape
- Out[4]: (7,)
- In [5]: arr2.shape
- Out[5]: (2, 7)
- In [8]: concatenated = np.concatenate((arr1[None, :], arr2), axis=0)
- In [9]: concatenated.shape
- Out[9]: (3, 7)
- In [10]: concatenated
- Out[10]:
- array([['Subject_ID', 'tube_label', 'sample_#', 'Relabel', 'sample_ID',
- 'cortisol_value', 'Group'],
- ['STM002', '170714_STM002_1', 1, 1, 1, 1.98, 'HC'],
- ['STM002', '170714_STM002_2', 2, 2, 2, 2.44, 'HC']], dtype=object)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement