Last active
July 27, 2021 17:51
-
-
Save LosantGists/654069e0cab5f78f64e69ab7af8ae808 to your computer and use it in GitHub Desktop.
Automating Unit Tests Blog 7.23.21
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pandas as pd | |
| import os |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| BATTERY_DATA_FILE = "battery-state-reports-last-30-days.csv" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def get_directory(environment_name): | |
| try: | |
| directory = os.environ[environment_name] # i.e. Losant generated | |
| except: | |
| directory = os.getcwd() # local current directory | |
| return directory | |
| def get_input_directory(): | |
| return get_directory('INPUT_DIR') | |
| def load_data(): | |
| directory = get_input_directory() | |
| return pd.read_csv(os.path.join(directory, BATTERY_DATA_FILE)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| df = load_data() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment