Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
300 views
in Technique[技术] by (71.8m points)

numpy - spyder ananconda控制台中的Numpy功能。 索引切片?(Numpy functions in spyder ananconda console. Index slicing?)

Can someone explain the codes for these two situations?

(有人可以解释这两种情况的代码吗?)

Any help much appreciated.

(任何帮助,不胜感激。)

I'm using a spyder anaconda console if that helps :slight_smile:

(我正在使用spyder anaconda控制台,如果有帮助的话:slight_smile:)

  1. Given:

    (鉴于:)

In []: import numpy as np

(在[]中:将numpy导入为np)

In []: x = (20*np.random.rand(5, 7))//2

(在[]中:x =(20 * np.random.rand(5,7))// 2)

Enter an expression which sets columns 1, 3, and 4 to 1.5.

(输入将第1、3和4列设置为1.5的表达式。)

Use advanced indexing combined with slicing for this.

(为此,请结合使用高级索引和切片。)

  1. Given:

    (鉴于:)

In []: import numpy as np

(在[]中:将numpy导入为np)

In []: x = np.zeros((5, 3))

(在[]中:x = np.zeros((5,3)))

In []: col = np.arange(5.0) ``

(在[]:col = np.arange(5.0)``)

Enter an expression which adds col to column 1 of x.

(输入一个表达式,将col添加到x的第1列。)

  ask by sam translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...