Skip to content

Repository files navigation

Gabe Rice

STATS 336 EASTER ‘25

Project Information

This repository was created for the class Statistics 336: Sports Analytics, taught by Professor Drinnen.

For this project, I replicated queries from a previous assignment in RStudio and wrote them in Python. The main script is Final_project_notebook, which has the exam questions and their implementation using pandas and matplotlib, the two main libraries used for querying in Python. Most of the scripts are directly saved from RStudio, except for the last three questions, which I will explain more about the library when they are reached.I have published everything onto this GitHub page, and all scripts should have decent documentation regarding information and comparisons to RStudio queries.

Scripts

The main project script is Final_project_notebook, and is very appropriately named. This is my effort to translate RStudio queries on the midterm exam into Python Queries. You’ll notice a folder titled RStudio_stuff, where, as you might guess, you’ll find some R scripts. Batting conversions lists how I downloaded the Lahman scripts because Pybaseball wasn’t working for me. In this folder, you will also find my answers and queries for the first exam questions, which produce results similar to those of my Python queries. Some other files are not nearly as long as the exam script but contain some information and act as a testing ground for me to work with some of the data and libraries that were used in the final project. I suggest that you open them if you (like me) found the code to be a bit confusing and need some more documentation.

Other Information

I don’t have much else to say, but here are some links to the libraries that I used that will provide way more information then I can:

Pandas - This is the tidyverse of data manipulation in Python. I’m sure that I didn’t even scratch the surface of what I can do with this library in these scripts. Matplotlib - I really didn’t go crazy with the plots I made, but this is the man plotting library in Python. SportsDataverse - This is a huge public repository of sports data, which I think that you, Dr. Drinnen should check out. Pybaseball - I couldn’t really get this to work, but it’s worth checking out.

Conclusion

Like I said in the end of the main script, I can say that without a doubt, Python is the worst querying language I have ever had to work with. However, It is Python. What I mean by this is that other languages are more suited towards specifically querying, while Python, not being tailored for it, Python can emulate a lot of things that those languages are built for. Working on this project has strengthened my skills with Python, which have dulled over semesters of working with Java. I have appreciated attempting to use Python as a querying language because of my affinity for RStudio and SQL. That being said, I personally cannot recommend its implementations for questions that Dr. Drinnen may ask.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages