import os
import pandas as pd

# Path folder yang berisi data txt
label = "Bitter"
path = f"MyData/{label}"

# Simpan Data
myData = []
for dir, folder, files in os.walk(path):
    # Menggabungkan setiap data dalam folder tertentu
    for file in files:
        df_temp = pd.read_csv(f"{dir}/{file}", delimiter=';')
        data_values = list(df_temp.columns)
        myData.append(data_values)

# 18 Kolom
columns = ['410nm', '435nm', '460nm','485nm',
           '510nm', '535nm', '560nm', '585nm',
           '610nm', '645nm', '680nm', '705nm',
           '730nm', '760nm', '810nm', '860nm',
           '900nm', '940nm']

# Simpan ke dalam csv
df = pd.DataFrame(myData, columns=columns)
df.head()
df.to_csv(f"Final/{label}.csv", index=False)




