python - predicting crime in san francisco, ValueError -
i ran error while trying project: valueerror: found arrays inconsistent numbers of samples: [878049 884262] . i when try run knn classifier @ bottom. i've been reading , know it's because x , y not same. shape x (878049, 2) , y (884262, ). how can fix error match? code: # drop features wont using # train.head() df = train.drop(['descript', 'resolution', 'address'], axis=1) df2 = test.drop(['address'], axis=1) # trying see times during day particular crime occurs, example # rapes occur more 12am-4am during weekend. # example below dow = { 'monday':0, 'tuesday':1, 'wednesday':2, 'thursday':3, 'friday':4, 'saturday':5, 'sunday':6 } df['dow'] = df.dayofweek.map(dow) # add column containing time of day df['hour'] = pd.to_datetime(df.dates).dt.hour # making feature column feature_cols = ['dow', 'hour'] x = df[feature_cols]...