1.Series介绍
Pandas模块的数据结构主要有两种:1.Series 2.DataFrame
Series 是一维数组,基于Numpy的ndarray 结构
2.Series创建
1. pd.Series([list],index=[list])
参数为list ,index为可选参数,若不填写则默认为index从0开始
2. pd.Series(np.arange())
3. pd.Series({dict})
4. 可以通过DataFrame中某一行或者某一列创建序列
3. Series基本属性
Series.values:Return Series as ndarray or ndarray-like depending on the dtype
Series.index:The index (axis labels) of the Series.
Series.name:Return name of the Series.
4. 索引
Series.loc:Access a group of rows and columns by label(s) or a boolean array.
Series.iloc:Purely integer-location based indexing for selection by position.
5 计算、描述性统计
Series.value_counts:Return a Series containing counts of unique values.
6 排序
1. Series.sort_values
Series.sort_values(self, axis=0,ascending=True,inplace=False,kind='quicksort',na_position='last')
2. Series.rank
Series.rank(self, axis=0, method='average', numeric_only=None, na_option='keep', ascending=True, pct=False)[source]
版权声明:本文为CSDN博主「流年里不舍的执着」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/weixin_43868107/article/details/102631717