pandas.Series函数用法

来源:互联网 发布:网络延时英文 编辑:程序博客网 时间:2024/05/16 10:35
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.2941b    0.2869c    1.7098d   -0.2126e    0.2696dtype: 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)
原创粉丝点击