>>> type(range)
<class 'type'>
输出就像:
"User-ID";"ISBN";"Book-Rating"
"276725";"034545104X";"0"
"276726";"0155061224";"5"
"276727";"0446520802";"0"
答案 0 :(得分:0)
用R中的以下脚本解决它。
库(readr)
BX_Book_Ratings&lt; - read_delim(&#34; C:/ Users / panch / Desktop / Lambton / Term_2_Fall_2017 / 2017F-T2 BDM 2013 - 数据收集方法/ project_03 / dataset / BX-Book-Ratings.csv&#34; ,&#34;;&#34;,escape_double = FALSE,trim_ws = TRUE)
查看(BX_Book_Ratings)
库(reshape2)
SAMPLE_DATA&LT; -head(BX_Book_Ratings,30)
d&lt; - dcast(sample_data,User_ID~ISBN,value.var =&#34; Book_Rating&#34;)
d [is.na(d)]&lt; - 0
库(gridExtra)
grid.table(d)
write.csv(d,&#34; C:/ Users / panch / Desktop / Lambton / Term_2_Fall_2017 / 2017F-T2 BDM 2013 - 数据收集方法/ project_03 / dataset / output.csv&#34;)