File size: 770 Bytes
0472866
151eb1b
0472866
151eb1b
0472866
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
from datetime import datetime

import pandas as pd
from termcolor import colored


def load_all_developers_dataset():
    try:
        print(colored("Loading dataset...", "blue"))
        df = pd.read_csv("data/source/all_networks_developer_classification.csv")
        df["month_year"] = pd.to_datetime(df["month_year"], format="%B_%Y")
        return df
    except Exception as e:
        print(colored(f"Error loading dataset: {e}", "red"))
        raise


def save_plot(plt, base_filename):
    """
    Save a matplotlib plot to a file with a timestamped filename.
    """
    current_date = datetime.now().strftime("%Y-%m-%d")
    filename = f"data/figures/{base_filename}_{current_date}.png"
    plt.savefig(filename, dpi=300, bbox_inches="tight")
    plt.close()