pandas.Series函数用法

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)
posted @ 2017-06-04 13:40  2021年的顺遂平安君  阅读(1039)  评论(0编辑  收藏  举报