pandas中Series有哪些常见属性

这篇文章将为大家详细讲解有关pandas中Series有哪些常见属性,文章内容质量较高,因此小编分享给大家做个参考,希望大家阅读完这篇文章后对相关知识有一定的了解。

1、Values:获取数组

#values
print(arrySer.values)
 
[output]
Index(['a', 'b', 'c', 'd', 'e'],dtype='object')
[10 11 12 13 14]

2、index :获取索引

print('Series', country_col.index)
Series RangeIndex(start=0, stop=202, step=1)

3、name :values的name

print('Series', country_col.name)
Series Country

4、index.name  : 索引的name

补充:

 * ndim          返回Series的维数;
 * shape         返回Series的形状;
 * dtype         返回Series中元素的数据类型;
 * size          返回Series中元素的个数;
 * itemsize      返回Series中每一个元素占用空间的大小,
                 以字节为单位;
 * nbytes        返回Series中所有元素占用空间的大小,
                 以字节为单位;
 * T             返回Series的转置结果;

关于pandas中Series有哪些常见属性就分享到这里了,希望以上内容可以对大家有一定的帮助,可以学到更多知识。如果觉得文章不错,可以把它分享出去让更多的人看到。