上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 17 下一页
摘要: import numpy from matplotlib import pyplot x=numpy.linspace(-3,3,50) y1=2*x+1 y2=x**2 #创建第一个画布 pyplot.figure() pyplot.plot(x,y1) #创减第二个画布 pyplot.figur 阅读全文
posted @ 2020-06-17 13:47 马蹄哒哒 阅读(214) 评论(0) 推荐(0)
摘要: import numpy a=numpy.arange(12).reshape(3,4) b=a[:2,:2] #对子数组b中值进行修改,将会影响到a数组中的值 b[0][1]=1000 print(a) [[ 0 1000 2 3] [ 4 5 6 7] [ 8 9 10 11]] print(b 阅读全文
posted @ 2020-06-17 10:54 马蹄哒哒 阅读(163) 评论(0) 推荐(0)
摘要: import numpy x=numpy.arange(1,13) a=x.reshape(4,3) #二维数组 #索引的使用 b=a[2] #获取第二行 c=a[2][2] #获取第二行的第三列 #切片的使用 d=a[:,:] #获取所有行与列 e=a[:,1] #获取所以行第二列的数据 f=a[ 阅读全文
posted @ 2020-06-17 10:43 马蹄哒哒 阅读(964) 评论(0) 推荐(0)
摘要: import numpy a=numpy.arange(10) #索引访问,和字符串索引一样 print(a[-3]) print(a[2]) #切片访问 print(a[:]) print(a[3:4]) print(a[1:7:2]) print(a[::-1]) 阅读全文
posted @ 2020-06-17 10:21 马蹄哒哒 阅读(393) 评论(0) 推荐(0)
摘要: isdecimal():判断给定字符串是否全为数字 isalpha():判断给定的字符串是否全为字母 isalnum():判断给定的字符串是否只含有数字与字母 isupper():判断给定的字符串是否全为大写 islower():判断给定的字符串是否全为小写 istitle():判断给定的字符串是否 阅读全文
posted @ 2020-06-16 18:32 马蹄哒哒 阅读(340) 评论(0) 推荐(0)
摘要: import numpy #zeros方法 a=numpy.zeros((5),dtype=int) b=numpy.zeros((3,4)) #ones方法 c=numpy.ones((10,4),dtype=int) #empty方法 #一维数组 empty=numpy.empty(8) #二维 阅读全文
posted @ 2020-06-16 10:39 马蹄哒哒 阅读(272) 评论(2) 推荐(0)
摘要: import numpy #创建一位数组 a=numpy.array([1,2,3,4]) b=numpy.arange(4,10) #创建三维数组 c=numpy.random.randint(4,10,size=(3,3,4)) #ndarray属性 print(c.ndim) # 返回维度 # 阅读全文
posted @ 2020-06-16 09:49 马蹄哒哒 阅读(443) 评论(0) 推荐(0)
摘要: import numpy #生成随机5个0-1之间元素的以为数组 a=numpy.random.random(size=5) #创建随机二维数组 b=numpy.random.random(size=(3,4)) #创建随机三维数组(包括0,不包括1) c=numpy.random.random(s 阅读全文
posted @ 2020-06-16 09:31 马蹄哒哒 阅读(920) 评论(0) 推荐(0)
摘要: import numpy a=numpy.arange(1,10,2,dtype=float) #1指初值,2值终值,2指步长 b=numpy.sqrt(a) #对a数组里面的每个元素进行开平方 阅读全文
posted @ 2020-06-15 21:47 马蹄哒哒 阅读(474) 评论(0) 推荐(0)
摘要: import pandas import numpy def get_circle_area(l,h): r=numpy.sqrt(l**2+h**2)/2 return r**2*numpy.pi excel=pandas.read_excel('长方形.xlsx',index_col='id') 阅读全文
posted @ 2020-06-15 11:36 马蹄哒哒 阅读(650) 评论(0) 推荐(0)
上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 17 下一页