Hi i would like to process a data text file but i seem to be having alot of problems with the code. the text file is as follows
-7 -9.000000000000002 -3 622.0582425616101
-6.500000000000001 -9.000000000000002 -3 622.1498719223513
-6 -9.000000000000002 -3 622.2415012830924
-5.5 -9.000000000000002 -3 622.3331306438334
-5 -9.000000000000002 -3 622.3591843760928
-4.500000000000001 -9.000000000000002 -3 622.374656812196
-4 -9.000000000000002 -3 622.3901292482993
-3.5 -9.000000000000002 -3 622.4169574709064
however there are some lines where by there are Nan values such as
6.500000000000001 0 0.5 NaN
7 0 0.5 NaN
7.5 0 0.5 NaN
8 0 0.5 NaN
8.5 0 0.5 NaN
9.000000000000002 0 0.5 NaN
9.5 0 0.5 NaN
10 0 0.5 NaN
10.5 0 0.5 NaN
11 0 0.5 NaN
The text file is simply XYZ coordinates and the respective temperature. What i intend to do is to mainly focus on the last column which is the temperature and there are 2 different data types which is the 'value' and 'Nan'. I have tried many iterations of genfromtxt but i still keep getting many errors. what i wish to do with the last column is to essentially print the max temp, mean temp, gradient etc. Could someone please help me with my code as i am really new to programming and not sure how to go about it. Any help is greatly appreciated.
As of now this is the code i have
import numpy as np
data = np.genfromtxt('C:\\Users\\loges\\OneDrive\\Documents\\School\\ME4101A FYP\\temperature600.txt',
skip_header=0, skip_footer=1,dtype=None)
print("Max Temp :", data.max())
but my return results just show nan
Max Temp : nan
[Finished in 0.9s]
I really hope someone would be able to help me. It will be greatly appreciated.