Last active
January 21, 2020 10:52
-
-
Save rohitrajiit/242834101d0acb60451b2775d142e6b8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas | |
import tkinter as tk | |
from tkinter import filedialog | |
import os | |
def analysis(): | |
path = filedialog.askopenfilename() | |
data = pandas.read_excel(path) | |
groups = data.groupby('Group') | |
table = groups.agg({'Revenue':sum, 'Group': len}) | |
savename = filedialog.asksaveasfilename() | |
savename = savename.split('.')[0] + '.csv' | |
table.to_csv(savename) | |
if __name__ == "__main__": | |
window = tk.Tk() | |
window.title('Analysis') | |
window.geometry("200x150") | |
frame = tk.Frame(window) | |
frame.grid(row=0, column=0) | |
button = tk.Button(frame, text='Generate Table', command=analysis) | |
button.grid(row=0, column=1) | |
window.mainloop() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment