-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils.py
58 lines (41 loc) · 1.67 KB
/
utils.py
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
from pandas.core.frame import DataFrame
class InvalidDataFrame(Exception):
def __init__(self, df: DataFrame) -> None:
self.df = df
def __str__(self):
return "Object supplied is not a valid DataFrame"
class InvalidColumn(Exception):
def __init__(self, col: str) -> None:
self.col = col
def __str__(self):
return "{} is not a column in DataFrame object supplied.".format(self.col)
class InvalidFilePath(Exception):
def __init__(self, pth_str: str) -> None:
self.pth_str = pth_str
def __str__(self):
return "{} is not a valid file path.".format(self.pth_str)
class UnexpectedDataFrame(Exception):
def __init__(self, df: DataFrame) -> None:
self.df = df
def __str__(self):
return "Object supplied is not the expected DataFrame"
class InvalidDataType(Exception):
def __init__(self, col: object) -> None:
self.col = col
def __str__(self):
return "{} is not the appropriate data type".format(self.col)
class InvalidList(Exception):
def __init__(self, obj: object) -> None:
self.obj = obj
def __str__(self):
return "Object must be a list."
class StratifyError(Exception):
def __init__(self, col: str):
self.col = col
def __str__(self):
return "{} is not of type object and can not be stratified.".format(self.col)
class ClassifierType(Exception):
def __init__(self, obj: str):
self.obj = obj
def __str__(self):
return "{} is not a type of classification. Type should be binary if classification is binary or multi_class if classification is multi class.".format(self.obj)