How to download my file from HDInsight cluster that is saved from pd.to_csv()
<p>I have a HDInsight cluster running Spark 1.6.2 &amp; Jupyter
In a jupyter notebook I run my pyspark commands and some of the output is processed in pandas dataframe.</p>

<p>As the last step I would like to save out my pandas dataframe to a csv file and either:</p>

<ol>
<li>save it to the 'jupyter filesystem' and download it to my laptop</li>
<li>save it to my blob storage</li>
</ol>

<p>But I have no clue how to do that.</p>

<p>I tried the following for:</p>

<p><strong>1. save it to the 'jupyter filesystem' and download it to my laptop</strong></p>

<pre><code># df is my resulting dataframe, so I save it to the filesystem where jupyter runs
df.to_csv('app_keys.txt')
</code></pre>

<p>I was expecting it to save in the same directory as my notebook and thus to see it in the tree view in the browser. This is not the case. So my question is: <strong>Where is this file saved on the filesystem?</strong></p>

<p><strong>2. save it to my blob storage</strong>
After googling it seems I could also upload the file to blob storage using the azure.storage.blob module. So I tried:</p>

<pre><code>from azure.storage.blob import BlobService # a lot of examples online import BlockBlobService but this one is not available in HDInsight

# i have all variables in CAPITALS provided in the code
blob_service=BlobService(account_name=STORAGEACCOUNTNAME,account_key=STORAGEACCOUNTKEY)

# check if reading from blob works
blob_service.get_blob_to_path(CONTAINERNAME, 'iris.txt', 'mylocalfile.txt') # this works

# now try to reverse the process and write to blob
blob_service.create_blob_from_path(CONTAINERNAME,'myblobfile.txt','mylocalfile.txt')   # fails with AttributeError: 'BlobService' object has no attribute 'create_blob_from_path'
</code></pre>

<p>or </p>

<pre><code>blob_service.create_blob_from_text(CONTAINERNAME,'myblobfile.txt','mylocalfile.txt') # fails with 'BlobService' object has no attribute 'create_blob_from_text'
</code></pre>

<p>So I have no clue how I can write back and access the stuff I write out from my pandas to the filesystem.</p>

<p>Any help is apprciated</p>

<p>Per my experience, the second question that you encountered is due to the version of the azure storage client library for python.
For the old version, the  library  doesn't include the method which you invoked in your code. The following URL is useful for you.</p>

<p><a href="http://stackoverflow.com/questions/35558463/how-to-import-azure-blobservice-in-python">How to import Azure BlobService in python?</a>.</p>

python azure pandas azure-storage-blobs