numpy.number

Full name
numpy.number
Library
NumPy
Syntax

numpy.number

Description

numpy.number is a class from the NumPy library that represents all numeric types.

Parameters

The numpy.number class takes no arguments.

Examples

We can use this class as an argument to the select_dtypes method of pandas DataFrames to select (or exclude) the numeric columns. For example, let's load the titanic dataset from seaborn:

import numpy as np
import seaborn as sns

titanic = sns.load_dataset("titanic")
titanic.head(3)

Dataset Titanic

Now, if we apply the select_dtypes method specifying that only the numeric columns are selected, the result is the following:

titanic.select_dtypes(include = np.number).head ()

Columnas numéricas del dataset Titanic

Submitted by admin on Fri, 01/15/2021 - 15:42