11 2020 档案
摘要:用法说明:[以下2种都可以] import matplotlib as mpl mpl.rcParams["xxx"] = "xxxxx" from matplotlib import pyplot as plt plt.rcParams["xxx"] = "xxxxx" 一、什么是rc配置 mat
阅读全文
摘要:plt.axis(‘square’)作图为正方形,并且x,y轴范围相同,即y m a x − y m i n = x m a x − x m i n y_{max}-y_{min} = x_{max}-x_{min}ymax−ymin=xmax−xmin plt.axis(‘equal’)x
阅读全文
摘要:np.where(condition, [x, y])官方解释看的不是很懂,研究各种材料后,总结如下: 一、np.where(condition, x, y) 1.返回值是一个和condition的shape相同的numpy 数组 2.当满足条件condition时,返回值中的元素从x中取,否则从y
阅读全文
摘要:区别: 创建numpy数组时,np.array()会copy一份; 创建numpy数组时,np.asarray()也会copy一份,但是如果数据源是ndarray类型时,不会copy 举例: 1. 数据源a是数组ndarray时,array仍然会copy出一个副本,占用新的内存,但asarray不会
阅读全文
摘要:file -- settings -- editor -....,如下图所示
阅读全文
摘要:enumerate() 函数用于将一个可遍历的数据对象(如列表、元组或字符串)组合为一个索引序列,同时列出数据和数据下标,一般用在 for 循环当中。 举例: a = [2, 5, 10, -1, 3] for i, value in enumerate(a): print(i, value) 代码
阅读全文
摘要:当使用 import sklearn sklearn.linear_model.LogisticRegression() 报如下错误 AttributeError: module 'sklearn' has no attribute 'linear_model' 修改为: from sklearn.
阅读全文