OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

How to Save DataFrame to Excel file using filedialog as SaveAs-Dialog in Python?

  • Thread starter Thread starter kanwarprogrammer
  • Start date Start date
K

kanwarprogrammer

Guest
How can we write DataFrame object of Pandas using filedialog in Python TKinter?

Code:
file = filedialog.asksaveasfile(mode='w', defaultextension=".xlsx")
data.to_excel(file)

Whenever I try to write it it gives me error.

Code:
stat: path should be string, bytes, os.PathLike or integer, not _io.TextIOWrapper

I have been searching this error for hours, but the solutions are not working.
<p>How can we write <code>DataFrame</code> object of <code>Pandas</code> using <code>filedialog</code> in Python TKinter?</p>
<pre><code>file = filedialog.asksaveasfile(mode='w', defaultextension=".xlsx")
data.to_excel(file)
</code></pre>
<p>Whenever I try to write it it gives me error.</p>
<pre><code>stat: path should be string, bytes, os.PathLike or integer, not _io.TextIOWrapper
</code></pre>
<p>I have been searching this error for hours, but the solutions are not working.</p>
 

Latest posts

J
Replies
0
Views
1
Jeff P Chacko
J
Top