Traffic safety problem has been highly concerned by people all over the world. Predicting potential traffic accidents can help to improve traffic facilities or emergency system, and give people alerts to potential dangers. As a random event, the occurrence of traffic accidents has obvious seasonal and spatial characteristics. The accuracy of traffic accident prediction can be improved by combining the seasonal and spatial characteristics of traffic accidents. In the study, we selected Philadelphia car accident databases during 2008 to 2012 on Opendata Philly. On the basis of data grouping preprocessing, we tested three machine learning algorithms to predict the count of accidents. The results indicate that LSTM(Long Short-Term Memory) algorithm has the best performance relatively, and XGBoost (eXtreme Gradient Boosting) model does not perform better than ARIMA(Autoregressive Integrated Moving Average model. In addition, we identify the important features of traffic accidents in Philadelphia city: the count of accidents on the same road segment, traffic control device, automobile type, roadway surface condition, weather condition. The datasets in this study has obvious spatial characteristics also, and the occurrence of accidents is closely related to the accident segment.