diff options
author | Étienne Simon <esimon@esimon.eu> | 2015-05-18 18:57:08 -0400 |
---|---|---|
committer | Étienne Simon <esimon@esimon.eu> | 2015-05-18 18:57:08 -0400 |
commit | 4f68132cc9c62860bd3368e559e430961c872636 (patch) | |
tree | 275554a1abcd419d0c477b639dcbd50189d3245d /data | |
parent | 6d946f29f7548c75e97f30c4356dbac200ee6cce (diff) | |
download | taxi-4f68132cc9c62860bd3368e559e430961c872636.tar.gz taxi-4f68132cc9c62860bd3368e559e430961c872636.zip |
Use os.path.join and close files
Diffstat (limited to 'data')
-rw-r--r-- | data/rfc4180.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/data/rfc4180.py b/data/rfc4180.py index b6fe5b1..db86830 100644 --- a/data/rfc4180.py +++ b/data/rfc4180.py @@ -1,6 +1,7 @@ import ast import csv import numpy +import os from fuel.datasets import Dataset from fuel.streams import DataStream @@ -90,15 +91,16 @@ taxi_columns_valid = taxi_columns + [ ("time", lambda l: int(l[11])), ] -train_file="%s/train.csv" % data.path -valid_file="%s/valid2-cut.csv" % data.path -test_file="%s/test.csv" % data.path +train_file = os.path.join(data.path, 'train.csv') +valid_file = os.path.join(data.path, 'valid2-cut.csv') +test_file = os.path.join(data.path, 'test.csv') train_data=TaxiData(train_file, taxi_columns, has_header=True) valid_data = TaxiData(valid_file, taxi_columns_valid) test_data = TaxiData(test_file, taxi_columns, has_header=True) -valid_trips = [l for l in open("%s/valid2-cut-ids.txt" % data.path)] +with open(os.path.join(data.path, 'valid2-cut-ids.txt')) as f: + valid_trips = [l for l in f] def train_it(): return DataIterator(DataStream(train_data)) |