Colab, Jupyter, and Spyder IDE: A beginner’s first walk-through experience in programming.

Saraaa

--

Have you ever felt intimidated by just the thought of programming or coding? How scary the numbers and letters in computers might seem, and not to mention the words, Python, Anaconda, and Spyders? Well, that’s what I felt all these years until last week, and maybe still a bit terrified until now, but not much.

I’m an accountancy graduate, with no hands-on experience with anything close to programming. Yet, I’m determined to make a career shift in data science so I decided to push-through it though I sometimes doubt myself, especially in this area. The first thing I did was to change my mindset. It’s really hard to work on something you have negative feelings and thoughts about. Last week’s topic in our boot camp was overwhelming for me and somehow discouraging. I then decided to ask for help, start it off, and thought that everyone, including experts or professionals, were once a beginner at a point of their lives. And with that, I want to keep reminding myself with a quote from Maya Angelou. “Whatever you want to do, if you want to be great at it, you have to love it and be able to make sacrifices for it.” So now, here I am, ready to take you to my first walk-through experience in programming and coding.

As part of our homework this week, we used three programming open-sourced IDEs. Google Colab, Jupyter Notebook, and Spyder.

Google Colab

What is it? By definition, it’s “short for Colaboratory and is a product from Google Research. It allows anybody to write and execute arbitrary python code through the browser, and is especially well suited to machine learning, data analysis and education. Colab is also a free cloud service and now supports free GPU. Where you can improve your Python programming language coding skills,and develop deep learning applications using popular libraries.”

To start off, go to colab.research.google.com and click ‘new notebook’ at the bottom right.

Double-click the name of the file to rename. The filename I chose was a combination of the a random word with a nice definition from Google, date, and my initials.

The next thing I did was to explore different font sizes and styles in the text cells for the header and body. A guide can be found here.

To use a software library, in my case I used pandas, type “import pandas as pd” in a code cell and then “from google.colab import files” to upload a file from you computer. Use SHIFT+ENTER to run the code. You can see a number beside the cell when the code has successfully ran.

IMPORT FILE

I uploaded a .csv file and run it in the dataframe by typing “df = pd.read_csv(‘filename.csv’)” then “df.describe()” to analyze both numeric and object series and also the dataframe column sets of mixed data types. “df = df.dropna() to drop the null then run the describe function again. )(Note: always use SHIFT+ENTER to run the codes.)

To write the data frame to another .csv file use this function, use another function from pandas, “df.to_csv(‘new.csv’, index=False), the latter part is included to the row number in the new file. Finally, to download on your device, “files.download(‘new.csv’)”.

Decided to put a random comment on a cell by clicking the comment box on top of it. Then, by clicking File, I saved a copy in my GitHub repository and downloaded a .ipynb file as backup as well. The file will the copied on github via upload, but I also tried it using git command prompt. Use a git clone on anywhere you want it on your computer by copying your repository’s URL and using it to clone on git’s command prompt. (I cloned mine in my desktop so I can easily find it.) Paste the downloaded file on my cloned repo, ran the commands in git repo for adding a file. And bwala! Refresh your github account to see that it has been uploaded there as well.

COMMENT AND SAVE/COPY
GIT CMD GIT CLONE

Jupyter Notebook

Per definition, is also “an open-source web application that allows you to create and share documents that contain live code, equations, visualizations and narrative text. Uses include: data cleaning and transformation, numerical simulation, statistical modeling, data visualization, machine learning, and much more.”

First thing to do is run the Anaconda Navigator. You can download and install if you don’t have one yet. Choose Jupyter Notebook and launch to google chrome.

Open the folder or location where your .csv file is. (I saved mine in my cloned repo as well.) Click new on the upper right, select Python 3. Changed the filename similar with how it can be changed in Colab. Added header and text, then proceeded with the same codes and file I used in Colab. SHIFT+ENTER again to run the codes.

Saved it as an .ipynb file and by the time you ran all the codes, a new updated .csv file is saved.

Spyder

Spyder, which has almost the same function with the first two, is defined “as an open source cross-platform integrated development environment for scientific programming in the Python language.”

For Spyder, open the Anaconda Navigator again and launch Spyder 4.1.4.

I typed the same set of codes and functions on the code block with one space apart, I also used same .csv file for this. I ran the codes at the same time by using the green play arrow above or just press F5, The variables will show on the upper right corner, while the console will show the codes you ran and the errors.

Saved the file as Python this time on my cloned repository together with the new cleaned data in .csv.

Lastly, I ran the git command prompt again to add all new files in my github account repository. And checked it to be sure it went all well.

Here’s the link for my Github Repository!

That’s it for today’s blog! See you on my next one! :)

--

--

No responses yet