利用python进行数据分析

常用工具

  • numpy
  • pandas
  • matplotlib
  • scikit-learn

常见问题

1
2
3
4
5
np.array(list)
np.asarray(list)
np.asanyarray(list)

ndarray.tolist()
  • using scikit-learn and numpy

    ValueError: Found input variables with inconsistent numbers of samples: [xx, xxx]

1
2
3
4
5
6
7
8
9
10
11
12

x_train = np.array(x_train)
# if need
x_train = x_train.reshape(32383,1)

y_train = np.array(y_train)
#if need
y_train = y_train.reshape(32383,1)

svr.fit(x_train, y_train)
# if DataConvertWarning, then ravel back to shape(1, xx)
svr.fit(np.ravel(x_train), np.ravel(y_train)