Attempting to drop a column from a
DataFrame in Pandas.
DataFrame created from a text file.
import pandas as pd df = pd.read_csv('sample.txt') df.drop(['a'], 1, inplace=True)
However, this generates the following error:
ValueError: labels ['a'] not contained in axis
Here is a copy of the
sample.txt file :
a,b,c,d,e 1,2,3,4,5 2,3,4,5,6 3,4,5,6,7 4,5,6,7,8
Thanks in advance.