摘要:
from pandas import Series, DataFrame, Index import numpy as np # 层次化索引 对数据重塑和分组操作很有用 data = Series(np.random.randn(10), index=[['a', 'a', 'a', 'b', 'b', 'b', 'c', 'c', 'd', 'd'], ... 阅读全文
摘要:
from pandas import Series, DataFrame, Index import numpy as np from numpy import nan as NA obj = Series(range(3), index=['a', 'b', 'c']) print(obj) index = obj.index print(index) print(index[1:]) # ... 阅读全文
摘要:
import pandas as pd import numpy as np # 自动创建索引 obj = pd.Series([4, 7, -5, 2]) print(obj, type(obj)) print(obj.values) print(obj.index) # 自己创建索引 obj2 = pd.Series([2, 5, -32, 3], index=['a', 'b', 'c'... 阅读全文