[PYTHON] slice

':' Slice notation is possible using':'. If a is an array, a [i: j: k] means a partial array of k-1 skipped from the i-th element to the j-1st element. i, j, k are optional, the default value of i is 0, the default value of j is np.alen (a), that is, the length along the 0 axis of a, and the default value of k is 1.

[:4]

Extract column names from 0 to 3 with Pandas features = df.columns[:4]

Recommended Posts

slice
Python slice
python string slice
Python slice basics
[python] Array slice operation