Skip to content

This repository contains the code and documentation for python utils.

License

Notifications You must be signed in to change notification settings

CAI991108/Python-Programming-Utils

Repository files navigation

Python Programming Utils

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:

  1. Jacobian Matrix Calculation: Implement a function to calculate the Jacobian matrix for a given vector and function.
  2. Emirp Numbers: Write a program to find and display the first N emirp numbers.
  3. List Operations: Implement functions to check if a number is exclusively in one of two lists and to crack a four-digit password.
  4. Recursion and Tree Structures: Implement recursive functions and a binary search tree.
  5. Data Loading and Wrangling: Load and clean data from a TSV file, perform data analysis, and visualize results.
  6. Stock Data Analysis: Analyze stock data, calculate moving averages, and implement trading strategies.
  7. KNN Classifier: Implement a KNN classifier to predict test preparation course status based on reading and writing scores.

pyutils_2.py includes:

  1. Dictionary Generation: Generate a dictionary of factorials for numbers from 1 to n.
  2. Iterator Operations: Implement a function to find the first value in an iterator that appears k times in a row.
  3. 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.
  4. List Intersection: Implement a function to find the intersection of elements in a list of lists.
  5. Sandwich Number Check: Implement a function to check if a number contains a sandwich (a digit surrounded by two identical digits).
  6. Mint and Coin Classes: Implement classes to simulate a mint that creates coins with specific years and calculates their worth.
  7. Portfolio Management: Load stock data, calculate expected returns, build a covariance matrix, and design an optimal portfolio allocation.
  8. Risk Analysis: Calculate and visualize Value at Risk (VaR) and Conditional Value at Risk (CVaR) for a portfolio.
  9. Linear Classification: Use a linear classifier to predict the status of a test preparation course and evaluate its performance.
  10. Regression Analysis: Use linear regression to study the trend of reading scores with respect to math scores.
  11. Time Series Analysis: Perform exploratory data analysis on superstore sales data, including resampling and time shifting.
  12. 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

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

This repository contains the code and documentation for python utils.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published