替代方法:
In [13]: df.loc[:, df.columns.str.startswith('alp')]Out[13]: alp1 alp20 0.357564 0.1089071 0.341087 0.1980982 0.416215 0.6441663 0.814056 0.1210444 0.382681 0.1108295 0.130343 0.2198296 0.110049 0.6816187 0.949599 0.0896328 0.047945 0.8551169 0.561441 0.291182In [14]: df.loc[:, df.columns.str.contains('alp')]Out[14]: alp1 alp20 0.357564 0.1089071 0.341087 0.1980982 0.416215 0.6441663 0.814056 0.1210444 0.382681 0.1108295 0.130343 0.2198296 0.110049 0.6816187 0.949599 0.0896328 0.047945 0.8551169 0.561441 0.291182


