NumPy Array Archive
AI & Machine LearningNPZ collects NPY arrays. Named arrays may have different shapes/types and need not form one table. Inspect names and per-array specifications, then compare their meaning with producer documentation.
- What it is used for
- Storage of a named collection of arrays
- What the file contains
- Binary data
All sections, questions and sources
Content reviewed: · Editor:Kai
Opening steps
Choose your environment or purpose to see its steps.
Menu labels and support vary by app, OS and version. Preserve the original before making changes.
Troubleshooting by symptom
- Missing key: inspect member names and compare producer naming.
- Different shapes: identify each array’s role/dimensional relationships.
- Object-array failure: do not enable pickle to load unknown members.
- Unclear arr_0-style keys: inspect the save code to identify unnamed arrays.
- Object-array loading rejected: investigate the required objects; do not enable pickle for unknown files.
- Memory mapping does not help: NPZ archives NPY arrays; consider storing needed numeric arrays separately.
NPZ → individual NPY / CSV
- Record member names/types/shapes and select required arrays.
- Save individual arrays as NPY; for CSV document dimension/column mapping and compare values.
- Compare element count, order, dtype, missing values and samples; record original shape and axis semantics.
One CSV cannot retain equivalent member names/different shapes; renaming ZIP does not explain the arrays’ meaning.
Manage related arrays together
Related data and labels need matching order as well as counts; document keys, shapes and alignment.
Inspect samples rather than displaying everything; choose processing suitable for dtype and value range.
Source for these steps:NumPy Project · numpy.lib.format / NumPy Project · numpy.load / NumPy Project · Reading and writing files
Information that CSV may lose
CSV may not preserve NumPy types or multidimensional structure; document flattened axes and original shape and include the source when needed.
Object arrays can require pickle loading; retain protections and ask the producer for an appropriate non-object export.
Source for these steps:NumPy Project · numpy.lib.format / NumPy Project · numpy.load / NumPy Project · Reading and writing files
Related-format differences
| Format | Main role | What to check |
|---|---|---|
| NPY | Single array | Shape/dtype and axis semantics |
| NPZ | Multiple-array archive | Keys and array relationships |
| CSV | Table exchange | Manage type/structure separately |
Handling and security
Do not infer memory needs from compressed size; keep pickle disabled for unknown object arrays and inspect only needed data.
Questions and answers
Is it always compressed?
Compression depends on the saving method.
Are member names standardized?
Names depend on the producer; inspect the list first.
Can I directly make one CSV?
First define the table structure from the arrays’ shapes/meaning.
Is NPZ one compressed NPY?
It can contain multiple named arrays; compression depends on the save API.
What should I check when sharing with Excel?
Check multidimensional layout, large integers, missing values and dates and compare values after reloading.
Format facts: name, steward and MIME type
- Formal name
- NumPy array archive
- Steward / specification
- NumPy Project
- MIME type
- Depends on the producer or server; an extension alone does not establish a MIME type.
Primary and official sources
- Project documentationnumpy.lib.format
Specification of NPY and NPZ array storage.
NumPy Project · Link checked: - Project documentationnumpy.load
Documents object arrays and allow_pickle.
NumPy Project · Link checked: - Project documentationReading and writing files
Reference for array and text-file I/O.
NumPy Project · Link checked: