Numpy data Types Last Updated : 23 Jan, 2025 Comments Improve Suggest changes Like Article Like Report NumPy is a powerful Python library that can manage different types of data. Here we will explore the Datatypes in NumPy and How we can check and create datatypes of the NumPy array. DataTypes in NumPyA data type in NumPy is used to specify the type of data stored in a variable. Here is the list of characters available in NumPy to represent data types.CharacterMeaningbBooleanfFloatmTime DeltaOObjectUUnicode StringiIntegeruUnsigned IntegercComplex FloatMDateTimeSStringVA fixed chunk of memory for other types (void)The list of various types of data types provided by NumPy are given below:Data TypeDescriptionbool_Boolean int_Default integer type (int64 or int32)intcIdentical to the integer in C (int32 or int64)intpInteger value used for indexingint88-bit integer value (-128 to 127)int1616-bit integer value (-32768 to 32767)int3232-bit integer value (-2147483648 to 2147483647)int6464-bit integer value (-9223372036854775808 to 9223372036854775807)uint8Unsigned 8-bit integer value (0 to 255)uint16Unsigned 16-bit integer value (0 to 65535)uint32Unsigned 32-bit integer value (0 to 4294967295)uint64Unsigned 64-bit integer value (0 to 18446744073709551615)float_Float valuesfloat16Half precision float valuesfloat32Single-precision float valuesfloat64Double-precision float valuescomplex_Complex valuescomplex64Represent two 32-bit float complex values (real and imaginary)complex128Represent two 64-bit float complex values (real and imaginary)Checking the Data Type of NumPy ArrayWe can check the datatype of Numpy array by using dtype. Then it returns the data type all the elements in the array. Python import numpy as np # Create a NumPy array arr = np.array([1, 2, 3, 4, 5]) # Check the data type of the array data_type = arr.dtype print(data_type) Outputint64 Create Arrays With a Defined Data TypeWe can create an array with a defined data type by specifying "dtype" attribute in numpy.array() method while initializing an array. Python import numpy as np arr1 = np.array([1, 2, 3, 4], dtype=np.float64) # Creating a 3x3 int32 array of zeros arr2 = np.zeros((3, 3), dtype=np.int32) # Creating a 2x2 complex128 array of ones arr3 = np.ones((2, 2), dtype=np.complex128) # Creating a 1D bool array arr4 = np.empty((4,), dtype=np.bool_) # Print the arrays and their data types print(arr1.dtype) print(arr2.dtype) print(arr3.dtype) print(arr4.dtype) Outputfloat64 int32 complex128 bool Convert Data Type of NumPy ArraysWe can convert data type of an arrays from one type to another using astype() function. Python import numpy as np arr1 = np.array([1.2, 2.5, 3.7]) # Converting to int32 arr2 = arr1.astype(np.int32) # Print new array and its type print(arr2) print(arr2.dtype) Output[1 2 3] int32 Comment More infoAdvertise with us Next Article Numpy data Types sagar99 Follow Improve Article Tags : Python Numpy Python-numpy Practice Tags : python Similar Reads Lua Data Types In Lua, data types define the kind of values a variable can hold. Since Lua is a dynamically typed language, variables can change their types during execution, which provides flexibility but requires careful management.What are Data Types in Lua Programming Language?In Lua, variables don't have fixe 6 min read Python Data Types Python Data types are the classification or categorization of data items. It represents the kind of value that tells what operations can be performed on a particular data. Since everything is an object in Python programming, Python data types are classes and variables are instances (objects) of thes 9 min read R Data Types Data types in R define the kind of values that variables can hold. Choosing the right data type helps optimize memory usage and computation. Unlike some languages, R does not require explicit data type declarations while variables can change their type dynamically during execution.R Programming lang 5 min read Check data type in NumPy Numpy, is originally called numerical python, but in short, we pronounce it as Numpy. NumPy is a general-purpose array-processing package in Python. It provides high-performance multidimensional data structures like array objects and tools for working with these arrays. Numpy provides faster and mor 5 min read C++ Numeric Data Type There are mainly 3 types of Numeric Data Types in C++ int unsigned intshort intunsigned short int long intunsigned long intlong long intunsigned long long intfloat double long double1. Integer (int) An integer is a type of datatype that can store integer values. Integer acquires 4 bytes in memory an 4 min read DynamoDB - Data Types DynamoDB supports many different data types for attributes within a table. They can be categorized as follows: Scalar Types â A scalar type can represent exactly one value. The scalar types are number, string, binary, Boolean, and null.Document Types â A document type can represent a complex structu 6 min read PL/ SQL Data Types PL/SQL (Procedural Language/Structured Query Language) is a procedural extension language for SQL used specifically for the Oracle database to ease the management of data and the flow of operations. A core feature of PL/SQL is its diverse set of data types, designed to handle everything from simple 6 min read MATLAB - Data Types MATLAB is a platform which provides millions of Engineers and Scientists to analyze data using programming and numerical computing algorithm and also help in creating models. Data types are particular types of data items defined by the values they can store in them, generally, in programming languag 5 min read MariaDB Data Types MariaDB is an open-source software It has implemented various performance improvements over MySQL. It includes various enhancements such as the Aria storage engine, the Thread Pool feature, and the MaxScale proxy, all of which provide better performance and scalability. MariaDB has a large number of 5 min read SAP ABAP | Data Types Before Understanding the Data type first understand the Data object. Data objects are variables that we declare in the program. It occupies some memory where you can store the data from external sources. Data can be of different types, so data types are responsible for defining the type of data of t 6 min read Like