text_plain_output_1.png
"""
filenames = os.listdir('/kaggle/input/one-year-industrial-component-degradation/')
filenames = [i.strip(".csv") for i in filenames]
filenames.sort()
filenames.remove('oneyeardata')
parsed_filenames = []
for name in filenames:
    temp = name.split("T")
    month, date = temp[0].split("-")
    rhs = temp[1].split("_")
    hours, minutes, seconds = rhs[0][:2], rhs[0][2:4], rhs[0][4:]
    sample_no = rhs[1]
    mode = rhs[2][-1]
    # Now we have Month, Date, Hours, Minutes, Seconds, Sample Number, Mode 
    parsed_filenames.append([month, date, hours, minutes, seconds, sample_no, mode])
parsed_filenames = pd.DataFrame(parsed_filenames, columns=["Month", "Date", "Hours", "Minutes", "Seconds", "Sample Number", "Mode"])
for i in parsed_filenames.columns:
    parsed_filenames[i] = pd.to_numeric(parsed_filenames[i], errors='coerce')
path = '/kaggle/input/one-year-industrial-component-degradation/'
df = pd.DataFrame()
#f = pd.read_csv(path+filenames[0]+".csv")
#f = f.join(parsed_filenames[0:1], how='left')
#f = f.fillna(method='ffill')
#f
for ind, file in enumerate(filenames):
    file_content = pd.read_csv(path+file+".csv")
    file_content = file_content.join(parsed_filenames[ind:ind+1], how='left')
    file_content.fillna(method='ffill', inplace=True)
    if df.empty:
        df = file_content
        df.fillna(method='ffill', inplace=True)
    else:
        df = df.append(file_content, ignore_index=True)
        df.fillna(method='ffill', inplace=True)
for i in ['Mode', 'Sample Number', 'Seconds', 'Minutes', 'Hours', 'Date', 'Month']:
    df[i] = pd.to_numeric(df[i], downcast='integer')
df.info()
"""