python remove or delete last column of a dataframe Posted on 2018-08-03 | In python description: python remove last column init data123456789101112import pandas data = pandas.DataFrame({ 'a': [1, 2, 3], 'b': [0.1, 0.2, 0.3], 'c': ['a', 'b', 'a'], 'd': [1, 2, 3] })# data# a b c d# 0 1 0.1 a 1# 1 2 0.2 b 2# 2 3 0.3 a 3 drop last column1data[data.columns[:-1]] output1234 a b c0 1 0.1 a1 2 0.2 b2 3 0.3 a Post author: killfun Post link: http://search4fan.github.io/post/python_remove_last_column.html Copyright Notice: All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.