Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import csv
- def read_production_data(filename: str) -> dict:
- """
- Open the file in the provided path, read in values and return them as a dictionary,
- where the key is the machine name and value is a list of integers for the production data for each shift.
- {
- 'Machine Name': [Run Time (minutes), Ideal Run Rate (pcs/min), Total Count (pcs), Good Count (pcs)]
- }
- :param filename: string file path for the CSV file to be read
- :return: dictionary with the production data per machine
- """
- try:
- with open(filename, "r") as input_file:
- data = input_file.read()
- if not data:
- raise ValueError('FileNotFoundError')
- except IOError as e:
- logging.exception(e)
- return {}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement