Learning pandas(Second Edition)
上QQ阅读APP看书,第一时间看更新

Creation using NumPy functions

It is a common practice to initialize the Series object's various NumPy functions. As an example, the following uses the NumPy np.arange function to create a sequence of integer values between 4 and 8:

The np.linspace() method is similar in functionality but allows us to specify the number of values to be created between (and including) the two specified values, and with a specified number of steps:

It is also common to generate a set of random numbers using np.random.normal(). The following generates five random numbers from a normal distribution: