Noticed anamolies in the data so manually corrected with an additional python script.
This commit is contained in:
21
data_repair.py
Executable file
21
data_repair.py
Executable file
@@ -0,0 +1,21 @@
|
||||
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}")
|
||||
7128
input/modified/statistics-export-id-30.csv
Normal file
7128
input/modified/statistics-export-id-30.csv
Normal file
File diff suppressed because it is too large
Load Diff
7128
input/modified/statistics-export-id-31.csv
Normal file
7128
input/modified/statistics-export-id-31.csv
Normal file
File diff suppressed because it is too large
Load Diff
7120
input/modified/statistics-export.csv
Normal file
7120
input/modified/statistics-export.csv
Normal file
File diff suppressed because it is too large
Load Diff
21381
output/repaired_id_30.txt
Normal file
21381
output/repaired_id_30.txt
Normal file
File diff suppressed because it is too large
Load Diff
21381
output/repaired_id_31.txt
Normal file
21381
output/repaired_id_31.txt
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user