Python ProgrammingPython Programming

How to create series using NumPy functions in Pandas?

Create series using NumPy functions:

import pandas as pd
import numpy as np

ser1 = pd.Series(np.linspace(1, 10, 5))
print(ser1)

ser2 = pd.Series(np.random.normal(size=5))
print(ser2)


C:\python\pandas examples>python example1a.py
0     1.00
1     3.25
2     5.50
3     7.75
4    10.00
dtype: float64
0   -1.694452
1   -1.570006
2    1.713794
3    0.338292
4    0.803511
dtype: float64
 
C:\python\pandas examples>