This repository contains the code and documentation for python utils. Below is a brief overview of each project and the tasks involved.
pyutils_1.py includes:
- Jacobian Matrix Calculation: Implement a function to calculate the Jacobian matrix for a given vector and function.
- Emirp Numbers: Write a program to find and display the first N emirp numbers.
- List Operations: Implement functions to check if a number is exclusively in one of two lists and to crack a four-digit password.
- Recursion and Tree Structures: Implement recursive functions and a binary search tree.
- Data Loading and Wrangling: Load and clean data from a TSV file, perform data analysis, and visualize results.
- Stock Data Analysis: Analyze stock data, calculate moving averages, and implement trading strategies.
- KNN Classifier: Implement a KNN classifier to predict test preparation course status based on reading and writing scores.
pyutils_2.py includes:
- Dictionary Generation: Generate a dictionary of factorials for numbers from 1 to n.
- Iterator Operations: Implement a function to find the first value in an iterator that appears k times in a row.
- Recursive Functions: Write recursive functions to check for adjacent 5s in a number and to find all ways k positive integers can sum to n.
- List Intersection: Implement a function to find the intersection of elements in a list of lists.
- Sandwich Number Check: Implement a function to check if a number contains a sandwich (a digit surrounded by two identical digits).
- Mint and Coin Classes: Implement classes to simulate a mint that creates coins with specific years and calculates their worth.
- Portfolio Management: Load stock data, calculate expected returns, build a covariance matrix, and design an optimal portfolio allocation.
- Risk Analysis: Calculate and visualize Value at Risk (VaR) and Conditional Value at Risk (CVaR) for a portfolio.
- Linear Classification: Use a linear classifier to predict the status of a test preparation course and evaluate its performance.
- Regression Analysis: Use linear regression to study the trend of reading scores with respect to math scores.
- Time Series Analysis: Perform exploratory data analysis on superstore sales data, including resampling and time shifting.
- PyTorch Exercise: Set up PyTorch CUDA and perform basic operations.
To run the code in this repository, you will need:
- Python 3.x, Jupyter Notebook, Required Python libraries (e.g., NumPy, Pandas, Matplotlib, Scikit-learn, PyTorch)
You can install the required libraries using pip:
pip install numpy pandas matplotlib scikit-learn torch torchvision
This project is licensed under the MIT License. See the LICENSE file for details.