Transitioning from R to Python through Colaboratory

in Programming & Dev3 years ago (edited)


Photo Credits

I lost count of the number of times I "false-started" on trying to master Python.

Python is too difficult if you always have R to fall back on, such as in my case. I am pretty comfortable in R so there is little incentive in learning Python to begin with.

But the main difficulty for me is dealing with the IDE. The choices are aplenty, and it gets pretty confusing for me with the interacies of loading packages and all. Indeed, my simple brain prefers something standard like RStudio.

I think things might be changing for the better now that I discover the ease of using Colaboratory to do my Python work.

For the unintiated, Colaboratory or Colab is a Google-based service that allows Python to be run in notebook-style.

With that, I could just start importing packages without worries, much like how things are done in R, i.e. just use import for install.

I have a short tutorial on my initial foray into Python on Colab.

For those coming from R to Python, I think Colab makes things really simple for the following reasons (at least for me, now):

  1. Importing packages is simplified.
  2. Plenty of resources online given the larger user base. It does not take long to figure out that one's question is not new, and someone had solved it.
  3. Plotting can be simple. If you are familiar with ggplot, there is a similar package called plotnine that one can use in Python.

The hardest thing so far is to get used to the fact that functions are accessible from typing a period (.). For example, NumPy has a mean function that is accessed by numpy.mean().

There are advantages to using Colab for learning Python and sharing with students. No one needs to install any IDE to get Python going!

R skills get a second life!