Load CSV

np.loadtxt then fit.

Download signal.csv or create it. np.loadtxt then curve_fit.

Goal

Print fitted a, b from signal.csv.

from pathlib import Path
Path('signal.csv').write_text('\n'.join(f'{i/10:.1f},{2.5*(i/10)+4:.2f}' for i in range(11)) + '\n', encoding='utf-8')
print('wrote')
from scipy.optimize import curve_fit
arr = np.loadtxt('signal.csv', delimiter=',')
x, y = arr[:, 0], arr[:, 1]
popt, _ = curve_fit(lambda x, a, b: a * x + b, x, y)
print(popt.round(3))
temps = np.loadtxt('temps.txt') if False else np.array([24.1, 26.0, 23.5, 22.0])
print(temps.mean().round(2))
print(np.loadtxt('signal.csv', delimiter=',').shape)