pyhdf5-handler 0.10__tar.gz → 0.11__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pyhdf5_handler-0.10 → pyhdf5_handler-0.11}/PKG-INFO +5 -2
- {pyhdf5_handler-0.10 → pyhdf5_handler-0.11}/README.md +3 -0
- {pyhdf5_handler-0.10 → pyhdf5_handler-0.11}/Release_note.txt +2 -1
- {pyhdf5_handler-0.10 → pyhdf5_handler-0.11}/pyhdf5_handler/src/hdf5_handler.py +14 -1
- {pyhdf5_handler-0.10 → pyhdf5_handler-0.11}/pyhdf5_handler/tutorial/hdf5_io_tests.py +9 -1
- {pyhdf5_handler-0.10 → pyhdf5_handler-0.11}/pyproject.toml +1 -1
- {pyhdf5_handler-0.10 → pyhdf5_handler-0.11}/.spyproject/config/backups/codestyle.ini.bak +0 -0
- {pyhdf5_handler-0.10 → pyhdf5_handler-0.11}/.spyproject/config/backups/encoding.ini.bak +0 -0
- {pyhdf5_handler-0.10 → pyhdf5_handler-0.11}/.spyproject/config/backups/vcs.ini.bak +0 -0
- {pyhdf5_handler-0.10 → pyhdf5_handler-0.11}/.spyproject/config/backups/workspace.ini.bak +0 -0
- {pyhdf5_handler-0.10 → pyhdf5_handler-0.11}/.spyproject/config/codestyle.ini +0 -0
- {pyhdf5_handler-0.10 → pyhdf5_handler-0.11}/.spyproject/config/defaults/defaults-codestyle-0.2.0.ini +0 -0
- {pyhdf5_handler-0.10 → pyhdf5_handler-0.11}/.spyproject/config/defaults/defaults-encoding-0.2.0.ini +0 -0
- {pyhdf5_handler-0.10 → pyhdf5_handler-0.11}/.spyproject/config/defaults/defaults-vcs-0.2.0.ini +0 -0
- {pyhdf5_handler-0.10 → pyhdf5_handler-0.11}/.spyproject/config/defaults/defaults-workspace-0.2.0.ini +0 -0
- {pyhdf5_handler-0.10 → pyhdf5_handler-0.11}/.spyproject/config/encoding.ini +0 -0
- {pyhdf5_handler-0.10 → pyhdf5_handler-0.11}/.spyproject/config/vcs.ini +0 -0
- {pyhdf5_handler-0.10 → pyhdf5_handler-0.11}/.spyproject/config/workspace.ini +0 -0
- {pyhdf5_handler-0.10 → pyhdf5_handler-0.11}/LICENSE +0 -0
- {pyhdf5_handler-0.10 → pyhdf5_handler-0.11}/pyhdf5_handler/__init__.py +0 -0
- {pyhdf5_handler-0.10 → pyhdf5_handler-0.11}/pyhdf5_handler/src/__init__.py +0 -0
- {pyhdf5_handler-0.10 → pyhdf5_handler-0.11}/pyhdf5_handler/src/constant.py +0 -0
- {pyhdf5_handler-0.10 → pyhdf5_handler-0.11}/pyhdf5_handler/src/object_handler.py +0 -0
- {pyhdf5_handler-0.10 → pyhdf5_handler-0.11}/pyhdf5_handler/tutorial/__init__.py +0 -0
- {pyhdf5_handler-0.10 → pyhdf5_handler-0.11}/pyhdf5_handler/tutorial/complementary_test.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
2
|
Name: pyhdf5_handler
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.11
|
|
4
4
|
Summary: A Python library to read and write data to HDF5 format. This library is based on the h5py (https://docs.h5py.org/en/stable/index.html) and has been developed by Maxime Jay-Allemand at Hydris hydrologie (https://www.hydris-hydrologie.fr/)
|
|
5
5
|
Project-URL: Homepage, https://codeberg.org/maximejay/pyhdf5_handler
|
|
6
6
|
Project-URL: Issues, https://codeberg.org/maximejay/pyhdf5_handler/issues
|
|
@@ -111,6 +111,9 @@ pyhdf5_handler.save_dict_to_hdf5file("./test.hdf5", dictionary)
|
|
|
111
111
|
```
|
|
112
112
|
Function argument `location` can be used to save the dictionary in a specific group. the group will be created if not exist. The function argument `replace` can be used to replace the HDF5 file, by default pyhdf5_handler will append to it.
|
|
113
113
|
|
|
114
|
+
|
|
115
|
+
#### Reading an HDF5 file as Python dictionary
|
|
116
|
+
|
|
114
117
|
Reading an hdf5 is easy. Just use the function `pyhdf5_handler.src.hdf5_handler.read_hdf5file_as_dict`:
|
|
115
118
|
|
|
116
119
|
```python
|
|
@@ -94,6 +94,9 @@ pyhdf5_handler.save_dict_to_hdf5file("./test.hdf5", dictionary)
|
|
|
94
94
|
```
|
|
95
95
|
Function argument `location` can be used to save the dictionary in a specific group. the group will be created if not exist. The function argument `replace` can be used to replace the HDF5 file, by default pyhdf5_handler will append to it.
|
|
96
96
|
|
|
97
|
+
|
|
98
|
+
#### Reading an HDF5 file as Python dictionary
|
|
99
|
+
|
|
97
100
|
Reading an hdf5 is easy. Just use the function `pyhdf5_handler.src.hdf5_handler.read_hdf5file_as_dict`:
|
|
98
101
|
|
|
99
102
|
```python
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
v0.11: thur Aug 20 12:02:40 2026 +0200
|
|
2
|
+
- Improvement : writting and reading a pandas dataframe keep the original dataframe index.
|
|
1
3
|
|
|
2
4
|
v0.10: Fri Jul 31 17:30:46 2026 +0200
|
|
3
5
|
- Improvement : writting and reading a pandas dataframe and a numpy ndarray no longer save and read it in a specific subgroup.
|
|
4
6
|
|
|
5
|
-
|
|
6
7
|
v0.9 : 23-07-2026
|
|
7
8
|
- fix: handle dtype with panda dataframe: read/write
|
|
8
9
|
|
|
@@ -412,6 +412,9 @@ def _hdf5_handle_PandaDataFrame(
|
|
|
412
412
|
keys = _hdf5_handle_array("columns", np.array(list(value.columns)))
|
|
413
413
|
_hdf5_create_dataset(hdf5_data, keys)
|
|
414
414
|
|
|
415
|
+
index = _hdf5_handle_array("index", np.array(list(value.index)))
|
|
416
|
+
_hdf5_create_dataset(hdf5_data, index)
|
|
417
|
+
|
|
415
418
|
dataset = _hdf5_handle_array("array", value.to_numpy())
|
|
416
419
|
_hdf5_create_dataset(hdf5_data, dataset)
|
|
417
420
|
|
|
@@ -670,6 +673,7 @@ def _read_pd_dataframe(hdf5):
|
|
|
670
673
|
|
|
671
674
|
if "_Pandas_DataFrame" in list(hdf5.attrs.keys()):
|
|
672
675
|
columns = hdf5["columns"][:]
|
|
676
|
+
index = hdf5["index"][:]
|
|
673
677
|
array = hdf5["array"][:]
|
|
674
678
|
dtype = hdf5["dtype"][:]
|
|
675
679
|
|
|
@@ -677,7 +681,16 @@ def _read_pd_dataframe(hdf5):
|
|
|
677
681
|
for i, col in enumerate(columns):
|
|
678
682
|
newdict.update({col.decode(): array[:, i].astype(dtype[i])})
|
|
679
683
|
|
|
680
|
-
|
|
684
|
+
panda_df = pd.DataFrame(newdict)
|
|
685
|
+
|
|
686
|
+
if index.dtype.type is np.bytes_:
|
|
687
|
+
index = index.astype("str")
|
|
688
|
+
elif index.dtype.type is np.object_:
|
|
689
|
+
index = index.astype("str")
|
|
690
|
+
|
|
691
|
+
panda_df.index = index
|
|
692
|
+
|
|
693
|
+
return panda_df
|
|
681
694
|
|
|
682
695
|
|
|
683
696
|
def _read_ndarray_datastructure(hdf5):
|
|
@@ -174,7 +174,8 @@ if __name__ == "__main__":
|
|
|
174
174
|
{
|
|
175
175
|
"column1": np.array(["A", "B", "C"]),
|
|
176
176
|
"column2": np.array([4, 5, 6]),
|
|
177
|
-
}
|
|
177
|
+
},
|
|
178
|
+
index=["index1", "index2", "index3"],
|
|
178
179
|
)
|
|
179
180
|
},
|
|
180
181
|
)
|
|
@@ -242,6 +243,13 @@ if __name__ == "__main__":
|
|
|
242
243
|
search_attrs=False,
|
|
243
244
|
)
|
|
244
245
|
|
|
246
|
+
pyhdf5_handler.get_hdf5file_item(
|
|
247
|
+
path_to_hdf5="./test.hdf5",
|
|
248
|
+
location="./",
|
|
249
|
+
item="mix_dtype_panda_dataframe",
|
|
250
|
+
search_attrs=False,
|
|
251
|
+
)
|
|
252
|
+
|
|
245
253
|
pyhdf5_handler.get_hdf5file_item(
|
|
246
254
|
path_to_hdf5="./test.hdf5",
|
|
247
255
|
location="./",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyhdf5_handler-0.10 → pyhdf5_handler-0.11}/.spyproject/config/defaults/defaults-codestyle-0.2.0.ini
RENAMED
|
File without changes
|
{pyhdf5_handler-0.10 → pyhdf5_handler-0.11}/.spyproject/config/defaults/defaults-encoding-0.2.0.ini
RENAMED
|
File without changes
|
{pyhdf5_handler-0.10 → pyhdf5_handler-0.11}/.spyproject/config/defaults/defaults-vcs-0.2.0.ini
RENAMED
|
File without changes
|
{pyhdf5_handler-0.10 → pyhdf5_handler-0.11}/.spyproject/config/defaults/defaults-workspace-0.2.0.ini
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|