Numpy _ base _ 1, numpy base _ 1

Source: Internet
Author: User

Numpy _ base _ 1, numpy base _ 1

Ndarray: multidimensional array

Ndarray each array element must be of the same type, and each array has a shape and dtype object.

Shape indicates the array size.

Dtype indicates the array data type

Array

How to create an array?

In [1]: import numpy as np

In [2]: data = [1, 2, 3, 4, 5, 6, 7]

In [3]: arr = np. array (data)

In [3]: arr

Out [3]: array ([1, 2, 3, 4, 5, 6, 7])

 

View array size

Arr. shape

View array data types

Arr. dtype

Asarray

Np. asarray (1, 2, 3, 4, 5, 6, 7)

Arange

Np. arange (10)

Ones

Create an array full of 1

Ones_like

Zeros

Create a zero-dimensional array

2-Dimension

Create a two-dimensional array with all values 0

Dimension 3

Create a 3D array with all values 0

Empty

Enter the memory spam value, but do not fill the value

Empty_lile

Input an array to create an array full of 1

Eye

Create an N * N Array with a diagonal line of 1 and other values of 0

Identity

Create an N * N Array with a diagonal line of 1 and other values of 0

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.