提供高质量的essay代写,Paper代写,留学作业代写-天才代写

首頁 > > 詳細

EGM271程序代做、代寫Python程序語言、代做Data Analytics代寫Python編程|代寫留學生 Statistics統計、回歸、迭代

School of Engineering
Laboratory Session 2
Course : Diploma in Engineering with Business
Module : EGM271 Statistics & Data Analytics
Title : The NumPy Library (Part 1)
What is NumPy?
NumPy is a basic package for scientific computing with Python and especially for data
analysis. In fact, this library is the basis of a large amount of mathematical and scientific
Python packages, and among them, as you will see later in the book, the pandas library.
This library, specialized for data analysis, is fully developed using the concepts introduced
by NumPy. In fact, the built-in tools provided by the standard Python library could be too
simple or inadequate for most of the calculations in data analysis. Having knowledge of
the NumPy library is important to being able to use all scientific Python packages, and
particularly, to use and understand the pandas library.
Note that throughout all the lab sheets in this module, we are using Spyder:
1. Lines with “In:” are the codes you type in the console. You can run them
simply by pressing “Enter”.
2. Lines with “Out:” are the output shown in the console.
3. Lines without “In” or “Out” are the codes you type in the editor. You need to
click the Run button to run it.
To start using Numpy, type this in your Spyder editor and run the program:
import numpy as np
Ndarray: The Heart of the Library
The NumPy library is based on one main object: ndarray (which stands for N-dimensional
array). This object is a multidimensional homogeneous array with a predetermined
number of items:
• Homogeneous because virtually all the items in it are of the same type and the
same size. In fact, the data type is specified by another NumPy object called dtype
(data-type); each ndarray is associated with only one type of dtype.
• The number of the dimensions and items in an array is defined by its shape, a
tuple of N-positive integers that specifies the size for each dimension. The
dimensions are defined as axes and the number of axes as rank.
• Another peculiarity of NumPy arrays is that their size is fixed, that is, once you
define their size at the time of creation, it remains unchanged. This behaviour is
different from Python lists, which can grow or shrink in size.
The easiest way to define a new ndarray is to use the array() function, passing a Python
list containing the elements to be included in it as an argument.
In: a = np.array([1, 2, 3])
In: a
Out: array([1, 2, 3])
You can easily check that a newly created object is an ndarray by passing the new
variable to the type() function.
In: type(a)
Out:
You can also refer to the Variable Explorer for information about your array:
The name is a, data type is int32. The Size (3, ) indicates that it is of rank 1 (1 row), and
size 3 (3 columns).
What you have just seen is the simplest case of a one-dimensional array. But the use of
arrays can be easily extended to several dimensions. For example, if you define a twodimensional
array 2x2:
In: b = np.array([[1.3, 2.4],[0.3, 4.1]])
This array has rank 2, since it has two rows, each of length 2.
Types of Data
So far you have seen only simple integer and float numeric values, but NumPy arrays are
designed to contain a wide variety of data types. For example, you can use the data type
string:
In: g = np.array([['a', 'b'],['c', 'd']])
In: g
Out: array([['a', 'b'],['c', 'd']], dtype='

聯系我們
  • QQ:1067665373
  • 郵箱:1067665373@qq.com
  • 工作時間:8:00-23:00
  • 微信:Essay_Cheery
熱點文章
程序代寫更多圖片

聯系我們 - QQ: 1067665373 微信:Essay_Cheery
? 2021 uk-essays.net
程序代寫網!

在線客服

售前咨詢
售后咨詢
微信號
Essay_Cheery
微信
全优代写 - 北美Essay代写,Report代写,留学生论文代写作业代写 北美顶级代写|加拿大美国论文作业代写服务-最靠谱价格低-CoursePass 论文代写等留学生作业代做服务,北美网课代修领导者AssignmentBack 北美最专业的线上写作专家:网课代修,网课代做,CS代写,程序代写 代码代写,CS编程代写,java代写北美最好的一站式学术代写服务机构 美国essay代写,作业代写,✔美国网课代上-最靠谱最低价 美国代写服务,作业代写,CS编程代写,java代写,python代写,c++/c代写 代写essay,作业代写,金融代写,business代写-留学生代写平台 北美代写,美国作业代写,网课代修,Assignment代写-100%原创 北美作业代写,【essay代写】,作业【assignment代写】,网课代上代考