## Archive for the ‘Python’ Category

## My Email to my Appointed Mentor from UNISA

I was excited today to receive an email from Dr. Abraham Tlhalefang Motlhabane of UNISA who has been appointed to be my doctoral supervisor. Although, while Dr. Motlhabane has an excellent background in science education, I hope he will have sufficient background in statistical methods to help me get beyond my current limitations, or that maybe other UNISA professors can also help. After he emailed me, I wrote the following email, which I think is a good self-reflection of where I am on this project.

## A call for help about understanding Ordinary Least Squares (OLS) vs. Orthogonal Distance Regression (ODR) vs. Robust Regression

Just when I think I have my underlying mathematical knowledge sufficiently wrapped up to start to write Python code for my doctoral research, I find that there are new questions… In the current case, I was originally going to try and determine the strength of a linear or non-linear correlation by using Ordinary Least Squares, which is usually what is used to find the Coefficient of Determination. But when I started to look at regression functions in SciPy, I ran across Orthogonal Distance Regression (ODR), and when I started to try and research ODR more, I ran across the concept of robust regression. Now I’m trying to understand both of these concepts more, and I could use some help from someone who really understands this stuff, and can explain it in a more conceptual manner, so I can determine which statistical method is most appropriate for my research. Here is what I believe I understand so far:

## Some Python “Best Practices”

As I have said before, I don’t believe their are truly “best practices”, sometimes there are “best known practices”, or “best known practices for a given context”. But, there are often times when it is clear something is a bad practice. And through the school of hard knocks, I’ve learned from attempting some practices that I thought were good, but turned out to be bad. So here is what I have learned.

## Python Script to Automate Refreshing an Excel Spreadsheet

Often I run into situations where it makes sense to do analysis of a lot of database data in an Excel spreadsheet, but due to the amount of processing the spreadsheet requires when updating, it takes a long time for the spreadsheet to “Refresh All”.

One solution to this problem is to automate the spreadsheet so it refreshes every night. The following is a small Python script that can do this using the Python for Windows Extension: