I want use hdfs.read() to get one xxx.h5 file, but I just get some random code, how does python read h5 files in HDFS? this is my code:
from hdfs import *
import pandas as pd
import h5py
c = Client("http://192.168.1.81:50070")
with c.read('/stocks/test/pred/20140103/000001.h5') as reader:
for line in reader:
print(line)
how can I read the xxx.h5 file in hdfs? thanks very much!
You can use pandas
directly to read your hdfs file.
import pandas as pd
url = 'http://192.168.1.81:50070/stocks/test/pred/20140103/000001.h5'
df = pd.read_hdf(url)
Assuming your xxx.h5 is a valid hdfs file.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.