I'm new to Python, so I'm still learning. However, I'm trying to find the average, min and max from a text file that contains wind reading. I've got it to work, however, I need to convert NumPy to float, and I'm not sure how I do that.
import numpy as np
def main():
    text_file = open("tall_filtrert.txt", "r")
    total = 0.0
    count = 0
    print("Press enter to start")
    for line in text_file:
        run_time = float(line)
        count += 1
        total += run_time
    text_file.close()
    x = np.loadtxt("tall_filtrert.txt")
    print("There are", count, "")
    print('Average:', np.average(x))
    print('Max:', np.amax(x))
    print('Min:', np.amin(x))
main()
The code is slow, but there's like 800k readings. Any suggestions on how to improve the speed would help.
The text file goes something like this:
1.2056
1.3426
1.8632
etc.