0

Dataset

f = pd.DataFrame(np.arange(16).reshape(4, 4),columns=['A', 'B', 'C', 'D'])

I tried the below way, but the column is not getting removed. Please help me!

f.drop([3])
f.head()

I even tried iloc method, but no improvements were there. Please help me!

Samar Pratap Singh
  • 471
  • 1
  • 10
  • 29
  • Your title says drop row, then in your question you are talking about column, that's confusing – Erfan Aug 09 '20 at 17:32

1 Answers1

1

You need to assign it or adding inplace

f = f.drop([3]) # f.drop([3],inplace=True)

For column drop

f = f.drop(f.columns[3],axis=1)
Out[184]: 
    A   B   C
0   0   1   2
1   4   5   6
2   8   9  10
3  12  13  14
BENY
  • 317,841
  • 20
  • 164
  • 234