fix(script): Fix bugs taking incorrect column by changing columns and sensor_end_map index number to take the loop of enumeration.

This commit is contained in:
nuluh
2024-09-03 12:08:53 +07:00
parent db2c5d3a4e
commit ff5578652f

View File

@@ -28,7 +28,7 @@ def create_damage_files(base_path, output_base):
file_path = os.path.join(base_path, f'zzzAD{file_index}.TXT')
df = pd.read_csv(file_path, sep='\t', skiprows=10) # Read with explicit column names
top_sensor = columns[damage-1]
top_sensor = columns[i-1]
print(top_sensor, type(top_sensor))
output_file_1 = os.path.join(output_base, f'DAMAGE_{damage}', f'D{damage:0{damage_pad}}_TEST{i:0{test_pad}}_01.csv')
print(f"Creating {output_file_1} from taking zzzAD{file_index}.TXT")
@@ -37,7 +37,7 @@ def create_damage_files(base_path, output_base):
df[['Time', top_sensor]].to_csv(output_file_1, index=False)
print(Fore.GREEN + "Done")
bottom_sensor = sensor_end_map[damage]
bottom_sensor = sensor_end_map[i]
output_file_2 = os.path.join(output_base, f'DAMAGE_{damage}', f'D{damage}_TEST{i}_02.csv')
print(f"Creating {output_file_2} from taking zzzAD{file_index}.TXT")
print("Taking datetime column on index 0...")