Skip to content

Commit 6551a42

Browse files
committed
📝 Add docs for accessing files from S3.
Add some documetnation about accessing files from a remote S3 bucket in pandas. pandas-dev#12206
1 parent 011b79f commit 6551a42

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

doc/source/cookbook.rst

+25
Original file line numberDiff line numberDiff line change
@@ -1370,3 +1370,28 @@ of the data values:
13701370
'weight': [100, 140, 180],
13711371
'sex': ['Male', 'Female']})
13721372
df
1373+
1374+
1375+
Load a file from S3
1376+
-------------------
1377+
1378+
Pandas support loading files from a S3 bucket for remote file interactivity.
1379+
You will be required to install the S3Fs_ library.
1380+
1381+
.. code-block:: python
1382+
1383+
df = pd.read_csv('s3://baseballdatabank/core/Parks.csv')
1384+
df.head(1)
1385+
1386+
If your S3 bucket requires cedentials you will need to set them as environment
1387+
variables or in the ``~/.aws/credentials`` config file, refer to the `S3Fs
1388+
documentation on credentials
1389+
<https://s3fs.readthedocs.io/en/latest/#credentials>`_.
1390+
1391+
.. code-block:: shell
1392+
1393+
export AWS_ACCESS_KEY_ID = ''
1394+
export AWS_SECRET_ACCESS_KEY = ''
1395+
export AWS_SESSION_TOKEN = ''
1396+
1397+
.. _S3Fs: https://pypi.org/project/s3fs/

0 commit comments

Comments
 (0)