From e4ad3f480fe90fd61006511a7fb9ed584472c9d0 Mon Sep 17 00:00:00 2001 From: Atharv Navatre Date: Sat, 13 Dec 2025 21:53:08 +0530 Subject: [PATCH 1/3] DOC: add Google Colab data loading section --- doc/source/user_guide/io.rst | 42 ++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/doc/source/user_guide/io.rst b/doc/source/user_guide/io.rst index 070ad0bbe22ed..11d50d832f4f3 100644 --- a/doc/source/user_guide/io.rst +++ b/doc/source/user_guide/io.rst @@ -6520,3 +6520,45 @@ The files ``test.pkl.compress``, ``test.parquet`` and ``test.feather`` took the 24009288 Oct 10 06:43 test_fixed_compress.hdf 24458940 Oct 10 06:44 test_table.hdf 24458940 Oct 10 06:44 test_table_compress.hdf + +Loading data in Google Colab +''''''''''''''''''''''''''' + +Google Colab is a hosted Jupyter notebook environment. Since it runs remotely, +files must be explicitly uploaded or mounted before they can be read by pandas. + +Uploading local files +~~~~~~~~~~~~~~~~~~~~~ + +Files can be uploaded directly to the Colab runtime using ``google.colab.files``: + +.. code-block:: python + + from google.colab import files + uploaded = files.upload() + + import pandas as pd + df = pd.read_csv("data.csv") + +Using Google Drive +~~~~~~~~~~~~~~~~~~ + +Google Drive can be mounted to make files available to the runtime: + +.. code-block:: python + + from google.colab import drive + drive.mount("/content/drive") + + import pandas as pd + df = pd.read_csv("/content/drive/MyDrive/data.csv") + +Loading data from a URL +~~~~~~~~~~~~~~~~~~~~~~ + +Data hosted remotely can be read directly using a URL: + +.. code-block:: python + + import pandas as pd + df = pd.read_csv("https://example.com/data.csv") From 395dc7b75ab9b30173c7d6f14250ab80b6807c6f Mon Sep 17 00:00:00 2001 From: Atharv Navatre Date: Sat, 13 Dec 2025 23:32:05 +0530 Subject: [PATCH 2/3] DOC: replace placeholder URL with real dataset --- doc/source/user_guide/io.rst | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/doc/source/user_guide/io.rst b/doc/source/user_guide/io.rst index 11d50d832f4f3..1538762d8a0b3 100644 --- a/doc/source/user_guide/io.rst +++ b/doc/source/user_guide/io.rst @@ -6521,8 +6521,9 @@ The files ``test.pkl.compress``, ``test.parquet`` and ``test.feather`` took the 24458940 Oct 10 06:44 test_table.hdf 24458940 Oct 10 06:44 test_table_compress.hdf -Loading data in Google Colab -''''''''''''''''''''''''''' +Loading data in Google Colab notebooks +''''''''''''''''''''''''''''''''''''''' + Google Colab is a hosted Jupyter notebook environment. Since it runs remotely, files must be explicitly uploaded or mounted before they can be read by pandas. @@ -6540,6 +6541,7 @@ Files can be uploaded directly to the Colab runtime using ``google.colab.files`` import pandas as pd df = pd.read_csv("data.csv") + Using Google Drive ~~~~~~~~~~~~~~~~~~ @@ -6561,4 +6563,5 @@ Data hosted remotely can be read directly using a URL: .. code-block:: python import pandas as pd - df = pd.read_csv("https://example.com/data.csv") + df = pd.read_csv("https://raw.githubusercontent.com/pandas-dev/pandas/main/doc/data/air_quality_no2.csv") + From 8f83f03403151990609289a0f2a9bdf4b198a0f4 Mon Sep 17 00:00:00 2001 From: Atharv Navatre Date: Sat, 13 Dec 2025 23:54:33 +0530 Subject: [PATCH 3/3] DOC: fix end-of-file newline --- doc/source/user_guide/io.rst | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/doc/source/user_guide/io.rst b/doc/source/user_guide/io.rst index 1538762d8a0b3..00a397559b140 100644 --- a/doc/source/user_guide/io.rst +++ b/doc/source/user_guide/io.rst @@ -6563,5 +6563,4 @@ Data hosted remotely can be read directly using a URL: .. code-block:: python import pandas as pd - df = pd.read_csv("https://raw.githubusercontent.com/pandas-dev/pandas/main/doc/data/air_quality_no2.csv") - + df = pd.read_csv("https://raw.githubusercontent.com/pandas-dev/pandas/main/doc/data/air_quality_no2.csv") \ No newline at end of file