NumPy | Python Methods and Functions

** numpy.alen() ** is used to return the length of the first dimension of the input array.

Syntax:numpy.alen (arr)

Parameters:

arr:[array_like] Input array.

Return:[int] Length of the first dimension of arr.

** Code # 1: **

` ` |

** Output:**

Input array: [[2 , 0, 7], [0, 5, 9]] Length of the first dimension of arr: 2

** Code # 2: **

` `

` # Python program explaining `

` # alen () function `

` `

` `

` import `

` numpy as geek `

` # input array (1 * 3 * 3) `

` in_arr `

` = `

` geek.arange (`

` 9 `

`). reshape (`

` 1 `

`, `

` 3 `

`, `

` 3 `

`) `

` print `

` (`

`" Input array: "`

`, in_arr) `

` out_dim `

` = `

` geek.alen (in_arr) `

` print `

` (`

` "Length of the first dimension of arr:" `

`, out_dim) `

` `

** Exit: **

Input array: [[[0 1 2] [3 4 5] [6 7 8]]] Length of the first dimension of arr: 1

This book is an indispensable guide focuses on Machine Learning and R Programming, in an instructive and conversational tone which helps them who want to make their career in Big Data Analytics/ Data ...

10/07/2020

Efficiently perform data collection, wrangling, analysis, and visualization using Python. Recent advancements in computing and artificial intelligence have completely changed the way we understand ...

23/09/2020

Python Data Science Handbook: Essential Tools for Working with Data - PDF, 1st Edition For many researchers, Python is a first-class tool, primarily because of its libraries for storing, manipulati...

22/08/2021

Learning to code is tremendous fun as you can get instant results, no matter how much more you have to learn. In fact, it’s such fun creating games and programs that it feels effortless once you’r...

23/09/2020

X
# Submit new EBook