<jupyter_start><jupyter_text>Creating Structured Arrays<jupyter_code>import numpy as np
person_data_def = [('name','S6'),('height','f8'),('weight','f8'), ('age', 'i8')]
person_data_def
people_array = np.zeros(4, dtype=person_data_def)
people_array
people_array[3] = ('Delta', 73, 205, 34)
people_array[0] = ('Alpha', 65, 112, 23)
people_array
people_array[0:]
ages = people_array['age']
ages
make_youthful = ages / 2
make_youthful
people_array
people_big_array = np.zeros((4, 3, 2), dtype=person_data_def)
people_big_array
people_big_array[3, 2, 1] = ('Echo', 68, 155, 46)
people_big_array
people_big_array['height']
people_big_array[['height', 'weight']]
person_record_array = np.rec.array([('Delta', 73, 205, 34), ('Alpha', 65, 112, 23)], dtype=person_data_def)
person_record_array
person_record_array[0].age<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.16904761904761906, 'fraction_numerical': 0.060714285714285714, 'mean_word_length': 9.5125, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '68307', 'license': 'MIT', 'n_tokens_mistral': 368, 'n_tokens_neox': 324, 'n_words': 64, 'path': 'numpy-data-science-essential-training/Ex_Files_NumPy_Data_EssT/Exercise Files/Ch 3/03_04/Starting/Structured.ipynb', 'repo_name': 'saint1729/in-learning', 'size': '840'}