Numpy API Analysis
histogram
>>> a = numpy.arange(5)
>>> hist, bin_edges = numpy.histogram(a,density=False)
>>> hist, bin_edges
(array([1, 0, 1, 0, 0, 1, 0, 1, 0, 1], dtype=int64), array([ 0. , 0.4, 0.8, 1.2, 1.6, 2. , 2.4, 2.8, 3.2, 3.6, 4. ]))
Analysis:
- Variable a is [0 1 2 3 4]
- After call histogram, it will calculate the total count each number in a= [0 1 2 3 4] according to each bins(阈值), for example:
bins |
Contains number |
result |
[0.-0.4) |
0 |
1 |
[0.4-0.8) |
N/A |
0 |
[0.8-1.2) |
1 |
1 |
[1.2-1.6) |
N/A |
0 |
[1.6-2.) |
N/A |
0 |
[2.-2.4) |
2 |
1 |
[2.4-2.8) |
N/A |
0 |
[2.8-3.2) |
3 |
1 |
[3.2-3.6) |
N/A |
0 |
[3.6-4.] |
4 |
1 |
[0.-0.4) contains 0, so result is 1
[0.4-0.8) does not contain any number in [0 1 2 3 4], so result is 0
[0.8-1.2) contains 1, so result is 1
[1.2-1.6) does not contain any number in [0 1 2 3 4], so result is 0
[1.6-2.) does not contain any number in [0 1 2 3 4], so result is 0
[2.-2.4) contains 2, so result is 1
[2.4-2.8) does not contain any number in [0 1 2 3 4], so result is 0
[2.8-3.2) contains 3, so result is 1
[3.2-3.6) does not contain any number in [0 1 2 3 4], so result is 0
[3.6-4.] contains 4, so result is 1
The above is the detailed content of Numpy API Analysis. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



How to upgrade numpy version: Easy-to-follow tutorial, requires concrete code examples Introduction: NumPy is an important Python library used for scientific computing. It provides a powerful multidimensional array object and a series of related functions that can be used to perform efficient numerical operations. As new versions are released, newer features and bug fixes are constantly available to us. This article will describe how to upgrade your installed NumPy library to get the latest features and resolve known issues. Step 1: Check the current NumPy version at the beginning

Teach you step by step to install NumPy in PyCharm and make full use of its powerful functions. Preface: NumPy is one of the basic libraries for scientific computing in Python. It provides high-performance multi-dimensional array objects and various functions required to perform basic operations on arrays. function. It is an important part of most data science and machine learning projects. This article will introduce you to how to install NumPy in PyCharm, and demonstrate its powerful features through specific code examples. Step 1: Install PyCharm First, we

The secret of how to quickly uninstall the NumPy library is revealed. Specific code examples are required. NumPy is a powerful Python scientific computing library that is widely used in fields such as data analysis, scientific computing, and machine learning. However, sometimes we may need to uninstall the NumPy library, whether to update the version or for other reasons. This article will introduce some methods to quickly uninstall the NumPy library and provide specific code examples. Method 1: Use pip to uninstall pip is a Python package management tool that can be used to install, upgrade and

Numpy installation guide: One article to solve installation problems, need specific code examples Introduction: Numpy is a powerful scientific computing library in Python. It provides efficient multi-dimensional array objects and tools for operating array data. However, for beginners, installing Numpy may cause some confusion. This article will provide you with a Numpy installation guide to help you quickly solve installation problems. 1. Install the Python environment: Before installing Numpy, you first need to make sure that Py is installed.

Detailed explanation of numpy slicing operation method and practical application guide Introduction: Numpy is one of the most popular scientific computing libraries in Python, providing powerful array operation functions. Among them, slicing operation is one of the commonly used and powerful functions in numpy. This article will introduce the slicing operation method in numpy in detail, and demonstrate the specific use of slicing operation through practical application guide. 1. Introduction to numpy slicing operation method Numpy slicing operation refers to obtaining a subset of an array by specifying an index interval. Its basic form is:

Examples and applications of Tensor and Numpy conversion TensorFlow is a very popular deep learning framework, and Numpy is the core library for Python scientific computing. Since both TensorFlow and Numpy use multi-dimensional arrays to manipulate data, in practical applications, we often need to convert between the two. This article will introduce how to convert between TensorFlow and Numpy through specific code examples, and explain its use in practical applications. head

The NumPy library is one of the important libraries in Python for scientific computing and data analysis. However, sometimes we may need to uninstall the NumPy library, perhaps because we need to upgrade the version or resolve conflicts with other libraries. This article will introduce readers to how to correctly uninstall the NumPy library to avoid possible conflicts and errors, and demonstrate the operation process through specific code examples. Before we start uninstalling the NumPy library, we need to make sure that the pip tool is installed, because pip is the package management tool for Python.

Oracle is a world-renowned database management system provider, and its API (Application Programming Interface) is a powerful tool that helps developers easily interact and integrate with Oracle databases. In this article, we will delve into the Oracle API usage guide, show readers how to utilize data interface technology during the development process, and provide specific code examples. 1.Oracle
