import pandas
c=0
L=[]
file=open('F:\FCD\write\one.txt')
for line in file:
L.append(line.split(','))
data=DataFrame(L)
a=data[4]
b=data[5]
for i in a:
for u in b:
if u<'22.5':
if i<'114':
c=c+1
print(c)
指的是**一行中** a<114 并且 b<22.5,这一行同时满足这两个条件,显示这样数据的总数
请问下这个并列选择关系哪里写错了呢?我用and显示是一样的结果,但都是错误的
不知道怎么上传文本,随便截取了点数据下来,凑合着用下...
20110101,49,H ,粤B000H6 ,114.123581,22.576834,81,225,1,1
20110101,119,H ,粤B000H6 ,114.117783,22.576651,80,225,1,1
20110101,127,H ,粤B000H6 ,114.116081,22.576616,85,225,1,1
20110101,149,H ,粤B000H6 ,114.111366,22.576532,71,225,1,1
20110101,249,H ,粤B000H6 ,114.100235,22.570766,93,225,1,1
20110101,257,H ,粤B000H6 ,114.098618,22.569866,88,225,1,1
20110101,319,H ,粤B000H6 ,114.093948,22.568117,81,225,1,1
20110101,449,H ,粤B000H6 ,114.082802,22.560682,50,180,1,1
20110101,49,H ,粤B000H6 ,114.123581,22.576834,81,225,1,1
20110101,119,H ,粤B000H6 ,114.117783,22.576651,80,225,1,1
20110101,127,H ,粤B000H6 ,114.116081,22.576616,85,225,1,1
20110101,149,H ,粤B000H6 ,114.111366,22.576532,71,225,1,1
20110101,249,H ,粤B000H6 ,114.100235,22.570766,93,225,1,1
20110101,257,H ,粤B000H6 ,114.098618,22.569866,88,225,1,1
20110101,319,H ,粤B000H6 ,114.093948,22.568117,81,225,1,1
20110101,449,H ,粤B000H6 ,114.082802,22.560682,50,180,1,1
20110101,520,H ,粤B000H6 ,114.081032,22.558434,41,225,1,1
20110101,550,H ,粤B000H6 ,114.075684,22.558216,84,225,1,1
20110101,620,H ,粤B000H6 ,114.069733,22.558132,62,225,1,1
20110101,650,H ,粤B000H6 ,114.06823,22.558117,2,225,1,1