Python Data analysis

Source: Internet
Author: User
Tags mathematical functions

ImportNumPy as Nplist= [[1,3,5,7],[2,4,6,8]]np_list= Np.array (list)#convert l list data to an array typePrint(np_list)" "[ [1 3 5 7] [2 4 6 8]" "Np_list1= Np.array (list,dtype=np.float)#The type of the array is defined by Dtype, and the default auto-recognitionPrint(NP_LIST1)#bool,int,int8,int32,int16,int64,int128,uint8 and so on, float. float16/32/, etc." "[1.3. 5.7.]  [2.4. 6.8.]" "#properties of the dataPrint(Np_list.shape)#(2, 4) Two rows four columnsPrint(Np_list.ndim)#2 Dimensions of the dataPrint(Np_list.dtype)#int32 types of arraysPrint(np_list.itemsize)#4 size of each dataPrint(np_list.size)#8 Number of data#some arrays some arraysPrint(Np.ones (3,5)))" "[1.1.  1.1.  1.] [1.  1.1. 1.1.]  [1.1.  1.1. 1.]" "                 Print(Np.zeros (2,4)))" "[0.0. 0.0.]  [0.0. 0.0.]" " #Random number#RandPrint(Np.random.rand (2,4))#generate a two-line, four-class random number" "[ [0.72024033 0.93403506 0.73121086 0.84075394] [0.98034306 0.6471637 0.77923702 0.44984363]" "Print(Np.random.rand ())#0.702153504735015 a random number#RandintPrint(Np.random.randint (1,10))#You have to fill in the number rangePrint(Np.random.randint (1,10,3))#The first two digits are the range, followed by a random number of outputs#RANDN Standard dynamically generated random numbersPrint(Np.random.randn ())#0.2021606168747088Print(Np.random.randn (2,4))#normal random number of two rows of four columns" "[ [ -0.43522053 0.288716 1.5751424-0.89094638] [ -1.12602864 1.27198812-0.4784293 1.90768013]" "#choice randomly generates a random number within an arrayPrint(Np.random.choice ([10,20,30]))#randomly generate a random numberPrint(Np.random.choice ([10,20,30],2))#randomly generate a random number#distribution of mathematical functionsPrint(Np.random.beta (1,10,100))#distribution of beta functions

Python Data analysis

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.