MACHINE LEARNING RECIPES
DATA CLEANING PYTHON
DATA MUNGING
PANDAS CHEATSHEET
ALL TAGS
# How to rank items in an array using numpy?

# How to rank items in an array using numpy?

This recipe helps you rank items in an array using numpy

How to rank items in an array using numpy? This is possible by using "empty_like" and "argsort" functions available in the numpy library.

```
import numpy as np
```

```
Sample_array = np.array([1,4,8,7,10,11,6,2])
print("This is the original array:",Sample_array)
```

This is the original array: [ 1 4 8 7 10 11 6 2]

```
Sorted_array = Sample_array.argsort()
```

```
array_ranks = np.empty_like(Sorted_array)
array_ranks[Sorted_array] = np.arange(len(Sample_array))
print("This is the original Sample array:", Sample_array, "\n")
print("This is the Sorted array:", Sample_array[Sorted_array], "\n")
print("This is the rank of element present in the array:", array_ranks)
```

This is the original Sample array: [ 1 4 8 7 10 11 6 2] This is the Sorted array: [ 1 2 4 6 7 8 10 11] This is the rank of element present in the array: [0 2 5 4 6 7 3 1]

In this deep learning project, we will predict customer churn using Artificial Neural Networks and learn how to model an ANN in R with the keras deep learning package.

The goal of this data science project is to build a predictive model and find out the sales of each product at a given Big Mart store.

In this loan prediction project you will build predictive models in Python using H2O.ai to predict if an applicant is able to repay the loan or not.

In this NLP AI application, we build the core conversational engine for a chatbot. We use the popular NLTK text classification library to achieve this.

In this project, we are going to talk about Time Series Forecasting to predict the electricity requirement for a particular house using Prophet.

Use the Amazon Reviews/Ratings dataset of 2 Million records to build a recommender system using memory-based collaborative filtering in Python.

Data Science Project in R -Build a machine learning algorithm to predict the future sale prices of homes.

This project analyzes a dataset containing ecommerce product reviews. The goal is to use machine learning models to perform sentiment analysis on product reviews and rank them based on relevance. Reviews play a key role in product recommendation systems.

In this machine learning project you will work on creating a robust prediction model of Rossmann's daily sales using store, promotion, and competitor data.

In this machine learning resume parser example we use the popular Spacy NLP python library for OCR and text classification.