R dataframe中的一列中有“,”(逗号),因此,当我尝试将其转换为netezza数据框时,它抛出以下错误:将R data.frame强制转换为nz.data.frame的错误
Error in nzQuery(sqlCommandUpload) : HY008 51 Operation canceled 01000 1 Unable to write nzlog/bad files 01000 1 Unable to write nzlog/bad files HY000 46 ERROR: External Table : count of bad input rows reached maxerrors limit
如何在不对数据进行任何更改的情况下实现此目的?
library(nzr)
library(forecast)
library (reshape2)
library(doBy)
nzDisconnect()
nzConnectDSN('DSNInfo', force=FALSE , verbose=TRUE)
#read file
test2<-read.csv("test_df.csv", stringsAsFactors = F)
# convert to nz dataframe, no error
#nzdf.test2<-as.nz.data.frame(test2)
nzdf.d<-as.nz.data.frame(d)
# copy
#test<-test2
testd<-d
#replace one of the values containing a ","
#test$Category[1]<-"a,b"
testd$Category[1]<-"Bed, Bath & Towels"
# converting to nz gives error
#nzdf.test<-as.nz.data.frame(test)
nzdf.testd<-as.nz.data.frame(testd)
#remove ","
test$Category <- gsub(",","",test$Category)
# converting to nz dataframe, gives no error
nzdf.test<-as.nz.data.frame(test)
显示您的R代码,并告诉我们您正在使用哪些库。 – ScottMcG
@ScottMcG编辑了需要的细节问题 –