title: Pandas read_csv specify AWS Profile
body: <p>Pandas (v1.0.5) use <code>s3fs</code> library to connect with AWS S3 and read data. By default, s3fs uses the credentials found in <code>~/.aws/credentials</code> file in <code>default</code> profile. How do I specify which profile should pandas use while reading a CSV from S3?</p>
  <p>Eg.</p>
  <pre class="lang-py prettyprint-override"><code>s3_path = 's3://mybucket/myfile.csv'
  df = pd.read_csv(s3_path)
  </code></pre>
  <pre class="lang-sh prettyprint-override"><code>$ cat ~/.aws/credentials
  [default]
  aws_access_key_id = ABCD
  aws_secret_access_key = XXXX
  [profile2]
  aws_access_key_id = PQRS
  aws_secret_access_key = YYYY
  [profile3]
  aws_access_key_id = XYZW
  aws_secret_access_key = ZZZZ
  </code></pre>
  <p><strong>Edit :</strong></p>
  <p>Current hack/working solution :</p>
  <pre class="lang-py prettyprint-override"><code>import botocore
  import s3fs
  session = botocore.session.Session(profile='profile2')
  s3 = s3fs.core.S3FileSystem(anon=False, session=session)
  df = pd.read_csv( s3.open(path_to_s3_csv) )
  </code></pre>
  <p>The only issue with above solution is you need to import 2 different libraries and instantiate 2 objects. Keeping the question open to see if there is another cleaner/simple method.</p>