I calculate standard deviations in a for loop as such:
times = os.listdir(r'filepathway')
for file in times:
if file.endswith('.txt'):
...
...
z = df.iloc[1004:1255,:]
y = np.std(z)
print(y)
and I get a list of values. But when I print(y) in the next cell (outside of the loop), I don't get all the values. How can I basically extract the data from the loop into the next cell?
glob.glob()- you can specify pattern (path/*.txt) and it will return only txt files - no need to check the extension