<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How can i save a parquet file using pandas with a data factory orchestrated notebook? in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/how-can-i-save-a-parquet-file-using-pandas-with-a-data-factory/m-p/26568#M18601</link>
    <description>&lt;P&gt;Hi guys,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this is my first question, feel free to correct me if i'm doing something wrong.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyway, i'm facing a really strange problem, i have a notebook in which i'm performing some pandas analysis, after that i save the resulting dataframe in a parquet file, and everything is working fine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But the music change when i run the notebook using azure data factory.&lt;/P&gt;&lt;P&gt;Basically, the saved file is empty, 0 byte contained in it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is the function that i'm using to save the file:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;def save_file(obj, filename, kind="csv"):
    # Backing up
    outdir = '/dbfs/FileStore/'
    outname = outdir+filename+'.'+kind
    if kind=="csv":
        obj.to_csv(outname, index=False, encoding="utf-8")
    elif kind=="xlsx":
        obj.to_excel(outname, index=False)  # encoding="utf-8"
    elif kind=="parquet":
        obj.to_parquet(outname)
    elif kind=="pkl":
        pass  # Not Implemented
    print(filename, " saved")
    return&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;One more note that may be useful;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;even the "normal execution", without azure data factory, saves the file empty, but if i display the pandas data frame before the saving, it work correctly. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is weird.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 19 Oct 2022 12:38:26 GMT</pubDate>
    <dc:creator>ricperelli</dc:creator>
    <dc:date>2022-10-19T12:38:26Z</dc:date>
    <item>
      <title>How can i save a parquet file using pandas with a data factory orchestrated notebook?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-can-i-save-a-parquet-file-using-pandas-with-a-data-factory/m-p/26568#M18601</link>
      <description>&lt;P&gt;Hi guys,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this is my first question, feel free to correct me if i'm doing something wrong.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyway, i'm facing a really strange problem, i have a notebook in which i'm performing some pandas analysis, after that i save the resulting dataframe in a parquet file, and everything is working fine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But the music change when i run the notebook using azure data factory.&lt;/P&gt;&lt;P&gt;Basically, the saved file is empty, 0 byte contained in it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is the function that i'm using to save the file:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;def save_file(obj, filename, kind="csv"):
    # Backing up
    outdir = '/dbfs/FileStore/'
    outname = outdir+filename+'.'+kind
    if kind=="csv":
        obj.to_csv(outname, index=False, encoding="utf-8")
    elif kind=="xlsx":
        obj.to_excel(outname, index=False)  # encoding="utf-8"
    elif kind=="parquet":
        obj.to_parquet(outname)
    elif kind=="pkl":
        pass  # Not Implemented
    print(filename, " saved")
    return&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;One more note that may be useful;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;even the "normal execution", without azure data factory, saves the file empty, but if i display the pandas data frame before the saving, it work correctly. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is weird.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Oct 2022 12:38:26 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-can-i-save-a-parquet-file-using-pandas-with-a-data-factory/m-p/26568#M18601</guid>
      <dc:creator>ricperelli</dc:creator>
      <dc:date>2022-10-19T12:38:26Z</dc:date>
    </item>
  </channel>
</rss>

