WUT_Computer_Science/split_nemeth.py

18 lines
517 B
Python
Raw Normal View History

import numpy as np
# Load the .npz file
2024-11-28 18:10:18 +01:00
input_file = 'code/poli3.npz'
data = np.load(input_file)
# Create dictionaries to hold the split data
data_keys = list(data.keys())
split_point = len(data_keys) // 2
first_half = {key: data[key] for key in data_keys[:split_point]}
second_half = {key: data[key] for key in data_keys[split_point:]}
# Save the halves to separate .npz files
2024-11-28 18:10:18 +01:00
np.savez('poli3_1.npz', **first_half)
np.savez('poli3_2.npz', **second_half)
2024-11-28 18:10:18 +01:00
print(f"Data split into 'poli3_1.npz' and 'poli3_2.npz'")