После прочтения pandas.dataframe.drop ,
столбец может быть удален по капле или del
#+begin_src ipython :session alinbx :results output
import pandas as pd
import numpy as np
df = pd.DataFrame(np.arange(12).reshape(3, 4),
columns=['A', 'B', 'C', 'D'])
print(df, '\n'+'--'*50)
# Drop columns
print(df.drop(['B', 'C'], axis=1), '\n'+'--'*50)
del df['A']
# Drop a row by index
print(df.drop([0, 1]), '\n'+'--'*50)
print(df.drop([0, 1], axis=0))
#+end_src
#+RESULTS:
#+begin_example
A B C D
0 0 1 2 3
1 4 5 6 7
2 8 9 10 11
----------------------------------------------------------------------------------------------------
A D
0 0 3
1 4 7
2 8 11
----------------------------------------------------------------------------------------------------
B C D
2 9 10 11
----------------------------------------------------------------------------------------------------
B C D
2 9 10 11
#+end_example
При попытке удалить rwo с помощью del,сообщать об ошибке
#+begin_src ipython :session alinbx :results output
del df.iloc[0, :]
#+end_src
AttributeErrorTraceback (most recent call last)
<ipython-input-20-4fdbabf9cb4f> in <module>
----> 1 del df.iloc[0, :]
AttributeError: __delitem__
Как можно удалить строку с 'del`