I have a txt file seperated by tab of the following form: { 10/16/2025 10:40 AM some_comment 23.806 10.5 ....(some more values here) Xu 5.62 61.04 65.49 Xv 4.32 63.21 62.47 Xx 4.26 62.24 64.28 Xy 3.85 68.66 67.21 Xz 1.78 63.93 64.39 10/16/2025 10:41 AM some_comment 23.806 10.5 ....(some more values here) Xu 4.62 51.04 15.49 Xv 3.32 93.54 62.33 Xx 6.26 32.55 34.49 Xy 2.85 68.67 57.56 Xz 9.78 33.04 94.73 ... } One data chunk has 6 unique columns and they repeat after that. The first column starts with Date, time, comment (if any), and some futher numerical values (25 in total). None of them have proper name. I'd like to give them certain name based on their position. The 2nd to 6th column starts with blank, "some column name" like (Xu, Xv,..), and values I'd like to have final data should look like a table with columns below. Datetime, Xu, Xo, ...(these are the 2nd to 6th column),"comments", "Val_A", "Val_B","another_name",... I tried with the code below: def parse_custom_txt(filepath): data = [] with open(filepath, 'r') as file: lines = [line.strip() for line in file if line.strip()] i = 0 while i < len(lines): if "/" in lines: parts = lines.split('\t') dt = f"{parts[0]} {parts[1]}" comment = parts[2] main_vals = [v for v in parts[3:] if v.strip()] i += 1 sensors = {} for _ in range(5): sensor_line = lines.split('\t') sensors[sensor_line[0].strip()] = [float(v) for v in sensor_line[1:] if v.strip()] i += 1 row = [dt] + [sensors.get(k, []) for k in ['Xu', 'Xv', 'Xx', 'Xy', 'Xz']] + [comment] + main_vals data.append(row) else: i += 1 return pd.DataFrame(data) But this results in column name getting the values instead. How do I fix this? Continue reading...