Numpy Articles

Page 43 of 81

Finding the k smallest values of a NumPy array

Atharva Shah
Atharva Shah
Updated on 21-Aug-2023 809 Views

Finding the k smallest values of a NumPy arra Installation and Syntax Pip, Python's package installer, is often used to install NumPy. pip install numpy The following function may be used to identify the k NumPy array elements with the smallest values − np.sort(array)[:k] This returns the first k items of the sorted array after sorting it in ascending order. The array may be be sorted using the alternative syntax shown below, which will retrieve the last k entries and sort the array in descending order − np.sort(array)[::-1][:k] Algorithm The algorithm for finding the k smallest ...

Read More

Find the sum and product of a NumPy array elements

Atharva Shah
Atharva Shah
Updated on 21-Aug-2023 674 Views

A Python package called NumPy is employed in scientific computing and to handle large-scale numerical data. It provides support for multi-dimensional arrays and matrices, as well as a large library of mathematical functions to manipulate them. In this tutorial, we will focus on two of the most commonly used NumPy functions: sum() and prod(). These functions are used to calculate the sum and product of all the elements in a NumPy array, respectively. Installation Get the numpy package installed using pip inside your terminal pip install numpy Import it as highlighted after successful installation − import numpy as np ...

Read More

How to Conduct a Paired Samples T-Test

Parth Shukla
Parth Shukla
Updated on 17-Aug-2023 553 Views

Introduction In machine learning and data science, many statistical tests are used to compare and find the differences between variables or the features of the data. These tests are mainly hypothesis tests where the conditions are defined, and according to the different tests being conducted, the relationship between variables is assumed. The t-test is also a type of statistical test that is used to compare the means of different groups of the categorical variable. In this article, we will discuss the paired t-test, which is an extension or a type of t-test used in statistics, and we will ...

Read More

Convert a NumPy array to an image

Niharika Aitam
Niharika Aitam
Updated on 09-Aug-2023 10K+ Views

The array created using the Numpy library can be converted into an image using the PIL or opencv libraries in python programming language. Let’s see about each library one by one. Python Image Library PIL is abbreviated as Python Image Library, which is an image processing libraries in python. It is a light weight and easy to use library to perform the image processing tasks like reading, writing, resizing and cropping the images. This library performs all the basic image processing tasks but don’t have any advanced features required for computer vision applications. We have a function in ...

Read More

Convert a NumPy array into a csv file

Niharika Aitam
Niharika Aitam
Updated on 09-Aug-2023 1K+ Views

The Numpy is the library in the python programming language which is abbreviated as Numerical Python. It is used to do the mathematical, scientific and statistical calculations within less time. The output of the numpy functions will be an array. An array created by the numpy functions can be stored in the CSV file using a function namely, savetxt(). Numpy array into a .csv file CSV is abbreviated as Comma Separated Values. This is the file format most widely used in the Data Science. This stores the data in a tabular format where the column holds the data fields and ...

Read More

Compute the mean, standard deviation, and variance of a given NumPy array

Niharika Aitam
Niharika Aitam
Updated on 07-Aug-2023 731 Views

Mean, Standard Deviation and Variance are the statistical measures which are used to describe the distribution of the given dataset data. In Numpy library, we have the functions to calculate the mean, standard deviation and variance of the arrays. Let’s see one by one in detail. Mean Mean is also known as average, which is the sum of all the elements in the array divided by the total number of elements. It is used to represent the central tendency of the data. Syntax Following is the syntax for applying the mean function on the arrays - numpy.mean(arr) ...

Read More

Compute the inverse of a matrix using inv() function of NumPy

Niharika Aitam
Niharika Aitam
Updated on 07-Aug-2023 262 Views

The inverse matrix is a matrix that gives a multiplicative identity when multiplied with its original matrix. It is denoted by A-1. The inverse matrix can be calculated for the square matrices with the n x n size. The mathematical formula given for calculating the inverse matrix is as follows. A-1 . A = A . A-1 = I Where, A is the original matrix. A-1 is the inverse of the original matrix A. I is the identity matrix. Let’s take the original matrix as A with the size 2 x 2 and elements as ...

Read More

Compute the covariance matrix of two given NumPy arrays

Niharika Aitam
Niharika Aitam
Updated on 07-Aug-2023 1K+ Views

Covariance is the measure of two variables that defines how they are related to each other. In other words, it measures the extent to which one variable is associated with the changes in the other variable. When the covariance of the variables is positive, it implies that both variables are moving in the same direction i.e. if one variable tends to increase, as a result, the value of the other variable also increases. When the covariance of the variables is negative then it represents the two variables are moving in opposite direction i.e. if one variable increases the value ...

Read More

Building a Fraud Detection Model for a Bank

Premansh Sharma
Premansh Sharma
Updated on 24-Jul-2023 636 Views

Introduction Financial fraud has become an increasingly common problem for banks and financial organizations throughout the world as technology advances. Money laundering, identity theft, and credit card fraud can all result in major financial losses as well as damage to a bank's image. As a result, banks must take proactive steps to prevent and detect fraudulent activity. Building a fraud detection model is one such method that can assist identify fraudulent transactions and flag them for further examination. In this article, we will examine the steps involved in creating a fraud detection model for a bank, starting with ...

Read More

How to resample a NumPy array representing an image?

Rohan Singh
Rohan Singh
Updated on 11-Jul-2023 3K+ Views

Resampling a Numpy array representing an image is the process of changing the size of the array while maintaining the quality of the image. We can resample an array using interpolation, decimation, and upsampling techniques in Python. We can use the ndimage.zoom() function for Scipy library in Python to resample a Numpy array representing an image. In this article, we will understand how to resample a Numpy array representing an image using the Scipy module in Python. Interpolation Interpolation is a technique used to estimate values between existing data points. In Numpy we have several interpolation methods like liner, ...

Read More
Showing 421–430 of 802 articles
« Prev 1 41 42 43 44 45 81 Next »
Advertisements