📜  201903100110041 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:19.087000             🧑  作者: Mango

代码示例1
# R program reading a text file

# Read a text file using read.delim()
myData = read.delim("breast-cancer-wisconsin.data", header = FALSE)
print(myData)
VIEWDATA<-read.csv("breast-cancer-wisconsin.data", header = FALSE, sep = ",")
ENTERDATA=data.frame(VIEWDATA)
print(ENTERDATA)
#result =  ENTERDATA[c(2,0:4),c(3,0:4)]
result =  ENTERDATA[c(1,3),]#print the 1 and 3 record 
print(result)
if(ENTERDATA[,6]>2 && ENTERDATA[,6]<4 ){
  print(ENTERDATA)
}else{
  print("not founnd")
}
data_frame_mod <- ENTERDATA[which(ENTERDATA$V6 >4 & ENTERDATA$V6<8),]#filter based on condition
data_frame_mod <- ENTERDATA[which(ENTERDATA$V6 == 4 ),]#print only V4 has a 4 digit
using_subset=subset(ENTERDATA,ENTERDATA$V5==9 & ENTERDATA$V5!="?")
print("---------USING SUBSET METHOD-------------")
print(using_subset)
print("---------END USING SUBSET METHOD-------------")
print("---------USING wHICH METHOD-------------")
print(data_frame_mod)
print("---------END USING wHICH METHOD-------------")