Spaces:
Sleeping
Sleeping
import pandas as pd | |
import streamlit as st | |
import csv | |
import io | |
def preprocess_csv(input_bytes): | |
text = input_bytes.decode() # Decode bytes to text | |
output = io.StringIO() | |
writer = csv.writer(output) | |
for row in csv.reader(io.StringIO(text)): # Read text as csv | |
if len(row) > 5: | |
row = row[0:5] + [','.join(row[5:])] # Combine extra fields into one | |
writer.writerow(row) | |
output.seek(0) # go to the start of the StringIO object | |
return output | |
def load_data(file): | |
column_names = [ | |
'Functional area', | |
'Scenario name', | |
'Start datetime', | |
'End datetime', | |
'Status', | |
'Error message' | |
] | |
data = pd.read_csv(file, header=None, names=column_names) | |
return data | |
def fill_missing_data(data, column_index, value): | |
data.iloc[:, column_index] = data.iloc[:, column_index].fillna(value) | |
return data |