码迷,mamicode.com
首页 >  
搜索关键字:arange    ( 205个结果
数据框索引行
label1=['apple','orange','pear','banana'] label2=['one','two','three','four'] df=pd.DataFrame(np.arange(16).reshape(4,-1),index=label1,columns=label2) ...
分类:其他好文   时间:2020-04-24 01:53:43    阅读次数:109
python - numpy基础(二)
一、numpy的基础操作 1、改变数组形状 (1).T 方法:转置,例如原来形状为(2,3)/(2,3,4)转置为(3,2)/(4,3,2),一维数组转置后不变。 a = np.arange(5) print(a,'\n',a.T) b = np.ones((2,3)) print(b,'\n',b ...
分类:编程语言   时间:2020-04-22 19:44:52    阅读次数:104
python matplotlib 中ax.legend()用法解释
ax.legend()作用:在图上标明一个图例,用于说明每条曲线的文字显示 import matplotlib.pyplot as plt import numpy as np x = np.arange(10) fig = plt.figure() ax = plt.subplot(111) fo ...
分类:编程语言   时间:2020-04-05 22:17:33    阅读次数:545
数组的转置
1 #导入numpy模块 2 import numpy as np 3 a = np.arange(1,25).reshape(8,3) 4 print(a) 5 print('transpose函数进行数组转置a[i][j] a[j][i]') 6 b = a.transpose() 7 prin ...
分类:编程语言   时间:2020-04-05 11:45:04    阅读次数:51
numpy 数组运算
对数组做基本的算术运算,将会对整个数组的所有元组进行逐一运算,并将运算结果保存在一个新的数组内,而不会破坏原始的数组。 >>> a = np.array( [20,30,40,50] ) >>> b = np.arange( 4 ) >>> b array([0, 1, 2, 3]) >>> c = ...
分类:编程语言   时间:2020-04-01 10:47:31    阅读次数:62
loc和iloc的区别
import pandas as pd import numpy as np df = pd.DataFrame(np.arange(10).reshape(5,2),index=list("cvbnm"),columns=list('AB')) print(df) print(" ") print ...
分类:其他好文   时间:2020-03-16 21:57:38    阅读次数:72
numpy创建二维数组
(一)直接创建 d=np.array([[10,11,12],[20,21,22],[30,31,32]]) (二)创建元组递增数组 d=np.arange(20).reshape(5,4) (三)创建指定范围的递增数组 d=np.arange(10,20).reshape(5,2) (四)创建随机 ...
分类:编程语言   时间:2020-03-16 12:41:30    阅读次数:109
数据分析-numpy-通用函数
# 数组形状:T/.reshope()/.resize() import numpy as np ar1 = np.arange(5) ar2 = np.ones((5,2)) print(ar1,'\n',ar1.T) print(ar2,'\n',ar2.T) # .T方法:转置,例如原shap ...
分类:其他好文   时间:2020-03-14 11:20:29    阅读次数:72
19-pandas排序和随机抽样
import numpy as np import pandas as pd df=pd.DataFrame(np.arange(25).reshape(5,5)) new_order=np.random.permutation(5)#不暗中哦顺序排列 print(df.take(new_order ...
分类:编程语言   时间:2020-03-09 13:32:03    阅读次数:68
python,pandas常用函数
一、rename,更改df的列名和行索引 1 df=pd.DataFrame(np.arange(1,10).reshape(3,3)) 2 print(df) 3 print(type(df)) 4 结果为: 5 0 1 2 6 0 1 2 3 7 1 4 5 6 8 2 7 8 9 9 <cla ...
分类:编程语言   时间:2020-02-28 12:09:02    阅读次数:107
205条   上一页 1 ... 3 4 5 6 7 ... 21 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!