I wrote the following loop:
pdFrame = []
for dir, subdir, files in os.walk(path):
for file in files:
if glob2.fnmatch.fnmatch(file, '*.gz'):
columns = ['Gene_ID', file[:file.find('.')]]
df = pd.read_csv(os.path.join(dir, file), compression='gzip', sep='', names=columns, header=None)
df = df.set_index('Gene_ID')
for name, value in df.items():
pdFrame.append(value)
data_frame = pd.concat(pdFrame, axis=1, ignore_index=False)
data_frame.to_csv('final_samples.csv', header=True)
However, I keep getting the following error:
"NameError: name 'data_frame' is not defined"
Based on the error, there is some value that must be 'False' , which is why the values aren't posting to the variable, but I don't understand why.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…