The Numpy

range()

class range(object)
 |  range(stop) -> range object
 |  range(start, stop[, step]) -> range object
 |  
 |  Return an object that produces a sequence of integers from start (inclusive)
 |  to stop (exclusive) by step.  range(i, j) produces i, i+1, i+2, ..., j-1.
 |  start defaults to 0, and stop is omitted!  range(4) produces 0, 1, 2, 3.
 |  These are exactly the valid indices for a list of 4 elements.
 |  When step is given, it specifies the increment (or decrement).
 |  ----------------------------------------------------------------------
 |  Static methods defined here:
 |  
 |  __new__(*args, **kwargs) from builtins.type
 |      Create and return a new object.  See help(type) for accurate signature.
 |  
 |  ----------------------------------------------------------------------
 |  Data descriptors defined here:
 |  
 |  start
 |  
 |  step
 |  
 |  stop

range(start,stop[,step])

  • Arange() is a function in the Numpy library.Its return value is an array object,often used in loops.
  • start represents the staring value(positive integer/negative integer),stop means the ending value(positive integer/negative integer),and step indicates the step value(the default is 1,positive integer/negative)

    range(stop)

  • When the output parameter is only stop,the initial value is 0.
list(range(6))  

[0,1,2,3,4,5]

What is *args and **kwargs?
*args,**kwargs

numpy.reshape

if name=='main'

A friend's eyes you're a little Ming (__name__ = = 'Xiao Ming), you think you are yourself (__name__ = ='__main__'), you have a good programming, and a friend calls you to help him write a program (import Xiao Ming, when you are in your friend's eyes: __name__ = = 'Xiao Ming "), but you will also open a XX website at night and do some of your own things (direct operation Xiaoming.py,.py name__ = ='__main__'

name__ = ='main'

The Unknown Word

The First ColumnThe Second Column
omittedv.省略,遗漏
valid有效的
indices['indisi:z]指数(index的复数)
histogram直方图['histe gram]
a pair of一对
bins大储藏箱
tuple[tapl]元组,数组
propagating反向传播['pra:pegeit]
an error to be raised引发错误
raveling拆开[ravling]
reshape重构
attribute属性,标志

三、Histogram

The Numpy histogram function applied to an array returns a pair of vectors:the histogram of the array and the vector of bins.Beware:matloblib also has a function to build histogram.(called hist,as in Matlab)that differs from the one in NumPy.The main difference is that pylab.hist plots the histogram automatically,while numpy.histogram only generate the data.

import numpy as np
import matplotlib.pyplot as plt
# Build a vector of 10000 normal deviates with variance 0.5^2 and mean 2
mu, sigma = 2, 0.5
v = np.random.normal(mu,sigma,10000)
# Plot a normalized histogram with 50 bins
plt.hist(v, bins=50, density=1)       # matplotlib version (plot)
plt.show()

The result of first section:

转载于:https://www.cnblogs.com/hugeng007/p/9368244.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值