Download pool/shard004/Python/0035951_code.py from Variable-role/sajaniemi_variable_dataset_large: direct link, hf CLI and curl.
- Browser
- Download file 623 Bytes
-
https://huggingface.co/datasets/Variable-role/sajaniemi_variable_dataset_large/resolve/main/pool/shard004/Python/0035951_code.py
- Command line
-
hf download hf://datasets/Variable-role/sajaniemi_variable_dataset_large/pool/shard004/Python/0035951_code.py
-
curl -L -o 0035951_code.py https://huggingface.co/datasets/Variable-role/sajaniemi_variable_dataset_large/resolve/main/pool/shard004/Python/0035951_code.py
623 Bytes
| #!/usr/bin/env python | |
| # encoding: utf-8 | |
| import numpy as np | |
| import os | |
| from optparse import OptionParser | |
| if __name__ == '__main__': | |
| # Parse options command line | |
| parser = OptionParser() | |
| parser.add_option("-f", "--filename", dest="filename", metavar="FILE") | |
| # Process options and args | |
| (options, args) = parser.parse_args() | |
| if options.filename is None: | |
| parser.error("required -f [filename] arg.") | |
| data = np.zeros(shape=(30,8)) | |
| lines = open(options.filename, 'r').readlines() | |
| for line in lines: | |
| vertex, sensors = line.strip().split(',') | |
| for sensor in sensors.split('_'): | |
| data[vertex, int(sensor) - 1] = 1 | |