I am still a beginner in Python. I am reading a tab delimited text file generated from a software to filter out a set of values. But the values generated are all in a format similar to IEEE floating point format. (for example : 1.5656565656E+02).
My tab delimited file is something like this(actually it is 250 columns. roughly it is like this)
Time [s] Offset_Angle observability_Analysis
0.00E+00 0.89040261167028E+00 0.00000000000000E+00
4.32E+02 0.21319658757004E+00 0.00000000000000E+00
8.64E+02 0.26803683992125E+00 0.00000000000000E+00
1.30E+03 2.67379011780784E+02 1.00000000000000E+00
1.73E+03 2.89704767087971E+02 1.00000000000000E+00
2.16E+03 2.93302157473406E+02 1.00000000000000E+00
Th aim is to filter those Offset_Angle values that have their observability_Analysis as 1.0000000000000E+00 But as of now I am trying to print the row number which has observability_Analysis as 1.0000000000000E+00.
The code i tried is like this
with open('E:\\trialpy\\textfile.txt') as f:
reader = csv.reader(f, delimiter="\t")
d = list(reader)
for ind in range(len(d)):
if d[ind][2] == "1.00000000000000E+00":
print ind
The first set of code works correctly. The print ind is just empty. It doesnt give any values. Please help me with this. And sorry if the question is very silly. Stuck at this place for sometime now. Is there a way to solve this or I have to switch to Pandas
Thanks.
4\n5\n6\n). Maybe you mixed up the index column in your 250-column file? Tryprinting the value ofd[ind][2]before theifand check what actually is there.