-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathCode-Snippets.py
More file actions
33 lines (25 loc) · 863 Bytes
/
Code-Snippets.py
File metadata and controls
33 lines (25 loc) · 863 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
30
31
32
33
################################################
# Getting Project Root and Data Directory
################################################
from pathlib import Path
import pandas as pd
# Get project root directory (relative to this script)
PROJECT_ROOT = Path(__file__).parent.resolve()
DATA_DIR = PROJECT_ROOT / 'data'
RESULTS_DIR = PROJECT_ROOT / 'results'
# Create results directory if it doesn't exist
RESULTS_DIR.mkdir(exist_ok=True)
data=pd.read_csv(DATA_DIR / 'AutoInsurance.csv')
data.head()
################################################
# Try Catch Exception Handling
################################################
try:
result = 10/0
print("Result is:", result)
except Exception as e:
print(f"An Error Occured: {e}")
raise e
################################################
#
################################################