>>> df one two three mouse 1 2 3 rabbit 4 5 6
>>> # select columns by name >>> df.filter(items=[‘one‘, ‘three‘]) one three mouse 1 3 rabbit 4 6
>>> # select columns by regular expression >>> df.filter(regex=‘e$‘, axis=1) one three mouse 1 3 rabbit 4 6
>>> # select rows containing ‘bbi‘ >>> df.filter(like=‘bbi‘, axis=0) one two three rabbit 4 5 6
时间: 2024-12-25 17:31:47