title: Tkinter file directory to save output
body: <p>I have these functions that prompt user to load csv file via a GUI (Tkinter) to perform basic statistics and correlation matrix. The out is saved on a working directory.
  I dont want to specify the directory in the code but that the user will be able to choose a directory if choice. I want to modify this code to change the static directory and give some flexibility for the user to select where to save it. Please help. New to python</p>
  <pre><code>import tkinter as tk
  from tkinter import filedialog
  import pandas as pd
  from pandas import DataFrame
  import matplotlib.pyplot as plt
  from sklearn.cluster import KMeans
  import statsmodels.api as sm
  from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
  
  root= tk.Tk()
  canvas1 = tk.Canvas(root, width = 600, height = 500,  relief = 'raised')
  canvas1.pack()
  
  label1 = tk.Label(root, text='EDA')
  label1.config(font=('helvetica', 14))
  canvas1.create_window(200, 25, window=label1)
  
  label2 = tk.Label(root, text='Number of Clusters:')
  label2.config(font=('helvetica', 8))
  canvas1.create_window(200, 120, window=label2)
  
  entry1 = tk.Entry (root) 
  canvas1.create_window(200, 140, window=entry1)
  </code></pre>
  <p>def getExcel ():</p>
  <pre><code>global df
  import_file_path = filedialog.askopenfilename()
  date_cols = ['TimeStamp']
  df = pd.read_csv (import_file_path, parse_dates = date_cols, index_col = 'TimeStamp') 
     
  
  
  browseButtonExcel = tk.Button(text=&quot; Import Excel File (CSV) &quot;, command=getExcel, bg='green',  fg='white', font=('helvetica', 10, 'bold'))
  canvas1.create_window(200, 70, window=browseButtonExcel)
  
  def descriptiv(): #def descriptiv(self, df, path, filename):
      stats = df.describe([.01,.1,.9,.99]).T
      stats['variance'] = df.var()
      stats['pct missing'] = df.isna().mean().round(4) * 100 
      #folder_path = filedialog.askdirectory() # I want to be able to use this to prompt the user to select a directory to save the file
      return stats.to_csv('C:/Users/chall/Desktop/work/descriptive.csv') # I want to change this so user can decide where to save the output
  
  def correl():
      matri = df.corr(method = 'pearson').to_csv('C:/Users/chall/Desktop/work/correlation.csv') #same problem here.
      return matri
  
  processButton2 = tk.Button(text=' Descriptive Statistics',  command= descriptiv, bg='brown', fg='white', font=('helvetica', 10, 'bold'))
  canvas1.create_window(200, 200, window=processButton2)  
  
  processButton3 = tk.Button(text=' Correlation Matrix',  command= correl, bg='brown', fg='white', font=('helvetica', 10, 'bold'))
  canvas1.create_window(200, 230, window=processButton3)
  
  root.mainloop()
  </code></pre>