Filenotfounderror: [errno 2] no such file or directory: 'nsr001.ecg'
You just need to add the root directory in front of the filename so that the full filepath is correct. For this you can use os.path.join:
import os
import numpy as np

for root, dirs, files in os.walk('normal-sinus-rhythm-rr-interval-database-1.0.0'):
    for file in files:
        if file.endswith(&quot;.ecg&quot;):
            print(os.path.join(root, file))
            averageArray = np.fromfile(os.path.join(root, file), dtype=float)