Skip to content

Commit 9d43386

Browse files
committed
DOC: Add Google Colab data loading section to io guide
1 parent 499c5d4 commit 9d43386

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

doc/source/user_guide/io.rst

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,38 @@ dtype_backend : {"numpy_nullable", "pyarrow"}, defaults to NumPy backed DataFram
167167
dtypes if "pyarrow" is set.
168168

169169
The dtype_backends are still experimental.
170+
.. versionadded:: 2.0
170171

171-
.. versionadded:: 2.0
172+
173+
Google Colab
174+
^^^^^^^^^^^^
175+
176+
Google Colab provides several methods to load data for :func:`read_csv` and similar functions.
177+
178+
File upload
179+
+++++++++++
180+
181+
.. ipython:: python
182+
183+
from google.colab import files
184+
# uploaded = files.upload() # Interactive in Colab
185+
import io
186+
import pandas as pd
187+
# df = pd.read_csv(io.BytesIO(uploaded['example.csv']))
188+
189+
Google Drive
190+
++++++++++++
191+
192+
.. ipython:: python
193+
194+
from google.colab import drive
195+
drive.mount('/content/drive')
196+
df = pd.read_csv('/content/drive/MyDrive/example.csv')
197+
198+
See `Google Colab IO notebook <https://colab.research.google.com/notebooks/io.ipynb>`_.
199+
200+
201+
172202

173203
engine : {``'c'``, ``'python'``, ``'pyarrow'``}
174204
Parser engine to use. The C and pyarrow engines are faster, while the python engine

0 commit comments

Comments
 (0)