Skip to content
masterclassBuddyTech Buzz5 fresh blogs · 5:00 AM IST

NumPy · Type Alias

np.int32

np.int32 is NumPy's fixed-width 32-bit integer type. Use it for integer scalars or as an array dtype when a 32-bit representation is required.

How it works

np.int32 is NumPy's concrete signed integer scalar type with exactly 32 bits. Use it as an array dtype, a scalar constructor, or an input to dtype- and integer-introspection APIs when fixed-width integer representation matters.

Syntax

numpy.int32

Returns

A NumPy 32-bit integer scalar when called as a constructor; as a dtype specifier, it selects the corresponding 32-bit integer dtype.

Key points

  • np.int32 combines the integer category with a 32-bit width to identify one concrete NumPy numerical type.
  • Its 32-bit size describes the memory width allocated for each value.
  • The documentation maps numpy.int32 to the C integer family and describes it as a platform-defined integer type with 32 bits.
  • Use np.int32 as the dtype argument when an array should contain 32-bit integers.
  • Arrays store numerical values according to dtype objects, and np.int32 selects the corresponding integer dtype.

Common mistakes

  • Do not substitute platform-dependent integer types such as np.int_ or np.intp when a fixed 32-bit width is required.

Example: Create a 32-bit integer array

import numpy as np

values = np.array([1, 2, 3], dtype=np.int32)
print(values.dtype)       # int32
print(np.iinfo(np.int32).min)
print(np.iinfo(np.int32).max)

Creates an array whose elements use NumPy's fixed 32-bit integer type, then displays its dtype and representable limits.

When to use it

Fixed-width array storage

Define arrays with predictable per-element integer width for binary formats, interfaces, or memory-sensitive data.

Typed scalar values

Create NumPy integer scalars that participate in NumPy operations using the 32-bit integer dtype.

Range validation

Check the representable range before converting or validating integer data.

Interview questions

QWhat does np.int32 represent?

np.int32 is a NumPy concrete integer type with 32 bits. It provides a fixed-width integer representation, unlike platform-dependent types whose widths can vary.

Follow-up: How would you inspect its limits? Use np.iinfo(np.int32), then read the returned object's min and max attributes.

QHow do you use np.int32 when creating an array?

Pass dtype=np.int32 to array creation to request 32-bit integer storage. You can also construct a scalar with np.int32(value).

Follow-up: How can you verify the resulting array type? Inspect its .dtype attribute, which should report int32.

QWhy is the 32-bit width significant?

NumPy defines a basic numerical type by combining a category with a numeric bitsize. For np.int32, the bitsize is 32, meaning 32 bits are used for one value in memory.

Follow-up: Why not use np.int_ for the same guarantee? Its bitsize may depend on the platform, whereas np.int32 is fixed-width.

  • numpy.int16
  • numpy.int64
  • numpy.intc
  • numpy.int_
  • numpy.intp
  • numpy.dtype
  • numpy.iinfo

Source: Data types. Checked 2026-10-15.