Я не могу удалить столбец из csv
, используя панд.Я пытался удалить его разными способами, используя другую ось, функцию del, но она не работает.Кто-нибудь знает почему?
Вот мой pandas.head ()
age;"job";"marital";"education";"default";"balance";"housing";"loan";"contact";"day";"month";"duration";"campaign";"pdays";"previous";"poutcome";"y"
0 58;"management";"married";"tertiary";"no";2143...<br>
1 44;"technician";"single";"secondary";"no";29;"...<br>
2 33;"entrepreneur";"married";"secondary";"no";2...<br>
3 47;"blue-collar";"married";"unknown";"no";1506...<br>
4 33;"unknown";"single";"unknown";"no";1;"no";"n...
Вот мой код:
import pandas
df = pd.read_csv('bank-full.csv')
print(df.head())
df = df.drop(['day', 'poutcome'], axis=1)
Вот ошибка:
Traceback (most recent call last):
File "/home/administrator/PycharmProjects/BankMarketinData/main.py", line 21, in
main()
File "/home/administrator/PycharmProjects/BankMarketinData/main.py", line 19, in main
df = df.drop(['day', 'poutcome'], axis=1)
File "/home/administrator/anaconda3/lib/python3.6/site-packages/pandas/core/frame.py", line 3697, in drop
errors=errors)
File "/home/administrator/anaconda3/lib/python3.6/site-packages/pandas/core/generic.py", line 3111, in drop
obj = obj._drop_axis(labels, axis, level=level, errors=errors)
File "/home/administrator/anaconda3/lib/python3.6/site-packages/pandas/core/generic.py", line 3143, in _drop_axis
new_axis = axis.drop(labels, errors=errors)
File "/home/administrator/anaconda3/lib/python3.6/site-packages/pandas/core/indexes/base.py", line 4404, in drop
'{} not found in axis'.format(labels[mask]))
KeyError: "['day' 'poutcome'] not found in axis"