Let's say you have a h5py dataset ds
that's a 1D array that's thousands of entries long. If you do
print(ds[:])
python will print the first three and last three entries with an ellipsis in between. But if your ds length is less than 1000 it won't. How do you adjust that 1000 length limit? I want it to give me the ellipsis if it's more than, say, 20 entries. For example in pandas one can adjust this via the pd.options.display.max_rows
option. What's the method in h5py?
As noted, above, use np.set_printoptions()
to control printing options. Two of most interest to you are:
threshold=
controls # of array items that triggers a summary print (default=1000). edgeitems=
controls # of array items printed at the beginning and end of summarized print (default 3). Example to reduce the threshold to 20:
np.set_printoptions(threshold=20)
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.