我正在尝试通过SVM实现数字识别。这是链接:https://www.kaggle.com/sanesanyo/digit-recognition-using-svm-with-98-accuracy
import pandas as pd
import numpy as np
from scipy.ndimage import interpolation
# Getting the features from the train data frame by dropping label from
the data frame
df_X=df_train.drop("label",axis=1)
# Deskewing the data
df_X=df_X.apply(lambda x:
deskew(x.values.reshape(28,28)).flatten(),axis=1)
# Scaling the data
X=df_X.apply(scale)
# Dropping all the columns with only NaN values
X=X.dropna(axis=1,how='all')
# Saving the label data as the target variable
y=df_train["label"]
以下是输出:
ValueError Traceback (most recent call last)
<ipython-input-19-d9491a48f364> in <module>
6 X=df_X.apply(scale)
7 # Dropping all the columns with only NaN values
----> 8 X=X.dropna(axis=1,how='all')
9 # Saving the label data as the target variable
10 y=df_train["label"]
~\Anaconda3\lib\site-packages\pandas\core\series.py in dropna(self, axis, inplace, **kwargs)
4296 'argument "{0}"'.format(list(kwargs.keys())[0]))
4297 # Validate the axis parameter
-> 4298 self._get_axis_number(axis or 0)
4299
4300 if self._can_hold_na:
~\Anaconda3\lib\site-packages\pandas\core\generic.py in _get_axis_number(cls, axis)
359 pass
360 raise ValueError('No axis named {0} for object type {1}'
--> 361 .format(axis, type(cls)))
362
363 @classmethod
ValueError: No axis named 1 for object type <class 'type'>