Adapt preprocessing module to the new lab

This commit is contained in:
coolneng 2021-05-03 18:00:18 +02:00
parent 103a5bdfb0
commit c5bccf2f29
Signed by: coolneng
GPG Key ID: 9893DA236405AF57
1 changed files with 3 additions and 2 deletions

View File

@ -4,11 +4,12 @@ from pandas import read_table
def read_header(filename): def read_header(filename):
with open(filename, "r") as f: with open(filename, "r") as f:
header = f.readline().split() header = f.readline().split()
return int(header[0]), int(header[1]) return int(header[0])
def parse_file(filename): def parse_file(filename):
n, m = read_header(filename) n = read_header(filename)
m = 50
df = read_table( df = read_table(
filename, names=["source", "destination", "distance"], sep=" ", skiprows=[0] filename, names=["source", "destination", "distance"], sep=" ", skiprows=[0]
) )