ix方法较为复杂,新版本pandas 使用 loc函数将它优化 import pandas as pd import numpy as np exmple1 = pd.Series(range(10)) print(exmple1.loc[:3])