{"id":199437,"date":"2026-02-26T15:07:24","date_gmt":"2026-02-26T14:07:24","guid":{"rendered":"https:\/\/liora.io\/en\/?p=199437"},"modified":"2026-02-26T15:19:07","modified_gmt":"2026-02-26T14:19:07","slug":"python-with-google-colab","status":"publish","type":"post","link":"https:\/\/liora.io\/en\/python-with-google-colab","title":{"rendered":"Python with Google Colab: getting started with a remote team project"},"content":{"rendered":"<p><b>Google Colab is an online Jupyter notebook service that enables you to write and execute Python code directly from your web browser. Accessible for free with a Google account, Colab is perfect for data analysis and data science with Python, thanks to its code cells and text blocks in Markdown syntax, allowing you to structure and annotate your code effectively.<\/b><\/p>\n<p>A notebook created on Colab is saved on Google Drive. Essentially, it&#8217;s a <code>.ipynb<\/code> file that can be downloaded and opened on your local machine using Jupyter Notebook. Conversely, a <code>.ipynb<\/code> file created locally with Jupyter Notebook can be uploaded to Google Drive for editing and execution in Colab, granting access to computational resources like <a href=\"https:\/\/liora.io\/en\/harnessing-the-power-of-gpus-in-data-science-what-you-need-to-know\">GPUs<\/a> <sup>[<a href=\"#GPUTPU\">1<\/a>]<\/sup> and <strong>TPUs <\/strong><sup>[<a href=\"#GPUTPU\">2<\/a>]<\/sup>. For remote team collaboration, a Colab notebook can be shared in the same way a Google Docs document can be. Additionally, this notebook can access files saved in Google Drive, which is particularly useful when working with datasets in .csv format.<\/p>\n<p>But how do you share both the notebooks containing your code and the files containing the data? This is where things become a bit more complex. Fortunately, there are several ways to achieve this!<\/p>\n<p>During their training at <a href=\"https:\/\/liora.io\/\">Liora<\/a>, our students engage in a capstone project designed to apply the skills they have learned through a practical implementation case. This project is conducted in teams of 2, 3, or 4 members, often dispersed geographically. To efficiently initiate this remote collaborative work, our teaching team conducts a masterclass to lay the groundwork and explore various possible solutions. Each team then receives personalized guidance through regular meetings with their mentor.<\/p>\n<p>In this article, we revisit the essential tips for getting started with Google Colab as a team. What tricks and tips do Liora mentors recommend? What cautionary points should you be aware of? In under 7 minutes, you&#8217;ll gain a clear understanding of the 3 recommended scenarios to set everything up.<\/p>\n<p><a href=\"https:\/\/liora.io\/en\/data-courses\"><br \/>\nLearn to use Python on Google Colab<br \/>\n<\/a><\/p>\n<p>\/*! elementor &#8211; v3.15.0 &#8211; 02-08-2023 *\/<br \/>\n.elementor-heading-title{padding:0;margin:0;line-height:1}.elementor-widget-heading .elementor-heading-title[class*=elementor-size-]&gt;a{color:inherit;font-size:inherit;line-height:inherit}.elementor-widget-heading .elementor-heading-title.elementor-size-small{font-size:15px}.elementor-widget-heading .elementor-heading-title.elementor-size-medium{font-size:19px}.elementor-widget-heading .elementor-heading-title.elementor-size-large{font-size:29px}.elementor-widget-heading .elementor-heading-title.elementor-size-xl{font-size:39px}.elementor-widget-heading .elementor-heading-title.elementor-size-xxl{font-size:59px}<\/p>\n<h2>First, create and share your notebook<\/h2>\n<ul>\n<li>From your working folder in Drive, click on \u201c+ New\u201d &gt; More &gt; Google Colaboratory (or \u201cConnect more apps\u201d if it doesn&#8217;t appear in the list) then \u201cCreate\u201d.<\/li>\n<\/ul>\n<p>\/*! elementor &#8211; v3.15.0 &#8211; 02-08-2023 *\/<br \/>\n.elementor-widget-image{text-align:center}.elementor-widget-image a{display:inline-block}.elementor-widget-image a img[src$=&#8221;.svg&#8221;]{width:48px}.elementor-widget-image img{vertical-align:middle;display:inline-block}\t\t\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" width=\"1310\" height=\"628\" src=\"https:\/\/liora.io\/app\/uploads\/sites\/9\/2025\/09\/Collaboration-Share.png\" alt=\"\" loading=\"lazy\"><\/p>\n<ul>\n<li>Alternatively, from the page <a href=\"https:\/\/colab.google\">https:\/\/colab.google<\/a>, click on \u201cNew Notebook\u201d (the file is stored by default in your Drive in a subfolder \u201cColab Notebooks\u201d).<\/li>\n<\/ul>\n<p><iframe title=\"Google Colab - New Notebook\" src=\"https:\/\/player.vimeo.com\/video\/1097471289?dnt=1&amp;app_id=122963\" width=\"500\" height=\"320\" frameborder=\"0\" allow=\"autoplay; fullscreen; picture-in-picture; clipboard-write; encrypted-media; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\"><\/iframe><\/p>\n<ul>\n<li style=\"font-weight: 400\">Rename the file, which is titled <code>Untitled0.ipynb<\/code> by default.<\/li>\n<li style=\"font-weight: 400\">Click on the button<\/li>\n<\/ul>\n<p><img decoding=\"async\" src=\"https:\/\/liora.io\/app\/uploads\/2025\/07\/1.png\"><\/p>\n<p>and provide your teammates with editor access.<\/p>\n<p>\u26a0\ufe0f&nbsp;<b>Warning:<\/b> The notebook can be executed by only one person at a time.<\/p>\n<h2>Scenario 1 with BytesIO and 1 file<\/h2>\n<p>Lucas advises using this method at the start of a project. It allows the same source file to be used by the entire team, stored in any account, and needs only to be made public. Thus, every team member can run the notebook without altering the code cell that loads the dataset.<\/p>\n<p><iframe title=\"Scenario 1\" src=\"https:\/\/player.vimeo.com\/video\/1097792822?dnt=1&amp;app_id=122963\" width=\"500\" height=\"320\" frameborder=\"0\" allow=\"autoplay; fullscreen; picture-in-picture; clipboard-write; encrypted-media; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\"><\/iframe><\/p>\n<pre data-line=\"\">\t\t\t\t<code>\n\t\t\t\t\timport pandas as pd\nfrom io import BytesIO\nimport requests\n# Ceci est uniquement utilis\u00e9 pour vous montrer o\u00f9 obtenir le file_id\noriginal_link = \"https:\/\/drive.google.com\/file\/d\/1fRkXUdfLzTMkscHsAI8_NJuuDptwk02W\/view?usp=drive_link\"\n# ID du fichier (\u00e0 partir du lien partag\u00e9)  (LE FICHIER DOIT \u00caTRE PUBLIC)\nfile_id = \"1fRkXUdfLzTMkscHsAI8_NJuuDptwk02W\"\n# T\u00e9l\u00e9charger un fichier CSV depuis Google Drive\ndownload_url = f\"https:\/\/drive.google.com\/uc?id={file_id}\"\nresponse = requests.get(download_url)\ndata = BytesIO(response.content)\n# Charger le fichier CSV dans un DataFrame\ndf = pd.read_csv(data)\ndf.head()\n\t\t\t\t<\/code>\n<\/pre>\n<p>?&nbsp;<b>To learn more:<\/b> Check out the documentation at <a href=\"https:\/\/docs.python.org\/3\/library\/io.html\">https:\/\/docs.python.org\/3\/library\/io.html<\/a>.<\/p>\n<h2>Scenario 2 with gdown (Google Drive Public File Downloader) and 1 or multiple files<\/h2>\n<p>Alia often recommends this method to her students. The gdown library is specifically designed to import files from Google Drive. Again, with this approach, the source file stored on Drive must be public. Tip: the parameter \u201cquiet = True\u201d suppresses the progress output during the download, making it less verbose.<\/p>\n<p><iframe title=\"Scenario 2\" src=\"https:\/\/player.vimeo.com\/video\/1097792790?dnt=1&amp;app_id=122963\" width=\"500\" height=\"320\" frameborder=\"0\" allow=\"autoplay; fullscreen; picture-in-picture; clipboard-write; encrypted-media; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\"><\/iframe><\/p>\n<pre data-line=\"\">\t\t\t\t<code>\n\t\t\t\t\t# import de packages\nimport subprocess\nimport sys\nimport pandas as pd\n# Ce code permet de s'assurer que gdown est bien install\u00e9. \n# Si ce n'est pas le cas, il l'installe automatiquement. \n# Cela \u00e9vite des erreurs au moment de l'utiliser, surtout sur Colab o\u00f9 certaines biblioth\u00e8ques ne sont pas d\u00e9j\u00e0 pr\u00e9sentes.\ntry:\n    import gdown\nexcept ImportError:\n    # Si gdown n'est pas install\u00e9, l'importer en utilisant pip\n    subprocess.check_call([sys.executable, \"-m\", \"pip\", \"install\", \"gdown\"])\n# Remplacez l'ID par le v\u00f4tre (tout ce qui se trouve entre \/d\/ et \/view)\n# Par exemple avec https:\/\/drive.google.com\/file\/d\/1ptwmJbk8ToMt4BvQeG5ni37IeNAOoAsb\/view?usp=drive_link\nfile_id = '1ptwmJbk8ToMt4BvQeG5ni37IeNAOoAsb' # Remplacer par un fichier plus l\u00e9ger!\nurl= f'https:\/\/drive.google.com\/uc?id={file_id}'\n# T\u00e9l\u00e9chargement du fichier csv\ngdown.download(url, 'your_file_name.csv', quiet=True)\n# Chargement du fichier csv dans un dataframe\ndf = pd.read_csv('your_file_name.csv')\ndf.head()\n\t\t\t\t<\/code>\n<\/pre>\n<p>?\ufe0f Do you have multiple files to import? gdown also allows you to import a Drive folder and its contents in bulk before opening the dataset(s) you need.<\/p>\n<p><iframe title=\"Scenario 2 - Folder\" src=\"https:\/\/player.vimeo.com\/video\/1097792752?dnt=1&amp;app_id=122963\" width=\"500\" height=\"320\" frameborder=\"0\" allow=\"autoplay; fullscreen; picture-in-picture; clipboard-write; encrypted-media; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\"><\/iframe><\/p>\n<pre data-line=\"\">\t\t\t\t<code>\n\t\t\t\t\timport gdown\nurl = \"https:\/\/drive.google.com\/drive\/folders\/1HWFHKCprFzR7H7TYhrE-W7v4bz2Vc7Ia\"\ngdown.download_folder(url, quiet=True, use_cookies=False)\n\t\t\t\t<\/code>\n<\/pre>\n<p>The output then lists the paths of each file in the folder:<\/p>\n<pre data-line=\"\">\t\t\t\t<code>\n\t\t\t\t\tOutput\n['\/content\/ihpperson_data_with_rules\/special_general.csv',\n '\/content\/ihpperson_data_with_rules\/remain_person.csv',\n '\/content\/ihpperson_data_with_rules\/general.csv',\n '\/content\/ihpperson_data_with_rules\/eunuch.csv',\n '\/content\/ihpperson_data_with_rules\/civil_servant.csv']\n\t\t\t\t<\/code>\n<\/pre>\n<p>Then we open the desired file with Pandas:<\/p>\n<pre data-line=\"\">\t\t\t\t<code>\n\t\t\t\t\t# Nous ouvrons le premier fichier avec pandas et v\u00e9rifions les premi\u00e8res lignes\nimport pandas as pd\ndf = pd.read_csv('\/content\/ihpperson_data_with_rules\/special_general.csv')\ndf.head()\n\t\t\t\t<\/code>\n<\/pre>\n<p>?&nbsp;<b>To learn more:<\/b> The documentation is available at https:\/\/pypi.org\/project\/gdown, and our script follows the demo proposed by Google Colab on the page <a href=\"https:\/\/colab.research.google.com\/github\/intodeeplearning\/blog\/blob\/master\/_notebooks\/2022-05-08-how-to-download-files-in-gdrive-using-python.ipynb#scrollTo=I4vv49erlMC3\">https:\/\/colab.research.google.com\/github\/intodeeplearning\/blog\/blob\/master\/_notebooks\/2022-05-08-how-to-download-files-in-gdrive-using-python.ipynb#scrollTo=I4vv49erlMC3<\/a><\/p>\n<h2>Scenario 3 with a Drive shortcut for private files<\/h2>\n<p>Do you need to keep your source files private? You can share a notebook with your team, allowing each member to run it in turns to analyze a dataset shared exclusively with other members. The following procedure aims to standardize the file path so every team member can execute the same import cell for the datasets at the beginning of the notebook.<\/p>\n<p>Let&#8217;s see what this looks like for users <b>A<\/b>, <b>B<\/b>, and <b>C<\/b>.<\/p>\n<p><b>A<\/b> places the dataset data.csv in a &#8220;Data&#8221; folder created at the root of their Drive, with the full path as follows:<\/p>\n<pre data-line=\"\">\t\t\t\t<code>\n\t\t\t\t\tpython '\/content\/drive\/My Drive\/Data\/dataset.csv' \n\t\t\t\t<\/code>\n<\/pre>\n<p><b>A<\/b> shares the &#8220;Data&#8221; folder with their teammates <b>B<\/b> and <b>C<\/b>.<\/p>\n<p><img decoding=\"async\" width=\"960\" height=\"540\" src=\"https:\/\/liora.io\/app\/uploads\/sites\/9\/2025\/09\/2.png\" alt=\"\" loading=\"lazy\"><\/p>\n<p><b>B<\/b> and <b>C<\/b>, in turn, will find &#8220;Data&#8221; among their shared folders, create a shortcut to &#8220;Data&#8221; (by right-clicking), and place it at the root of their Drives (each in &#8220;My Drive&#8221;).<\/p>\n<p><img decoding=\"async\" width=\"960\" height=\"540\" src=\"https:\/\/liora.io\/app\/uploads\/sites\/9\/2025\/09\/3.png\" alt=\"\" loading=\"lazy\"><br \/>\n<img decoding=\"async\" width=\"960\" height=\"540\" src=\"https:\/\/liora.io\/app\/uploads\/sites\/9\/2025\/09\/4.png\" alt=\"\" loading=\"lazy\"><br \/>\n<img decoding=\"async\" width=\"960\" height=\"540\" src=\"https:\/\/liora.io\/app\/uploads\/sites\/9\/2025\/09\/5.png\" alt=\"\" loading=\"lazy\"><\/p>\n<p>They can then use the same path as <b>A<\/b>:<\/p>\n<pre data-line=\"\">\t\t\t\t<code>\n\t\t\t\t\tpython '\/content\/drive\/My Drive\/Data\/dataset.csv' \n\t\t\t\t<\/code>\n<\/pre>\n<p>The notebook will therefore include a code cell to connect Colab to Drive (each student taking turns must connect the notebook to their Drive):<\/p>\n<pre data-line=\"\">\t\t\t\t<code>\n\t\t\t\t\tfrom google.colab import drive\ndrive.mount('\/content\/drive')\n\t\t\t\t<\/code>\n<\/pre>\n<p>Then the following cell, to be executed to activate the path to the file:<\/p>\n<pre data-line=\"\">\t\t\t\t<code>\n\t\t\t\t\t# File path for A, B, C\nimport pandas as pd\npathA='\/content\/drive\/My Drive\/Data\/dataset.csv'\ndf = pd.read_csv(pathA)\n\t\t\t\t<\/code>\n<\/pre>\n<h2>In summary<\/h2>\n<ul>\n<li style=\"font-weight: 400\">At the start of a capstone project, during the open data exploration phase (public data), BytesIO offers the simplest syntax.<\/li>\n<li style=\"font-weight: 400\">During the project, gdown provides a more effective solution for cleaning, combining, and transforming data from multiple files in the same folder.<\/li>\n<li style=\"font-weight: 400\">If datasets need to remain private, the solution is to organize the sharing of a single folder containing all datasets, with an identical shortcut for all other members, enabling a common access path in Colab.<\/li>\n<\/ul>\n<p><a href=\"https:\/\/liora.io\/en\/data-courses\"><br \/>\nGet trained in Python<br \/>\n<\/a><\/p>\n<p>\/*! elementor &#8211; v3.15.0 &#8211; 02-08-2023 *\/<br \/>\nbody.elementor-page .elementor-widget-menu-anchor{margin-bottom:0}<\/p>\n<h2>To explore further<\/h2>\n<ul>\n<li style=\"font-weight: 400\">Google Colab: <a href=\"https:\/\/colab.google\/\">https:\/\/colab.google\/<\/a><\/li>\n<li>Introductory video to Google Colab (3 minutes): <a href=\"https:\/\/www.youtube.com\/watch?v=inN8seMm7UI&amp;ab_channel=TensorFlow\">https:\/\/www.youtube.com\/watch?v=inN8seMm7UI&amp;ab_channel=TensorFlow<\/a><\/li>\n<\/ul>\n<p>[1]: Graphic Processing Unit<\/p>\n<p>[2]: Tensor Processing Unit<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Google Colab is an online Jupyter notebook service that enables you to write and execute Python code directly from your web browser. Accessible for free with a Google account, Colab is perfect for data analysis and data science with Python, thanks to its code cells and text blocks in Markdown syntax, allowing you to structure [&hellip;]<\/p>\n","protected":false},"author":47,"featured_media":208135,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"editor_notices":[],"footnotes":""},"categories":[46],"class_list":["post-199437","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-unassigned"],"acf":[],"_links":{"self":[{"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/posts\/199437","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/users\/47"}],"replies":[{"embeddable":true,"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/comments?post=199437"}],"version-history":[{"count":5,"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/posts\/199437\/revisions"}],"predecessor-version":[{"id":208136,"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/posts\/199437\/revisions\/208136"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/media\/208135"}],"wp:attachment":[{"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/media?parent=199437"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/categories?post=199437"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}