DATA MUNGING
DATA CLEANING PYTHON
MACHINE LEARNING RECIPES
PANDAS CHEATSHEET
ALL TAGS
# How to reshape a Numpy array in Python?

# How to reshape a Numpy array in Python?

This recipe helps you reshape a Numpy array in Python

Have you ever tried to reshape a numpy array? Creating a new array to reshape it might be a hectic task. So how we can do it very easily in python.

So this is the recipe on how we can Reshape a Numpy Array.

```
import numpy as np
```

We have only imported numpy which is needed.

We have created a 4 x 3 matrix using array and we will reshape it.
```
matrix = np.array([[11, 22, 33],
[44, 55, 66],
[77, 88, 99],
[110, 121, 132]])
```

We can reshape the matrix by using reshape function. In the function we have to pass the shape of the final matrix we want. (If we want a matrix of n by m then we have to pass (n,m)).
```
print(matrix.reshape(2, 6))
print(matrix.reshape(3, 4))
print(matrix.reshape(6, 2))
```

So the output comes as

[[ 11 22 33 44 55 66] [ 77 88 99 110 121 132]] [[ 11 22 33 44] [ 55 66 77 88] [ 99 110 121 132]] [[ 11 22] [ 33 44] [ 55 66] [ 77 88] [ 99 110] [121 132]]

Machine Learning Project in R-Detect fraudulent click traffic for mobile app ads using R data science programming language.

In this data science project, we will predict the credit card fraud in the transactional dataset using some of the predictive models.

In this data science project, you will learn how to perform market basket analysis with the application of Apriori and FP growth algorithms based on the concept of association rule learning.

Deep Learning Project- Learn to apply deep learning paradigm to forecast univariate time series data.

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.

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.

Data Science Project - Build a recommendation engine which will predict the products to be purchased by an Instacart consumer again.

Data Science Project in Python- Given his or her job role, predict employee access needs using amazon employee database.

Use the Adult Income dataset to predict whether income exceeds 50K yr based on
census data.

In this data science project, you will work with German credit dataset using classification techniques like Decision Tree, Neural Networks etc to classify loan applications using R.