class pandas.Series(data=None, index=None, dtype=None, name=None, copy=False, fastpath=False)

e.g.,

s = pd.Series(data = np.random.randn(5), index=['a', 'b', 'c', 'd', 'e']))

会生成:

a    0.2941
b 0.2869
c 1.7098
d -0.2126
e 0.2696
dtype: float64

也可以直接写:

s = pd.Series(np.random.randn(5), index=['a', 'b', 'c', 'd', 'e'])

加上dtype的话:

s = pd.Series(data = np.random.randn(5), index=['a', 'b', 'c', 'd', 'e'],dtype = np.float16)
05-12 17:45