import pandas as pd

file_path = './input/raw/postgres/total_electric_consumption_pg_id_40.csv'
df = pd.read_csv(file_path)

# Select only the necessary columns
df = df[['start_ts', 'sum', 'state']]

# Convert 'start_ts' column to datetime
df['start_ts'] = pd.to_datetime(df['start_ts'], unit='s')

# Save the data in the desired format to a text file
output_file_path = './output/total_electric_consumption_pg_id_40.txt'

with open(output_file_path, 'w') as f:
    for index, row in df.iterrows():
        f.write(f"    - start: \"{row['start_ts']}+00:00\"\n")
        f.write(f"      state: {row['state']}\n")
        f.write(f"      sum: {row['sum']}\n")

print(f"Data saved to: {output_file_path}")



file_path = './input/raw/postgres/total_electric_consumption_cost_pg_id_41.csv'
df = pd.read_csv(file_path)

# Select only the necessary columns
df = df[['start_ts', 'sum', 'state']]

# Convert 'start_ts' column to datetime
df['start_ts'] = pd.to_datetime(df['start_ts'], unit='s')

# Save the data in the desired format to a text file
output_file_path = './output/total_electric_consumption_cost_pg_id_41.txt'

with open(output_file_path, 'w') as f:
    for index, row in df.iterrows():
        f.write(f"    - start: \"{row['start_ts']}+00:00\"\n")
        f.write(f"      state: {row['state']}\n")
        f.write(f"      sum: {row['sum']}\n")

print(f"Data saved to: {output_file_path}")
