课程: Python Functions for Data Science
今天就学习课程吧!
今天就开通帐号,24,600 门业界名师课程任您挑!
Scalar operations on NumPy arrays
- Another advantage of working with Numpy Arrays is that scalar operations on Numpy Arrays are efficient and easy to do. Note that scalar operations on Numpy Arrays are performed element wise. I'll be walking through some examples to demonstrate these operations. I'm initializing a variable named arrayA as a one dimensional Numpy Array containing the even integers between two and 20 inclusive. Let's say I want to add three to each element of arrayA, thereby creating a new Numpy Array that contains the result. It would look like this. Now say I want to subtract four from each element of arrayA, thereby creating a new Numpy Array that contains the result. It would look like this. Then say I want to multiply each element of arrayA by five, thereby creating a new Numpy Array that contains the result. It would look like this. Next, say I want to divide each element of arrayA by two, thereby creating a new Numpy Array that contains…
随堂练习,边学边练
下载课堂讲义。学练结合,紧跟进度,轻松巩固知识。
内容
-
-
-
-
-
(已锁定)
Create NumPy arrays in Python5 分钟 30 秒
-
(已锁定)
Minimum and maximum values in NumPy arrays51 秒
-
Indices of min and max values in NumPy arrays1 分钟 4 秒
-
(已锁定)
Find shapes of NumPy arrays and reshape4 分钟 23 秒
-
(已锁定)
Select items or groups of items from NumPy arrays4 分钟 35 秒
-
(已锁定)
Arithmetic operations on NumPy arrays2 分钟 5 秒
-
(已锁定)
Scalar operations on NumPy arrays1 分钟 33 秒
-
(已锁定)
Statistical operations on NumPy arrays56 秒
-
(已锁定)
Other operations on NumPy arrays2 分钟 58 秒
-
(已锁定)
-
-
-
-
-