Skip to content

Commit 0e480ad

Browse files
DOC: place Colab section correctly under remote files
1 parent e261bd0 commit 0e480ad

File tree

1 file changed

+48
-48
lines changed

1 file changed

+48
-48
lines changed

doc/source/user_guide/io.rst

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1613,6 +1613,53 @@ a permanent store.
16131613
.. _fsimpl1: https://filesystem-spec.readthedocs.io/en/latest/api.html#built-in-implementations
16141614
.. _fsimpl2: https://filesystem-spec.readthedocs.io/en/latest/api.html#other-known-implementations
16151615

1616+
Loading data in Google Colab notebooks
1617+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1618+
1619+
Google Colab is a hosted Jupyter notebook environment. Since it runs remotely,
1620+
files must be explicitly uploaded or mounted before they can be read by pandas.
1621+
1622+
Uploading local files
1623+
^^^^^^^^^^^^^^^^^^^^^
1624+
1625+
Files can be uploaded directly to the Colab runtime using ``google.colab.files``:
1626+
1627+
.. code-block:: python
1628+
1629+
from google.colab import files
1630+
uploaded = files.upload()
1631+
1632+
import pandas as pd
1633+
df = pd.read_csv("data.csv")
1634+
1635+
Using Google Drive
1636+
^^^^^^^^^^^^^^^^^
1637+
1638+
Google Drive can be mounted to make files available to the runtime:
1639+
1640+
.. code-block:: python
1641+
1642+
from google.colab import drive
1643+
drive.mount("/content/drive")
1644+
1645+
import pandas as pd
1646+
df = pd.read_csv("/content/drive/MyDrive/data.csv")
1647+
1648+
Loading data from a URL
1649+
^^^^^^^^^^^^^^^^^^^^^^
1650+
1651+
Data hosted remotely can be read directly using a URL:
1652+
1653+
.. code-block:: python
1654+
1655+
import pandas as pd
1656+
1657+
url = (
1658+
"https://raw.githubusercontent.com/pandas-dev/pandas/main/"
1659+
"doc/data/air_quality_no2.csv"
1660+
)
1661+
df = pd.read_csv(url)
1662+
16161663
Writing out data
16171664
''''''''''''''''
16181665

@@ -6519,51 +6566,4 @@ The files ``test.pkl.compress``, ``test.parquet`` and ``test.feather`` took the
65196566
24009288 Oct 10 06:43 test_fixed.hdf
65206567
24009288 Oct 10 06:43 test_fixed_compress.hdf
65216568
24458940 Oct 10 06:44 test_table.hdf
6522-
24458940 Oct 10 06:44 test_table_compress.hdf
6523-
6524-
Loading data in Google Colab notebooks
6525-
'''''''''''''''''''''''''''''''''''''''
6526-
6527-
Google Colab is a hosted Jupyter notebook environment. Since it runs remotely,
6528-
files must be explicitly uploaded or mounted before they can be read by pandas.
6529-
6530-
Uploading local files
6531-
~~~~~~~~~~~~~~~~~~~~~
6532-
6533-
Files can be uploaded directly to the Colab runtime using ``google.colab.files``:
6534-
6535-
.. code-block:: python
6536-
6537-
from google.colab import files
6538-
uploaded = files.upload()
6539-
6540-
import pandas as pd
6541-
df = pd.read_csv("data.csv")
6542-
6543-
Using Google Drive
6544-
~~~~~~~~~~~~~~~~~
6545-
6546-
Google Drive can be mounted to make files available to the runtime:
6547-
6548-
.. code-block:: python
6549-
6550-
from google.colab import drive
6551-
drive.mount("/content/drive")
6552-
6553-
import pandas as pd
6554-
df = pd.read_csv("/content/drive/MyDrive/data.csv")
6555-
6556-
Loading data from a URL
6557-
~~~~~~~~~~~~~~~~~~~~~~
6558-
6559-
Data hosted remotely can be read directly using a URL:
6560-
6561-
.. code-block:: python
6562-
6563-
import pandas as pd
6564-
6565-
url = (
6566-
"https://raw.githubusercontent.com/pandas-dev/pandas/main/"
6567-
"doc/data/air_quality_no2.csv"
6568-
)
6569-
df = pd.read_csv(url)
6569+
24458940 Oct 10 06:44 test_table_compress.hdf

0 commit comments

Comments
 (0)