Q:

Finding the complete row of specific number

We have a txt file which contains 3 columns and 100000 rows. We would like to find the row of specific number for example: 1.232422567 which is in first column but no idea about the number of its row.
for instance look at following example:
...
5.98735973963    4.3453     1.09877345
6.21376876       5.78789    2.11255
1.232422567      0.009044   9.886778893
0.1213445        0.938763   8.9978444
...

We want to call 1.232422567 and see its complete row
1.232422567      0.009044   9.886778893

to use in calculations for example in h=a+b where h= 0.009044 + 9.886778893.
Please note that: We do not know in what row that mentioned numbers is. We want search the file, find that number and its complete row and use the components of found row in calculation.

A:

This is one way. Output is a numpy array.
import pandas as pd
from io import StringIO

mystr = """5.98735973963    4.3453     1.09877345
6.21376876       5.78789    2.11255
1.232422567      0.009044   9.886778893
0.1213445        0.938763   8.9978444"""

# Replace below with pd.read_table('my_file.txt', header=None, sep='\s+')
df = pd.read_csv(StringIO(mystr), delim_whitespace=True, header=None)

res = df[df[0] == 1.232422567].values[0]

# array([  1.23242257e+00,   9.04400000e-03,   9.88677889e+00])

Then to apply h = a + b, you can use numpy conveniently:
h = np.sum(res[1:])

Or if you want a list:
res = df[df[0] == 1.232422567].values[0].tolist()

# [1.232422567, 0.009044, 9.886778892999999]

Conversion to floats is handled by pandas.

