data.columns[:-1]
时间: 2023-12-24 21:03:09 浏览: 108
数据结构资料--1
This code returns all the column names of a Pandas DataFrame except for the last column.
For example, if we have a DataFrame 'data' with columns 'A', 'B', 'C', and 'D', then the code data.columns[:-1] will return ['A', 'B', 'C'].
阅读全文