After some hesitation, I finally decided to start with learning Python. I had some hesitations because I am used to R and that is a different kind of cookie. The decision was made easier because I am working on a project with models developed by other colleagues in Python (and Matlab). Furthermore, although Shiny in R is a great way for visualization of results, I got stuck building a combination of results and information. Python offers Dash (some nice examples can be found in the Dash Galley). Another reason is that nowadays you can use Python in your Gams programs, which is great if you have to work on the input data.
I looked for some good books and courses on Python. I tried the DataCamp courses, which are quite good, but I tend to forget the stuff and although they do a good job, the details are often left out. Finally, I decided to use the following two books with great reviews on Amazon:
The first book I really like is a classic: Learning Python by Mark Lutz. It is well written, contains lots of interesting background information that helps me understand the nuts and bolts from Python. If you read a chapter every week, you will be a good Python programmer in less than a year.
Python for Data Analysis
The second book I recommend (and was often recommended by colleagues) is the book by Wes McKinney. It gives you a more or less quick introduction in the world of Numpy, Panda (Wes McKinney brought Pandas to Python), Matplot, and many other tools for Data Science. Although it is not as thorough as the book by Mark Lutz, it gets you started with most of the stuff.
Jupyter Notebooks are a great way of working with Python and R. You can add your notes in Markdown and write code in a cell that can be evaluated over and over again.
However, one thing I didn’t like is that you have to start (on Windows) the Jupyter Notebook server in the directory where you have your notebook saved. Double-clicking a Jupyter notebook (with the extension ipynb) doesn’t work if you don’t install an additional package. Luckily, there is an easy way to get this working found on Axel’s blog.
I used the following code to enable double-click on my Windows 10, Python 3.6 machine in the command window :
pip install nbopen
And afterwards in a command window with administrator rights:
If you work on multiple projects you might have problems remembering the names of the files you are working on. Was the LaTeX file in the subdirectory “Documentation” or in “Notes”? Was the name “model.tex” or “logit.tex”? Was it “bench.gms” or “benchrd.gms” or “bench1.gms”? I loose often time searching my directories for the file I want to work on and, unfortunately enough, I am not that systematic in naming and filing my files.
I tried to solve this by keeping a list in a note, creating links, and so on, but nothing seemed to work (or I was not consistent enough). Now I use my Windows Explorer replacement Directory Opus (it costs 49-89 Australian dollar and is worth every cent; multiply it by 0.7 to get US dollar). In Dopus you can save links to files in collections. So every time, I choose a new file I will work on, I send it (by right-clicking on the file) to the collection of the actual project. Additionally, I defined a view in Dopus showing the files grouped according to their extension.
Now, I just open the project collection and see all my actual files.No searching anymore.