Cast header values to integers

This commit is contained in:
coolneng 2021-03-15 21:46:58 +01:00
parent f44f95f9f2
commit b50d549ce2
Signed by: coolneng
GPG Key ID: 9893DA236405AF57
1 changed files with 1 additions and 10 deletions

View File

@ -1,11 +1,10 @@
from sys import argv
from pandas import read_table 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 header[0], header[1] return int(header[0]), int(header[1])
def parse_file(filename): def parse_file(filename):
@ -14,11 +13,3 @@ def parse_file(filename):
filename, names=["source", "destination", "distance"], sep=" ", skiprows=[0] filename, names=["source", "destination", "distance"], sep=" ", skiprows=[0]
) )
return n, m, df return n, m, df
def main():
parse_file(argv[1])
if __name__ == "__main__":
main()