Skip to content
Snippets Groups Projects
Commit 67ba865a authored by Clara Betancourt's avatar Clara Betancourt
Browse files

eliminate logging

parent 1d025c0e
Branches
No related tags found
No related merge requests found
......@@ -3,7 +3,7 @@ Class and routine for AQbench preanalysis and visualization.
"""
# general
import logging
# import logging
# import pdb
# data science
......@@ -88,7 +88,7 @@ class PreVis:
elif this_res['data_type'] == 'str':
fill = str(this_res['fill_value'])
else:
logging.warning('Forgotten datatypes?')
pass # logging.warning('Forgotten datatypes?')
av = round(len(this_data[this_data != fill]) / compl * 100)
mis = 100 - av
this_data = this_data[this_data != fill]
......@@ -189,7 +189,7 @@ class PreVis:
self.plot_dir+column_name.replace('.', 'p')+'_'+plot_naming,
dpi=175
)
logging.info(column_name + ' plot saved')
# logging.info(column_name + ' plot saved')
class PreMis:
......@@ -287,7 +287,7 @@ def main_previs():
previs.vis(col)
plt.close()
except Exception as exc:
logging.warning(col + ' no plot produced')
# logging.warning(col + ' no plot produced')
print(exc)
......@@ -319,12 +319,12 @@ if __name__ == '__main__':
"""
# logging
log_file = __file__.replace('py', 'log')
# log_file = __file__.replace('py', 'log')
logging.basicConfig(
level=logging.INFO,
format="%(asctime)s [%(levelname)s] %(message)s",
handlers=[logging.FileHandler(log_dir+log_file),
logging.StreamHandler()])
# logging.basicConfig(
# level=logging.INFO,
# format="%(asctime)s [%(levelname)s] %(message)s",
# handlers=[logging.FileHandler(log_dir+log_file),
# logging.StreamHandler()])
main_previs()
main_premis()
......@@ -3,7 +3,7 @@ import pandas as pd
from sklearn import preprocessing
import math
import logging
# import logging
from settings import *
from dataset_datasplit import DataSplit
......@@ -73,7 +73,7 @@ class Data:
# Logging
logging.info(f'{self.data_yx.shape[0]} rows were read in.')
# logging.info(f'{self.data_yx.shape[0]} rows were read in.')
def delete_rows(self):
"""
......@@ -93,7 +93,7 @@ class Data:
# Logging
logging.info(f'{self.data_yx.shape[0]} rows are remaining after deleting invalid ones.')
# logging.info(f'{self.data_yx.shape[0]} rows are remaining after deleting invalid ones.')
def transform(self):
"""
......@@ -126,7 +126,7 @@ class Data:
elif column_name != self.target:
print(f"!!! Warning !!! Preparation could not be found: {row['column_name']}")
logging.warning(f"!!! Warning !!! Preparation could not be found: {row['column_name']}")
# logging.warning(f"!!! Warning !!! Preparation could not be found: {row['column_name']}")
def list_inputs(self):
"""
......@@ -210,11 +210,11 @@ class Data:
"""
Set up logging
"""
log_file = __file__.replace('py', 'log').split("/")[-1]
logging.basicConfig(
level=logging.DEBUG,
format="%(asctime)s [%(levelname)s] %(message)s",
filename=log_dir+log_file
# log_file = __file__.replace('py', 'log').split("/")[-1]
# logging.basicConfig(
# level=logging.DEBUG,
# format="%(asctime)s [%(levelname)s] %(message)s",
# filename=log_dir+log_file
)
if __name__ == '__main__':
......
......@@ -5,7 +5,7 @@ Helper functions for our project
"""
# general
import logging
# import logging
import pdb
# data science
......@@ -28,7 +28,7 @@ def read_csv_to_df(filename, converters=None):
df = pd.read_csv(filename, converters=converters)
return df
except Exception as exc:
logging.error(f'Error reading csv file {filename}')
# logging.error(f'Error reading csv file {filename}')
print(exc)
exit()
......@@ -41,7 +41,7 @@ def read_pkl_to_df(filename):
df = pd.read_pickle(filename)
return df
except Exception as exc:
logging.error(f'Error reading pickle {filename}')
# logging.error(f'Error reading pickle {filename}')
print(exc)
......@@ -52,13 +52,13 @@ def save_data_to_file(df, filename):
try:
if filename.endswith('pkl'):
df.to_pickle(filename)
logging.info(f'Data saved to pickle {filename}')
# logging.info(f'Data saved to pickle {filename}')
elif filename.endswith('csv'):
df.to_csv(filename, index=False)
logging.info(f'Data saved to csv {filename}')
# logging.info(f'Data saved to csv {filename}')
except Exception as exc:
logging.warning(f'Could not write file {filename}')
# logging.warning(f'Could not write file {filename}')
print(exc)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment