For all of you who have been reading my blog on Python for Finance and watching my videos, I wanted to share with you how to use Python on iPad. In addition, I will also share my epxerience on using an iPad to code with Python compared to a laptop.
Why Python for iPad?
Some of you may be wondering why should I change my laptop for my iPad in order to code? From my point of view, I do not see the iPad replacing the laptop for coding purposes. At least not in the short term. However, it can be used as a great complement to the laptop for coding purposes.
For example, imagine that you are going for a weekend to visit your family somewhere in the lake and you do not feel like taking the computer and charger with you. In that case, if you want to keep coding during the weekend getaway, the only option left is to carry on an iPad.
Update: After buying the Apple Magic Keyboard, the experience of coding on an iPad is much closer to the laptop experience. See below my latest video where I code on iPad using the Apple Magic Keyboard. The Magic Keyboard is a game changer! I cannot recommend it enough. If you decide to buy one, using the following link will help this site to earn an affiliate commission.
How to code using Python on an iPad?
From my experience, the best way that I have found so far to use Python on an iPad is through Google Colab. It is a free tool available to everyone having a Gmail/Google account.
Google Colab offers the same functionality as Jupyter notebook. Colab allows you to write and execute Python in your browser and the main advantages are:
- There is not pre set-up required. It comes with plenty of packages pre-installed. I.e. Pandas, Numpy, TensorFlow, Scikit-learn, Matplotlib and many others. We can use them simply by importing the packages.
- Scripts are available in all devices. I.e. Same scripts can be accessed and edited in laptop and iPad.
- Free access to GPUs.
- The code and script can be very easily shared with others. The script created can be uploaded into Github or downloaded to the local disk as a .py extension.
- The best of all is that it is totally for free and enable us to code with Python on iPad.
To sum up, I see Google Colab as great tool to use it for financial analysis. All of my articles in this blog are done using Google Colab or Jupyter Notebook. Which means that they all can be replicated using an iPad.
How to set up Google Colab?
In order to start to use Python on iPad, we need to have a Google drive account. Google Drive offers free cloud storage for personal use. You can create a free account here.
Once an account is created, below are the steps to follow in order to start coding in iPad:
- Login using the browser to Google Drive in your iPad. Then, create a new Colab document by clicking on New:
2. Select More and Google Colaboratory. If you do note see Google Colaboratory in the list, click on Connect more apps in order to install it into your Google Drive.
3. A new Google Colab document will open where we will be able to add our code or text:
4. Below are the main parts of a document. Click on 1 to rename the document. 2 and 3 let you add new cells for coding or simple text edition. 4 is the cell where we can enter the Python code. Once the script is ready, click on 5 to run the code in that cell. Finally, save or download your code by using the tool bar (6).
5. Start creating your Python scripts in iPad. Below in as simple example to create a Pandas DataFrame
6. Run the cell to execute the code by clicking in the play button. The outcome is shown below the cell:
As we have seen, it is super easy to start to use Python on iPad. However, I do not see my iPad replacing my laptop for my Python projects for two reasons.:
- First and more important, it is super inefficient for me to write code using the iPad onscreen keyboard. I am slower and more prone to errors than using a normal keyboard. I will share my experience in a later post if by using the iPad Magic Keyboard the experience improves.
- And the second reason is the smaller screen in my iPad compared to my laptop or desktop computer.
Nevertheless, from time to time, specially when I have to travel, I use my iPad for Python coding and it works as if I were coding in a computer. Feel free to leave a comment with your experience on coding with iPad and which app are you using for it.
I also have a short Youtube video on how to code in Python using an iPad: