Created
June 8, 2023 10:59
-
-
Save anderzzz/dcb747cbf768373f22c438edb791f3b4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
# Read the file and extract relevant lines based on the '#' symbol | |
with open('your_file_path') as file: | |
lines = file.readlines() | |
start_row = None | |
for i, line in enumerate(lines): | |
if line.startswith('# Data lines:'): | |
start_row = i + 2 # Skip two lines after the metadata line | |
break | |
# Read the file again, skipping the metadata lines dynamically | |
data = pd.read_csv('your_file_path', delimiter=';', skiprows=start_row) | |
# Preview the extracted data | |
print(data.head()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment