title: How to write pandas dataframe into Databricks dbfs/FileStore?
body: <p><a href="https://i.stack.imgur.com/Waxvu.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Waxvu.png" alt="enter image description here"></a><a href="https://i.stack.imgur.com/YSh53.png" rel="noreferrer"><img src="https://i.stack.imgur.com/YSh53.png" alt="enter image description here"></a>I'm new to the Databricks, need help in writing a pandas dataframe into databricks local file system. </p>
  
  <p>I did search in google but could not find any case similar to this, also tried the help guid provided by databricks (attached) but that did not work either. Attempted the below changes to find my luck, the commands goes just fine, but the file is not getting written in the directory (expected wrtdftodbfs.txt file gets created)</p>
  
  <ol>
  <li><code>df.to_csv("/dbfs/FileStore/NJ/wrtdftodbfs.txt")</code></li>
  </ol>
  
  <p>Result: throws the below error</p>
  
  <blockquote>
    <p>FileNotFoundError: [Errno 2] No such file or directory:
    '/dbfs/FileStore/NJ/wrtdftodbfs.txt'</p>
  </blockquote>
  
  <ol start="2">
  <li><code>df.to_csv("\\dbfs\\FileStore\\NJ\\wrtdftodbfs.txt")</code></li>
  </ol>
  
  <p>Result: No errors, but nothing written either</p>
  
  <ol start="3">
  <li><code>df.to_csv("dbfs\\FileStore\\NJ\\wrtdftodbfs.txt")</code></li>
  </ol>
  
  <p>Result: No errors, but nothing written either</p>
  
  <ol start="4">
  <li><code>df.to_csv(path ="\\dbfs\\FileStore\\NJ\\",file="wrtdftodbfs.txt")</code></li>
  </ol>
  
  <blockquote>
    <p>Result: TypeError: to_csv() got an unexpected keyword argument 'path'</p>
  </blockquote>
  
  <ol start="5">
  <li><code>df.to_csv("dbfs:\\FileStore\\NJ\\wrtdftodbfs.txt")</code></li>
  </ol>
  
  <p>Result: No errors, but nothing written either</p>
  
  <ol start="6">
  <li><code>df.to_csv("dbfs:\\dbfs\\FileStore\\NJ\\wrtdftodbfs.txt")</code></li>
  </ol>
  
  <p>Result: No errors, but nothing written either</p>
  
  <p>The directory exists and the files created manually shows up but pandas to_csv never writes nor error out.</p>
  
  <pre><code>dbutils.fs.put("/dbfs/FileStore/NJ/tst.txt","Testing file creation and existence")
  
  dbutils.fs.ls("dbfs/FileStore/NJ")
  </code></pre>
  
  <blockquote>
    <p>Out[186]: [FileInfo(path='dbfs:/dbfs/FileStore/NJ/tst.txt',
    name='tst.txt', size=35)]</p>
  </blockquote>
  
  <p>Appreciate your time and pardon me if the enclosed details are not clear enough.</p>