Text

4 Chapters 11 Lessons Intermediate

About this course

Here, some of the ** most important Numpy numeric data types ** that you

The most basic data types are as follows: integer ($ex: 1, 2 , -10$), float ($ex: 1.1, 3.24 , -7.00111$), complex ($ex: 1+2j, 2.1 +3j , -2+1.4j$), and boolean ($ex: True, False$). You can use Numpy to convert Python elements in many different ways such as changing an array type to another specific type. Let's start with the following examples:

# Import Numpy libraryimport numpy as np# Define a numbera = 10print('Type, before converting: ', type(a))# Change the type to float with Numpyb = np.float64(a)print('Type, after converting: ', type(b))# Change the type to float with Numpyc = float(a)print('Type, after converting: ', type(c))Type, before converting: <class 'int'>Type, after converting: <class 'numpy.float64'>Type, after converting: <class 'float'> **Question: ** What is the difference between using **np.float64 ** and the Python **float ** built-in function?