From e4ad3f480fe90fd61006511a7fb9ed584472c9d0 Mon Sep 17 00:00:00 2001 From: Atharv Navatre Date: Sat, 13 Dec 2025 21:53:08 +0530 Subject: [PATCH 1/5] 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/5] 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/5] 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 From d93e43c943976b714a2bd0761743c40e024ad50f Mon Sep 17 00:00:00 2001 From: Atharv Navatre Date: Sun, 14 Dec 2025 00:13:08 +0530 Subject: [PATCH 4/5] DOC: normalize line endings and EOF --- doc/source/user_guide/io.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/user_guide/io.rst b/doc/source/user_guide/io.rst index 00a397559b140..25ce6fd1069b5 100644 --- a/doc/source/user_guide/io.rst +++ b/doc/source/user_guide/io.rst @@ -6563,4 +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") \ No newline at end of file + df = pd.read_csv("https://raw.githubusercontent.com/pandas-dev/pandas/main/doc/data/air_quality_no2.csv") From e261bd0d682f2b5cdaa6203943cc657580e2ceb2 Mon Sep 17 00:00:00 2001 From: Atharv Navatre Date: Sun, 14 Dec 2025 00:48:21 +0530 Subject: [PATCH 5/5] DOC: fix section heading hierarchy for Colab docs --- doc/source/user_guide/io.rst | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/doc/source/user_guide/io.rst b/doc/source/user_guide/io.rst index 25ce6fd1069b5..783e40979f8ec 100644 --- a/doc/source/user_guide/io.rst +++ b/doc/source/user_guide/io.rst @@ -6524,7 +6524,6 @@ The files ``test.pkl.compress``, ``test.parquet`` and ``test.feather`` took the 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. @@ -6541,9 +6540,8 @@ 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 -~~~~~~~~~~~~~~~~~~ +~~~~~~~~~~~~~~~~~ Google Drive can be mounted to make files available to the runtime: @@ -6563,4 +6561,9 @@ 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") + + url = ( + "https://raw.githubusercontent.com/pandas-dev/pandas/main/" + "doc/data/air_quality_no2.csv" + ) + df = pd.read_csv(url)