<jupyter_start><jupyter_text>Saving and loading the data in .npz formatThe .npz file format is a zipped archive of files named after the variables they contain. The archive is not compressed and each file in the archive contains one variable in .npy format use __np.savez(filename, args)__ to save the data<jupyter_code>import numpy as np
import matplotlib.pylab as plt

%matplotlib inline

data = np.loadtxt(fname='../data/inflammation-01.csv', delimiter=',')
filename = 'datainfo.npz'
np.savez(filename, data=data, mean_daily=np.mean(data,0))<jupyter_output><empty_output><jupyter_text>use __np.load()__ to load it :<jupyter_code>patient = np.load(filename)<jupyter_output><empty_output><jupyter_text>to check the keys in the loaded data<jupyter_code>list(patient)
patient['mean_daily']<jupyter_output><empty_output><jupyter_text>We can plot this data using matplotlib.pyplot.plt:<jupyter_code>plt.plot(patient['mean_daily'])<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10553814002089865, 'fraction_numerical': 0.003134796238244514, 'mean_word_length': 7.709090909090909, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '497706', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 337, 'n_tokens_neox': 329, 'n_words': 84, 'path': 'Day_1_Scientific_Python/numpys/savez.ipynb', 'repo_name': 'paris-saclay-cds/python_workshop_2019', 'size': '957'}