运行:
0 100 1 78 2 59 3 63 dtype: int64
s1.values: [100 78 59 63]
s1.index: RangeIndex(start=0, stop=4, step=1)
赋值方法改写Series索引: No.1 100 No.2 78 No.3 59 No.4 63 dtype: int64
指定index关键字: Math 100 English 78 Literature 59 History 63 dtype: int64
通过索引访问数据元素: English 78 Literature 59 dtype: int64
Series由字典转换而来: Name zhang san Gender Male Age 19 Weight 76 dtype: object
Series索引由数组内容代替: ID NaN Name zhang san Gender Male Age 19 Grade NaN Height NaN Weight 76 dtype: object
检测缺失值: ID True Name False Gender False Age False Grade True Height True Weight False dtype: bool
Series的一个重要功能是自动对齐索引数据: Age 1919 Gender MaleMale Grade NaN Height NaN ID NaN Name zhang sanzhang san Weight 7676 dtype: object
Series对象本身及索引都具有name属性: Attribute ID NaN Name zhang san Gender Male Age 19 Grade NaN Height NaN Weight 76 Name: Student's profile, dtype: object
reindex重新索引: Attribute Name zhang san ID NaN Age 19 Gender Male Height NaN Weight 76 Grade NaN Name: Student's profile, dtype: object
新增索引: b NaN g zhang san a Male c 19 e NaN f NaN d 76 Name: Student's profile, dtype: object
reindex: a Male b NaN c 19 d 76 e NaN f NaN g zhang san h NaN Name: Student's profile, dtype: object
reindex并不会改变原索引的实际存储位置,而是返回一个重新索引的视图: b NaN g zhang san a Male c 19 e NaN f NaN d 76 Name: Student's profile, dtype: object
使用 reindex(index,method='***')的时候,原index必须是单调的: 0 NaN 1 NaN 2 zhang san 3 Male 4 Male 5 Male 6 19 7 19 8 NaN 9 NaN Name: Student's profile, dtype: object