Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to use h5 file in python

import time
import numpy as np
import h5py
import os

arr = np.random.randn(1000)

with h5py.File('groups.hdf5', 'w') as f:
    g = f.create_group('Base_Group')
    d = g.create_dataset('default', data=arr)

    g.attrs['Date'] = time.time()
    g.attrs['User'] = 'Me'

    d.attrs['OS'] = os.name

    for k in g.attrs.keys():
        print('{} => {}'.format(k, g.attrs[k]))

    for j in d.attrs.keys():
      print('{} => {}'.format(j, d.attrs[j]))
Comment

PREVIOUS NEXT
Code Example
Python :: python merge pdf files into one 
Python :: python byte string 
Python :: get token from request django 
Python :: string to list python 
Python :: convert list to numpy array 
Python :: python except print error type 
Python :: python nonlocal 
Python :: how to get the ip address of laptop with python 
Python :: xticks label matplotlib 
Python :: how to import numpy in python 
Python :: pandas get value not equal to 
Python :: clean column names pandas 
Python :: remove keys from array python 
Python :: give a function a name python 
Python :: ImportError: /usr/local/lib/python3.7/dist-packages/cv2/cv2.cpython-37m-arm-linux-gnueabihf.so: undefined symbol: __atomic_fetch_add_8 
Python :: sum group by pandas and create new column 
Python :: iterate backwards through a list python 
Python :: import antigravity in python 
Python :: sort an array python 
Python :: slicing of tuple in python 
Python :: rest_auth pip 
Python :: how to get the value out of a dictionary python3 
Python :: tuple plot python 
Python :: matplotlib vertical line 
Python :: Return the number of times that the string "hi" appears anywhere in the given string. python 
Python :: create empty numpy array without shape 
Python :: how to print a column from csv file in python 
Python :: tkinter window size 
Python :: voice translate python 
Python :: finding odd even python 
ADD CONTENT
Topic
Content
Source link
Name
4+2 =