22 lines
666 B
Python
Executable File
22 lines
666 B
Python
Executable File
import pandas as pd
|
|
|
|
file_path = './input/modified/statistics-export-id-30.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/repaired_id_30.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}")
|