正确答案:A
2单选(1分) 在使用numpy绘制图像手绘效果的实例中,关于使用像素间梯度值,如下哪个说法是正确的? A.梯度值是颜色值的灰度表示 B.梯度值是颜色值的一维表示,颜色越相近梯度值越大 C.梯度值用于表示颜色值在RGB维度上数据的相关关系 D.梯度值用于表示颜色间差距,相似颜色趋近于白色
正确答案:D
3单选(1分) 下面两段代码,哪个说法不正确?
import numpy as np
a = np.array([0, 1, 2, 3, 4])
import pandas as pd
b = pd.Series([0, 1, 2, 3, 4])
[/code]
A.a和b是不同的数据类型,之间不能直接运算
B.a和b表达同样的数据内容
C.a和b都是一维数据
D.a参与运算的执行速度明显比b快
正确答案:D
4单选(1分)
哪个选项更能代表如下代码的运行结果?
```code
import numpy as np
x = np.array([ [ 0, 1, 2, 3, 4], [9, 8, 7, 6] ])
x.dtype()
[/code]
A.float32类型
B.int32类型
C.uint32类型
D.object类型
正确答案:D
5单选(1分)
Python基本语法仅支持整数、浮点数和复数类型,numpy和pandas库则支持int64/int32/int16/int8等20余种数字类型,如下说法哪个不正确?
A.科学计算可能涉及很多数据,对存储和性能有较高要求,因此支持更多种数字类型。
B.numpy底层是C语言实现,因此,天然支持了多种数据类型。
C.程序员必须精确指定数据类型,因此,会给编程带来一定负担
D.对元素类型精确定义,有助于numpy和pandas库更合理优化存储空间。
正确答案:C
6单选(1分)
如下哪个代码不能生成一个ndarray对象?
A. ` a = np.array([0, 1, 2, 3, 4]) `
B. ` a = np.array({0:0,1:1,2:2,3:3,4:4}) `
C. ` a = np.array((0, 1, 2, 3, 4) `
D. ` a = np.array(0, 1, 2, 3, 4) `
正确答案:D
7单选(1分)
如下哪个语句能够生成一个n*n的正方形矩阵,对角线值为1,其余位置值为0。
A.np.zeros((n,n))
B.np.eye(n)
C.np.full((n,n),1)
D.np.ones((n,n))
正确答案:B
8单选(1分)
哪个是下面代码的运行结果?
```code
import numpy as np
a = np.arange(12).reshape((3,4))
print(a.mean())
[/code]
A.[4, 5, 6, 7]
B.16.5
C.5.5
D.[1.5, 5.5, 9.5]
正确答案:C
9单选(1分)
如下代码中plt的含义是什么?
```code
import matplotlib.pyplot as plt
[/code]
A.别名
B.类名
C.函数名
D.变量名
正确答案:A
10单选(1分)
阅读下面代码:
```code
import matplotlib.pyplot as plt
plt.plot([9, 7, 15, 2, 9])
plt.savefig('test', dpi=600)
[/code]
其中,savefig()函数的作用是什么?
A.将数据图存储成文件
B.记录并存储数据
C.刷新数据
D.显示所绘制的数据图
正确答案:A
11单选(1分)
阅读下面代码:
```code
import matplotlib.pyplot as plt
plt.plot([9, 7, 15, 2, 9])
plt.show()
[/code]
其中,show()函数的作用是什么?
A.显示所绘制的数据图
B.存储所绘制的数据图
C.缓存所绘制的数据图
D.刷新所绘制的数据图
正确答案:A
12单选(1分)
阅读如下代码:
```code
import pandas as pd
s = pd.Series(10, index=['a', 'b', 'c']
[/code]
关于变量s,哪个说法是不正确的?
A.如果index部分省略,默认生成的索引是0, 1, 2
B.s是一个一维数组
C.s中元素的索引分别是’a’, ‘b’, ‘c’
D.s中每个元素的值是10
正确答案:A
13单选(1分)
阅读如下代码:
```code
import pandas as pd
a = pd.Series([9, 8, 7, 6], index=['a', 'b', 'c', 'd'])
[/code]
哪个是print(a.index)的结果?
A.[9, 8, 7, 6]
B.[‘a’, ‘b’, ‘c’, ‘d’]
C.(‘a’, ‘b’, ‘c’, ‘d’)
D.Index([‘a’, ‘b’, ‘c’, ‘d’])
正确答案:D
14单选(1分)
阅读如下代码:
```code
import pandas as pd
dt = {'one': [9, 8, 7, 6], 'two': [3, 2, 1, 0]}
a = pd.DataFrame(dt)
[/code]
哪个是print(a.values)的结果?
A.[[9 8 7 6] [3 2 1 0]]
B.[3, 2, 1, 0]
C.[[9 3]
[8 2]
[7 1]
[6 0]]
D.[9, 8, 7, 6]
正确答案:C
15单选(1分)
阅读如下代码:
```code
import pandas as pd
dt = {'one': [9, 8, 7, 6], 'two': [3, 2, 1, 0]}
a = pd.DataFrame(dt)
[/code]
希望获得[‘one’, ‘two’],使用如下哪个语句?
A.a.index
B.a.row
C.a.values
D.a.columns
正确答案:D
16单选(1分)
阅读如下代码:
```code
import pandas as pd
dt = {'one': [9, 8, 7, 6], 'two': [3, 2, 1, 0]}
a = pd.DataFrame(dt)
[/code]
希望获得[3, 2, 1, 0],使用如下哪个语句?
A.a.ix[1]
B.a.index[1]