Skip to content

Instantly share code, notes, and snippets.

View janusson's full-sized avatar
:electron:
Reticulating Splines

Eric Janusson janusson

:electron:
Reticulating Splines
View GitHub Profile
@janusson
janusson / retrieve_CSV_paths.py
Created November 28, 2024 21:57
Retrieves the relative paths of all CSV files in the specified directory.
import os
def get_csv_file_paths(directory_path) -> list:
"""
Retrieves the relative paths of all CSV files in the specified directory.
Args:
directory_path (str): Path to the directory containing CSV files.
Returns:
@janusson
janusson / basic_logging.py
Last active January 9, 2025 01:17
Basic Logging Setup
import logging
import os
# Ensure the logs directory exists
log_dir = './logs'
os.makedirs(log_dir, exist_ok=True)
# Configure logging
logging.basicConfig(
level=logging.INFO,
@janusson
janusson / security_data_collector.py
Last active June 1, 2025 02:03
Fetches stock data with yfinance. Exports JSON & CSV.
import yfinance as yf
import json
import os
import pandas as pd
ticker_symbol = 'MSFT'
class SecurityDataCollector:
"""Retrieves financial and company information from Yahoo Finance for a given ticker."""
@janusson
janusson / get_csv_file_paths.py
Last active May 25, 2025 01:38
This function navigates through the specified directory and its subdirectories to find all files that end with .csv. It then returns a list containing the relative paths of these files.
import os
def get_csv_file_paths(directory_path) -> list:
"""
Retrieves the relative paths of all CSV files in the specified directory.
Args:
directory_path (str): Path to the directory containing CSV files.
Returns:
list: List of relative file paths for CSV files.
"""