How to create Panda Dataframe from csv that is compressed in tar.gz?
<p>How can I create the pandas DataFrame from csv file that's compressed in tar.gz? I found this code which does that but with zip file. What should I change in the following code to make it work with tar.gz without downloading the tar.gz and csv file.  </p>

<pre><code>import pandas, requests, zipfile, StringIO
r =requests.get('http://data.octo.dc.gov/feeds/crime_incidents/archive/crime_incidents_2013_CSV.zip')
z = zipfile.ZipFile(StringIO.StringIO(r.content))
df=pandas.read_csv(z.open('sample_CSV.csv'))
</code></pre>

<p>My file is <a href="https://ghtstorage.blob.core.windows.net/downloads/mysql-2016-06-16.tar.gz" rel="nofollow">https://ghtstorage.blob.core.windows.net/downloads/mysql-2016-06-16.tar.gz</a> </p>

<p>Can you try below for extracting tar.gz as below :</p>

<pre><code>import tarfile
tar = tarfile.open(fname, "r:gz")
tar.extractall()
tar.close()
</code></pre>

python csv pandas gzip tar