Skip to content

Commit 4d7e54f

Browse files
committed
Adhere to optional swat requirements
1 parent 779b792 commit 4d7e54f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/sasctl/pzmm/writeJSONFiles.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,12 @@
55
from pathlib import Path
66
import sys
77

8-
import swat
98
import getpass
109
import json
1110
import pandas as pd
1211
from sklearn import metrics
1312
import numpy as np
1413
from scipy.stats import kendalltau, gamma
15-
1614
# %%
1715
class JSONFiles:
1816
def writeVarJSON(self, inputData, isInput=True, jPath=Path.cwd()):
@@ -608,6 +606,12 @@ def generateROCLiftStat(
608606
'dmcas_lift.json'
609607
Output JSON file located at jPath.
610608
"""
609+
try:
610+
import swat
611+
except ImportError:
612+
raise RuntimeError(
613+
"The 'swat' package is required to generate ROC and Lift charts with this function."
614+
)
611615

612616
nullJSONROCPath = Path(__file__).resolve().parent / "null_dmcas_roc.json"
613617
nullJSONROCDict = self.readJSONFile(nullJSONROCPath)

0 commit comments

Comments
 (0)