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
Created December 8, 2024 03:53
This Python script utilizes the yfinance library to collect and manage various types of financial and stock market data for a given ticker symbol from Yahoo Finance. The script provides functionalities to fetch and store company information, news, options, earnings dates, recommendations, holders, financial statements, and historical price data.…
import logging
import yfinance as yf
import json
import csv
import os
import pandas as pd
# Setup logging configuration
logging.basicConfig(filename='security_data_collector.log', level=logging.ERROR,
format='%(asctime)s - %(levelname)s - %(message)s')
@janusson
janusson / get_csv_file_paths.py
Last active January 9, 2025 01:08
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.
"""