-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfilehandler.py
More file actions
30 lines (24 loc) · 831 Bytes
/
Copy pathfilehandler.py
File metadata and controls
30 lines (24 loc) · 831 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
"""
==============================================================================
File handler
==============================================================================
File handler
"""
import logging
from os import path
import pandas as pd
class Filehandler:
"""Represent constants"""
def __init__(self):
self.file_target = 'target'
self.file_scores = 'scores.csv'
self.data_raw_path = None
self.scores_path = None
self.feature_ranking_path = None
def read_csv(self, folder, file):
full_path = path.join(folder, file)
logging.info('Reading file - {}'.format(full_path))
return pd.read_csv(full_path)
def write_csv(self, folder, file, df):
full_path = path.join(folder, file)
df.to_csv(full_path, header=True, index=False)