-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.py
More file actions
49 lines (32 loc) · 1.1 KB
/
utils.py
File metadata and controls
49 lines (32 loc) · 1.1 KB
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
import os
import numpy as np
import pandas as pd
def dataset_info(df: pd.DataFrame):
title("Dataset info after processing")
print(">>> df.info() <<<")
print(df.info())
print("\n>>> df.describe() <<<")
print(df.describe())
print("\n>>> df.head() <<<")
print(df.head())
print("\n>>> df.columns() <<<")
print(df.columns)
print("\n>>> df.isnull().any()<<<")
print(df.isnull().any())
def title(title):
print('\n############ ', title, ' ############')
def project_info(args):
print("\n------------ Project args --------------")
print("Cross validation foldings:\t", args.cv)
print("Best features:\t", args.n_features)
print("----------------------------------------\n")
def npserialize(filepath, *args, **kwds):
directory = os.path.dirname(filepath)
# Crea le cartelle intermedie se non esistono
if directory and not os.path.exists(directory):
os.makedirs(directory)
# Rimuove il file se esiste già
if os.path.exists(filepath):
os.remove(filepath)
# Salva i dati nel file npz
np.savez(filepath, *args, **kwds)