{"id":210735,"date":"2024-08-21T12:28:58","date_gmt":"2024-08-21T16:28:58","guid":{"rendered":"https:\/\/ibkrcampus.com\/campus\/?p=210735"},"modified":"2024-08-28T15:13:17","modified_gmt":"2024-08-28T19:13:17","slug":"google-colab-a-step-by-step-guide","status":"publish","type":"post","link":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/google-colab-a-step-by-step-guide\/","title":{"rendered":"Google Colab &#8211; A Step-by-step Guide"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><em>The article &#8220;Google Colab &#8211; A Step-by-step Guide&#8221; first appeared on <a href=\"https:\/\/algotrading101.com\/learn\/google-colab-guide\/\">AlgoTrading101<\/a> blog.<\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>Excerpt<\/em><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-what-is-google-colab\">What is Google Colab?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Google Colab is an online notebook-like coding environment that is well-suited for machine learning and data analysis.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It comes equipped with many Machine Learning libraries and offers GPU usage. It is mainly used by data scientists and ML engineers.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a>Link:&nbsp;<\/a><a href=\"https:\/\/colab.research.google.com\/\">https:\/\/colab.research.google.com<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-is-google-colab-free\">Is Google Colab free?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><a>Yes, Google Colab is free to use and you can access all of its features to a certain degree. There is a subscription plan called&nbsp;<\/a><a href=\"https:\/\/colab.research.google.com\/signup\">Google Colab Pro<\/a>&nbsp;that offers access to upgraded features.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">These upgraded features allow the use of more processing power, RAM, and memory. You can access this plan for $9.99 per month if you come from one of the following countries:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>US<\/li>\n\n\n\n<li>Canada<\/li>\n\n\n\n<li>UK<\/li>\n\n\n\n<li>Germany<\/li>\n\n\n\n<li>France<\/li>\n\n\n\n<li>India<\/li>\n\n\n\n<li>Japan<\/li>\n\n\n\n<li>Thailand<\/li>\n\n\n\n<li>Brazil<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img decoding=\"async\" width=\"876\" height=\"648\" data-src=\"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/08\/algotrading101-google-colab.jpg\" alt=\"\" class=\"wp-image-210740 lazyload\" style=\"--smush-placeholder-width: 876px; aspect-ratio: 876\/648;width:946px;height:auto\" data-srcset=\"https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/08\/algotrading101-google-colab.jpg 876w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/08\/algotrading101-google-colab-700x518.jpg 700w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/08\/algotrading101-google-colab-300x222.jpg 300w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/08\/algotrading101-google-colab-768x568.jpg 768w\" data-sizes=\"(max-width: 876px) 100vw, 876px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Why should I use Google Colab?<\/h2>\n\n\n\n<ul id=\"block-d85790f0-ca53-4f0e-983a-b95d2ba0408b\" class=\"wp-block-list\">\n<li>Google Colab is Free<\/li>\n\n\n\n<li>Easy to get started<\/li>\n\n\n\n<li>Allows access to GPUs\/TPUs<\/li>\n\n\n\n<li>Easy to share code with others<\/li>\n\n\n\n<li>Easy graphical visualizations in Notebooks<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Let\u2019s go over each of the pros of Google Colab.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Firstly, it is&nbsp;<strong>free to use<\/strong>&nbsp;and everyone can access it. There are also some premium features if you want to utilize GPUs\/TPUs with more power and fewer limitations.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Getting started<\/strong>&nbsp;with Google Colab is easy. You don\u2019t need to install any prerequisites or have a decent PC or laptop. All you need is a browser where you\u2019ll get a Jupyter Notebook-like environment.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Google Colab comes ready with&nbsp;<strong>GPUs&nbsp;<\/strong>and&nbsp;<strong>TPUs&nbsp;<\/strong>which can be utilized with a click of a single button. This makes Google Colab a great coding environment for machine learning practitioners.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Sharing code<\/strong>&nbsp;with Google Colab can be done through Google Drive or directly to GitHub with an in-built feature.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Being like a Jupyter Notebook, a Google Colab document allows you to run code in blocks, and intersperse these blocks with Markdown cells. It can also easily display multiple graphical outputs.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">All of these features make Google Colab a phenomenal asset when it comes to collaborative, data science, machine learning, and data analysis projects.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Why shouldn\u2019t I use Google Colab?<\/h2>\n\n\n\n<ul id=\"block-5a4c6fa6-222a-4dda-af90-7fdbbe677a01\" class=\"wp-block-list\">\n<li>GPU\/TPU usage is limited<\/li>\n\n\n\n<li>Not the most powerful GPU\/TPU setups available<\/li>\n\n\n\n<li>Not the best de-bugging environment<\/li>\n\n\n\n<li>It is hard to work with big data<\/li>\n\n\n\n<li>Have to re-install extra dependencies every new runtime<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">GPU\/TPU usage is not endless with Google Colab as resources aren\u2019t infinite. The&nbsp;<strong>free version<\/strong>&nbsp;lasts for&nbsp;<strong>12 hours of continuous usage<\/strong>&nbsp;and is not very tolerant with inactivity, whilst the&nbsp;<strong>pro version allows 24 hours<\/strong>&nbsp;of continuous usage with greater tolerance.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The free version of Google Colab allows the usage of a&nbsp;<strong>K80 GPU<\/strong>&nbsp;while the Pro version allows a&nbsp;<strong>T4<\/strong>&nbsp;or&nbsp;<strong>P100 GPU<\/strong>. For most of you, these GPUs are way more powerful than the ones you have, but for more money we can get even better ones (e.g. AWS).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Being a Notebook environment, it will be harder to catch&nbsp;<strong>bugs<\/strong>&nbsp;in your code before running it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">As big datasets<strong>&nbsp;need to fit in a Google drive<\/strong>, it can be difficult to deal with them because you are limited to 15 GB of free space with a Gmail id.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Lastly, you\u2019ll have to&nbsp;<strong>(re)install any additional libraries<\/strong>&nbsp;you want to use&nbsp;<strong>every time you (re)connect to a Google Colab notebook<\/strong>. A good thing is that it comes equipped with pre-installed libraries that are often used.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What are the alternatives to Google Colab?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Google Colab can be replaced with other platforms that can be more suitable for your needs. Here are some of them:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Jupyter Notebook<\/li>\n\n\n\n<li>Kaggle<\/li>\n\n\n\n<li>Azure Notebooks<\/li>\n\n\n\n<li>Amazon SageMaker<\/li>\n\n\n\n<li>Paperspace Gradient<\/li>\n\n\n\n<li>FloydHub<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Does Google Colab support Python?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Yes, Google Colab supports Python (and as of October 2019 only allows the creation of Python 3 notebooks), though in some cases with further tinkering it might be possible to get R, Swift, or Julia to work.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Have in mind that since the 1st January 2020, Python 2 is no longer supported.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How do I get started with Google Colab?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">There are several ways to get started with Google Colab and we will go over each of them. All approaches are quite easy and it depends on what you want to start working on (i.e. fresh notebook or GitHub repository).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The first way is to go over to your Google Drive account. In the top left corner select \u201cNew\u201d, then \u201cMore\u201d in the drop-down panel, and then \u201cGoogle Collaboratory\u201d.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"651\" height=\"620\" data-src=\"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/08\/algotrading101-google-colab-2.jpg\" alt=\"\" class=\"wp-image-210742 lazyload\" data-srcset=\"https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/08\/algotrading101-google-colab-2.jpg 651w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/08\/algotrading101-google-colab-2-300x286.jpg 300w\" data-sizes=\"(max-width: 651px) 100vw, 651px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 651px; aspect-ratio: 651\/620;\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To open an existing Google Colab document simply right click on it \u2013&gt; Open With \u2013&gt; Google Collaboratory. You can also load other people\u2019s Google Colab documents if you share a google drive with them.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"681\" height=\"771\" data-src=\"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/08\/algotrading101-google-colab-3.jpg\" alt=\"\" class=\"wp-image-210746 lazyload\" data-srcset=\"https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/08\/algotrading101-google-colab-3.jpg 681w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/08\/algotrading101-google-colab-3-300x340.jpg 300w\" data-sizes=\"(max-width: 681px) 100vw, 681px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 681px; aspect-ratio: 681\/771;\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><a>To import\/open files directly from GitHub you will need the&nbsp;<\/a><a href=\"https:\/\/chrome.google.com\/webstore\/detail\/open-in-colab\/iogfkhleblhcpcekbiedikdehleodpjo\">Open in Colab<\/a>&nbsp;chrome extension. Add it to your chrome, then navigate over to the notebook you want to open in Github, click on your browser\u2019s&nbsp;<strong>Extensions&nbsp;<\/strong>tab, then click&nbsp;<strong>Open in Colab<\/strong>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">As the extension is new and is still being worked on I\u2019d advise waiting a bit for it to get polished.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Another way is to go to&nbsp;<a href=\"https:\/\/colab.research.google.com\/notebooks\/intro.ipynb#recent=true\">this link<\/a>&nbsp;and click the \u201cNew Notebook\u201d button. You can also see that you have access to Google Colab examples, Recent notebooks, Google Drive, GitHub, and you can upload your own notebook.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"1051\" height=\"724\" data-src=\"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/08\/algotrading101-google-colab-5.jpg\" alt=\"\" class=\"wp-image-210750 lazyload\" data-srcset=\"https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/08\/algotrading101-google-colab-5.jpg 1051w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/08\/algotrading101-google-colab-5-700x482.jpg 700w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/08\/algotrading101-google-colab-5-300x207.jpg 300w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/08\/algotrading101-google-colab-5-768x529.jpg 768w\" data-sizes=\"(max-width: 1051px) 100vw, 1051px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 1051px; aspect-ratio: 1051\/724;\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">After opening up a new Notebook you can do a couple of things with it. The first thing is to give it a name in the upper left corner. In the upper right corner, you can click on the Settings icon.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1100\" height=\"284\" data-src=\"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/08\/algotrading101-google-colab-6-1100x284.jpg\" alt=\"\" class=\"wp-image-210754 lazyload\" data-srcset=\"https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/08\/algotrading101-google-colab-6-1100x284.jpg 1100w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/08\/algotrading101-google-colab-6-700x181.jpg 700w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/08\/algotrading101-google-colab-6-300x78.jpg 300w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/08\/algotrading101-google-colab-6-768x199.jpg 768w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/08\/algotrading101-google-colab-6-1536x397.jpg 1536w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/08\/algotrading101-google-colab-6.jpg 1729w\" data-sizes=\"(max-width: 1100px) 100vw, 1100px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 1100px; aspect-ratio: 1100\/284;\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">When in settings you can change your theme to dark, set your editor key bindings and colors, change the font size, and more. Be sure to customize these features so they suit your preferences.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"1061\" height=\"753\" data-src=\"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/08\/algotrading101-google-colab-8.jpg\" alt=\"\" class=\"wp-image-210757 lazyload\" data-srcset=\"https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/08\/algotrading101-google-colab-8.jpg 1061w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/08\/algotrading101-google-colab-8-700x497.jpg 700w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/08\/algotrading101-google-colab-8-300x213.jpg 300w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/08\/algotrading101-google-colab-8-768x545.jpg 768w\" data-sizes=\"(max-width: 1061px) 100vw, 1061px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 1061px; aspect-ratio: 1061\/753;\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Now, let us get acquainted with some of the most used shortcuts so we can save ourselves some time (for Mac users CTRL == Command):<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Command Pallete \u2013 Ctrl+Shift+P<\/li>\n\n\n\n<li>Add a comment \u2013 Ctrl+Alt+M<\/li>\n\n\n\n<li>Convert to text cell \u2013 Ctrl+M M<\/li>\n\n\n\n<li>Add a new cell below \u2013 Ctrl+B B<\/li>\n\n\n\n<li>Run all cells \u2013 Ctrl+F9<\/li>\n\n\n\n<li>Run the current cell \u2013 Ctrl+Enter<\/li>\n\n\n\n<li>Save Notebook \u2013 Ctrl+S<\/li>\n\n\n\n<li>Show keyboard shortcuts \u2013 Ctrl+M H<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">All shortcuts can be edited to suit your needs.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">On the left taskbar, you can view your Notebook\u2019s table of contents that shows all the Markdown headers in a structured way, useful code snippets, files, and a search and replace tool.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img decoding=\"async\" width=\"564\" height=\"332\" data-src=\"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/08\/algotrading101-google-colab-9.jpg\" alt=\"\" class=\"wp-image-210758 lazyload\" style=\"--smush-placeholder-width: 564px; aspect-ratio: 564\/332;width:950px;height:auto\" data-srcset=\"https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/08\/algotrading101-google-colab-9.jpg 564w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/08\/algotrading101-google-colab-9-300x177.jpg 300w\" data-sizes=\"(max-width: 564px) 100vw, 564px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">To start coding, in the upper right side you may see the connect button so be sure to click it. When connected you will see something like this:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"606\" height=\"253\" data-src=\"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/08\/algotrading101-google-colab-10.jpg\" alt=\"\" class=\"wp-image-210759 lazyload\" data-srcset=\"https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/08\/algotrading101-google-colab-10.jpg 606w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/08\/algotrading101-google-colab-10-300x125.jpg 300w\" data-sizes=\"(max-width: 606px) 100vw, 606px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 606px; aspect-ratio: 606\/253;\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Now that we know how to use some of the main features of Google Colab, we are ready to start working on a problem. I believe that this is the best way to get acquainted with new environments and learn some new things as a bonus.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How do I import libraries\/install dependencies in Google Colab?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Importing libraries and installing dependencies in Google Colab is quite easy. You need to use your usual&nbsp;<code>!pip install<\/code>&nbsp;and&nbsp;<code>import<\/code>&nbsp;commands followed by the libraries\/dependencies name.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A great thing about Google Colab is that it comes with many preinstalled dependencies that are often used.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Any installations only remain for the duration of your session, so if you close the session\/notebook, you\u2019ll have to run inline installations whenever you open your project again.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You can check which version of a library you\u2019re using with<code>&nbsp;!pip show<\/code>. For example, to check which version of TensorFlow you are using you would use&nbsp;<code>!pip show tensorflow<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To upgrade an already installed library to the latest version, use&nbsp;<code>!pip install --upgrade tensorflow<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">And finally to install a specific version, use&nbsp;<code>!pip install tensorflow==1.2<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>Visit <a href=\"https:\/\/algotrading101.com\/learn\/google-colab-guide\/\">AlgoTrading101<\/a> for instructions on enabling GPU\/TPU usage in Google Colab.<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Google Colab is an online notebook-like coding environment that is well-suited for machine learning and data analysis.<\/p>\n","protected":false},"author":815,"featured_media":169564,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[339,343,349,338,341],"tags":[17604,595],"contributors-categories":[13746],"class_list":["post-210735","post","type-post","status-publish","format-standard","has-post-thumbnail","category-data-science","category-programing-languages","category-python-development","category-ibkr-quant-news","category-quant-development","tag-google-colab-2","tag-python","contributors-categories-algotrading101"],"pp_statuses_selecting_workflow":false,"pp_workflow_action":"current","pp_status_selection":"publish","acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.9 (Yoast SEO v28.8) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Google Colab &#8211; A Step-by-step Guide | IBKR Quant<\/title>\n<meta name=\"description\" content=\"Google Colab is an online notebook-like coding environment that is well-suited for machine learning and data analysis.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.interactivebrokers.com\/campus\/wp-json\/wp\/v2\/posts\/210735\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Google Colab - A Step-by-step Guide | IBKR Campus US\" \/>\n<meta property=\"og:description\" content=\"Google Colab is an online notebook-like coding environment that is well-suited for machine learning and data analysis.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/google-colab-a-step-by-step-guide\/\" \/>\n<meta property=\"og:site_name\" content=\"IBKR Campus US\" \/>\n<meta property=\"article:published_time\" content=\"2024-08-21T16:28:58+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-08-28T19:13:17+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2022\/11\/Cloud-Computing-1.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1000\" \/>\n\t<meta property=\"og:image:height\" content=\"563\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Igor Radovanovic\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Igor Radovanovic\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\n\t    \"@context\": \"https:\\\/\\\/schema.org\",\n\t    \"@graph\": [\n\t        {\n\t            \"@type\": \"NewsArticle\",\n\t            \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/ibkr-quant-news\\\/google-colab-a-step-by-step-guide\\\/#article\",\n\t            \"isPartOf\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/ibkr-quant-news\\\/google-colab-a-step-by-step-guide\\\/\"\n\t            },\n\t            \"author\": {\n\t                \"name\": \"Igor Radovanovic\",\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#\\\/schema\\\/person\\\/5ad3608f37f2559612df5ecf6b075f9e\"\n\t            },\n\t            \"headline\": \"Google Colab &#8211; A Step-by-step Guide\",\n\t            \"datePublished\": \"2024-08-21T16:28:58+00:00\",\n\t            \"dateModified\": \"2024-08-28T19:13:17+00:00\",\n\t            \"mainEntityOfPage\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/ibkr-quant-news\\\/google-colab-a-step-by-step-guide\\\/\"\n\t            },\n\t            \"wordCount\": 1332,\n\t            \"commentCount\": 0,\n\t            \"publisher\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#organization\"\n\t            },\n\t            \"image\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/ibkr-quant-news\\\/google-colab-a-step-by-step-guide\\\/#primaryimage\"\n\t            },\n\t            \"thumbnailUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2022\\\/11\\\/Cloud-Computing-1.jpg\",\n\t            \"keywords\": [\n\t                \"Google Colab\",\n\t                \"Python\"\n\t            ],\n\t            \"articleSection\": [\n\t                \"Data Science\",\n\t                \"Programming Languages\",\n\t                \"Python Development\",\n\t                \"Quant\",\n\t                \"Quant Development\"\n\t            ],\n\t            \"inLanguage\": \"en-US\",\n\t            \"potentialAction\": [\n\t                {\n\t                    \"@type\": \"CommentAction\",\n\t                    \"name\": \"Comment\",\n\t                    \"target\": [\n\t                        \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/ibkr-quant-news\\\/google-colab-a-step-by-step-guide\\\/#respond\"\n\t                    ]\n\t                }\n\t            ]\n\t        },\n\t        {\n\t            \"@type\": \"WebPage\",\n\t            \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/ibkr-quant-news\\\/google-colab-a-step-by-step-guide\\\/\",\n\t            \"url\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/ibkr-quant-news\\\/google-colab-a-step-by-step-guide\\\/\",\n\t            \"name\": \"Google Colab - A Step-by-step Guide | IBKR Campus US\",\n\t            \"isPartOf\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#website\"\n\t            },\n\t            \"primaryImageOfPage\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/ibkr-quant-news\\\/google-colab-a-step-by-step-guide\\\/#primaryimage\"\n\t            },\n\t            \"image\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/ibkr-quant-news\\\/google-colab-a-step-by-step-guide\\\/#primaryimage\"\n\t            },\n\t            \"thumbnailUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2022\\\/11\\\/Cloud-Computing-1.jpg\",\n\t            \"datePublished\": \"2024-08-21T16:28:58+00:00\",\n\t            \"dateModified\": \"2024-08-28T19:13:17+00:00\",\n\t            \"description\": \"Google Colab is an online notebook-like coding environment that is well-suited for machine learning and data analysis.\",\n\t            \"inLanguage\": \"en-US\",\n\t            \"potentialAction\": [\n\t                {\n\t                    \"@type\": \"ReadAction\",\n\t                    \"target\": [\n\t                        \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/ibkr-quant-news\\\/google-colab-a-step-by-step-guide\\\/\"\n\t                    ]\n\t                }\n\t            ]\n\t        },\n\t        {\n\t            \"@type\": \"ImageObject\",\n\t            \"inLanguage\": \"en-US\",\n\t            \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/ibkr-quant-news\\\/google-colab-a-step-by-step-guide\\\/#primaryimage\",\n\t            \"url\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2022\\\/11\\\/Cloud-Computing-1.jpg\",\n\t            \"contentUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2022\\\/11\\\/Cloud-Computing-1.jpg\",\n\t            \"width\": 1000,\n\t            \"height\": 563,\n\t            \"caption\": \"Investment Opportunities in Software and Cloud Computing\"\n\t        },\n\t        {\n\t            \"@type\": \"WebSite\",\n\t            \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#website\",\n\t            \"url\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/\",\n\t            \"name\": \"IBKR Campus US\",\n\t            \"description\": \"Financial Education from Interactive Brokers\",\n\t            \"publisher\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#organization\"\n\t            },\n\t            \"potentialAction\": [\n\t                {\n\t                    \"@type\": \"SearchAction\",\n\t                    \"target\": {\n\t                        \"@type\": \"EntryPoint\",\n\t                        \"urlTemplate\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/?s={search_term_string}\"\n\t                    },\n\t                    \"query-input\": {\n\t                        \"@type\": \"PropertyValueSpecification\",\n\t                        \"valueRequired\": true,\n\t                        \"valueName\": \"search_term_string\"\n\t                    }\n\t                }\n\t            ],\n\t            \"inLanguage\": \"en-US\"\n\t        },\n\t        {\n\t            \"@type\": \"Organization\",\n\t            \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#organization\",\n\t            \"name\": \"Interactive Brokers\",\n\t            \"alternateName\": \"IBKR\",\n\t            \"url\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/\",\n\t            \"logo\": {\n\t                \"@type\": \"ImageObject\",\n\t                \"inLanguage\": \"en-US\",\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#\\\/schema\\\/logo\\\/image\\\/\",\n\t                \"url\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2024\\\/05\\\/ibkr-campus-logo.jpg\",\n\t                \"contentUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2024\\\/05\\\/ibkr-campus-logo.jpg\",\n\t                \"width\": 669,\n\t                \"height\": 669,\n\t                \"caption\": \"Interactive Brokers\"\n\t            },\n\t            \"image\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#\\\/schema\\\/logo\\\/image\\\/\"\n\t            },\n\t            \"publishingPrinciples\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/about-ibkr-campus\\\/\",\n\t            \"ethicsPolicy\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/cyber-security-notice\\\/\"\n\t        },\n\t        {\n\t            \"@type\": \"Person\",\n\t            \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#\\\/schema\\\/person\\\/5ad3608f37f2559612df5ecf6b075f9e\",\n\t            \"name\": \"Igor Radovanovic\",\n\t            \"url\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/author\\\/igor-radovanovic\\\/\"\n\t        }\n\t    ]\n\t}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Google Colab &#8211; A Step-by-step Guide | IBKR Quant","description":"Google Colab is an online notebook-like coding environment that is well-suited for machine learning and data analysis.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.interactivebrokers.com\/campus\/wp-json\/wp\/v2\/posts\/210735\/","og_locale":"en_US","og_type":"article","og_title":"Google Colab - A Step-by-step Guide | IBKR Campus US","og_description":"Google Colab is an online notebook-like coding environment that is well-suited for machine learning and data analysis.","og_url":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/google-colab-a-step-by-step-guide\/","og_site_name":"IBKR Campus US","article_published_time":"2024-08-21T16:28:58+00:00","article_modified_time":"2024-08-28T19:13:17+00:00","og_image":[{"width":1000,"height":563,"url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2022\/11\/Cloud-Computing-1.jpg","type":"image\/jpeg"}],"author":"Igor Radovanovic","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Igor Radovanovic","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"NewsArticle","@id":"https:\/\/ibkrcampus.com\/campus\/ibkr-quant-news\/google-colab-a-step-by-step-guide\/#article","isPartOf":{"@id":"https:\/\/ibkrcampus.com\/campus\/ibkr-quant-news\/google-colab-a-step-by-step-guide\/"},"author":{"name":"Igor Radovanovic","@id":"https:\/\/ibkrcampus.com\/campus\/#\/schema\/person\/5ad3608f37f2559612df5ecf6b075f9e"},"headline":"Google Colab &#8211; A Step-by-step Guide","datePublished":"2024-08-21T16:28:58+00:00","dateModified":"2024-08-28T19:13:17+00:00","mainEntityOfPage":{"@id":"https:\/\/ibkrcampus.com\/campus\/ibkr-quant-news\/google-colab-a-step-by-step-guide\/"},"wordCount":1332,"commentCount":0,"publisher":{"@id":"https:\/\/ibkrcampus.com\/campus\/#organization"},"image":{"@id":"https:\/\/ibkrcampus.com\/campus\/ibkr-quant-news\/google-colab-a-step-by-step-guide\/#primaryimage"},"thumbnailUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2022\/11\/Cloud-Computing-1.jpg","keywords":["Google Colab","Python"],"articleSection":["Data Science","Programming Languages","Python Development","Quant","Quant Development"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/ibkrcampus.com\/campus\/ibkr-quant-news\/google-colab-a-step-by-step-guide\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/ibkrcampus.com\/campus\/ibkr-quant-news\/google-colab-a-step-by-step-guide\/","url":"https:\/\/ibkrcampus.com\/campus\/ibkr-quant-news\/google-colab-a-step-by-step-guide\/","name":"Google Colab - A Step-by-step Guide | IBKR Campus US","isPartOf":{"@id":"https:\/\/ibkrcampus.com\/campus\/#website"},"primaryImageOfPage":{"@id":"https:\/\/ibkrcampus.com\/campus\/ibkr-quant-news\/google-colab-a-step-by-step-guide\/#primaryimage"},"image":{"@id":"https:\/\/ibkrcampus.com\/campus\/ibkr-quant-news\/google-colab-a-step-by-step-guide\/#primaryimage"},"thumbnailUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2022\/11\/Cloud-Computing-1.jpg","datePublished":"2024-08-21T16:28:58+00:00","dateModified":"2024-08-28T19:13:17+00:00","description":"Google Colab is an online notebook-like coding environment that is well-suited for machine learning and data analysis.","inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/ibkrcampus.com\/campus\/ibkr-quant-news\/google-colab-a-step-by-step-guide\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/ibkrcampus.com\/campus\/ibkr-quant-news\/google-colab-a-step-by-step-guide\/#primaryimage","url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2022\/11\/Cloud-Computing-1.jpg","contentUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2022\/11\/Cloud-Computing-1.jpg","width":1000,"height":563,"caption":"Investment Opportunities in Software and Cloud Computing"},{"@type":"WebSite","@id":"https:\/\/ibkrcampus.com\/campus\/#website","url":"https:\/\/ibkrcampus.com\/campus\/","name":"IBKR Campus US","description":"Financial Education from Interactive Brokers","publisher":{"@id":"https:\/\/ibkrcampus.com\/campus\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/ibkrcampus.com\/campus\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/ibkrcampus.com\/campus\/#organization","name":"Interactive Brokers","alternateName":"IBKR","url":"https:\/\/ibkrcampus.com\/campus\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/ibkrcampus.com\/campus\/#\/schema\/logo\/image\/","url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/05\/ibkr-campus-logo.jpg","contentUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/05\/ibkr-campus-logo.jpg","width":669,"height":669,"caption":"Interactive Brokers"},"image":{"@id":"https:\/\/ibkrcampus.com\/campus\/#\/schema\/logo\/image\/"},"publishingPrinciples":"https:\/\/www.interactivebrokers.com\/campus\/about-ibkr-campus\/","ethicsPolicy":"https:\/\/www.interactivebrokers.com\/campus\/cyber-security-notice\/"},{"@type":"Person","@id":"https:\/\/ibkrcampus.com\/campus\/#\/schema\/person\/5ad3608f37f2559612df5ecf6b075f9e","name":"Igor Radovanovic","url":"https:\/\/www.interactivebrokers.com\/campus\/author\/igor-radovanovic\/"}]}},"jetpack_featured_media_url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2022\/11\/Cloud-Computing-1.jpg","_links":{"self":[{"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/posts\/210735","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/users\/815"}],"replies":[{"embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/comments?post=210735"}],"version-history":[{"count":0,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/posts\/210735\/revisions"}],"wp:attachment":[{"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/media?parent=210735"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/categories?post=210735"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/tags?post=210735"},{"taxonomy":"contributors-categories","embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/contributors-categories?post=210735"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}