formating
This commit is contained in:
@@ -1,8 +1,15 @@
|
|||||||
import pandas as pd
|
import pandas as pd
|
||||||
import PySimpleGUI as sg
|
import PySimpleGUI as sg
|
||||||
|
|
||||||
sg.theme("Brownblue")
|
sg.theme("Brownblue")
|
||||||
layout = [[sg.T("")], [sg.Text("Choisir le fichier CSV: "), sg.Input(key="-IN2-", change_submits=True),
|
|
||||||
sg.FileBrowse(key="-IN-", file_types=(("CSV Files", "*.csv"),))], [sg.Button("Submit")]]
|
layout = [
|
||||||
|
[sg.T("")],
|
||||||
|
[sg.Text("Choisir le fichier CSV: "),
|
||||||
|
sg.Input(key="-IN2-", change_submits=True),
|
||||||
|
sg.FileBrowse(key="-IN-", file_types=(("CSV Files", "*.csv"),))],
|
||||||
|
[sg.Button("Submit")]
|
||||||
|
]
|
||||||
|
|
||||||
window = sg.Window('VIDEOTRON MOBILE DATA CALCULATOR', layout, size=(600, 150))
|
window = sg.Window('VIDEOTRON MOBILE DATA CALCULATOR', layout, size=(600, 150))
|
||||||
|
|
||||||
@@ -12,11 +19,16 @@ while True:
|
|||||||
|
|
||||||
if event == sg.WIN_CLOSED or event == "Exit":
|
if event == sg.WIN_CLOSED or event == "Exit":
|
||||||
break
|
break
|
||||||
|
|
||||||
elif event == "Submit":
|
elif event == "Submit":
|
||||||
pd.set_option('display.max_rows', None)
|
pd.set_option('display.max_rows', None)
|
||||||
|
|
||||||
df = pd.read_csv(values["-IN2-"], sep=";",
|
df = pd.read_csv(
|
||||||
encoding='unicode_escape', decimal=",", usecols=[9, 20, 39])
|
values["-IN2-"], sep=";",
|
||||||
|
encoding='unicode_escape',
|
||||||
|
decimal=",",
|
||||||
|
usecols=[9, 20, 39]
|
||||||
|
)
|
||||||
|
|
||||||
df.replace('UTILISATION POUR LE', '', regex=True, inplace=True)
|
df.replace('UTILISATION POUR LE', '', regex=True, inplace=True)
|
||||||
|
|
||||||
@@ -30,7 +42,8 @@ while True:
|
|||||||
df = df[df['B'].str.contains('DONN')]
|
df = df[df['B'].str.contains('DONN')]
|
||||||
|
|
||||||
df['DATA'] = df['DATA'].apply(
|
df['DATA'] = df['DATA'].apply(
|
||||||
lambda x: float(x.split()[0].replace(',', '.')))
|
lambda x: float(x.split()[0].replace(',', '.'))
|
||||||
|
)
|
||||||
|
|
||||||
datasum = df.groupby('USER')['DATA'].sum(
|
datasum = df.groupby('USER')['DATA'].sum(
|
||||||
min_count=1).reset_index().sort_values(by='DATA')
|
min_count=1).reset_index().sort_values(by='DATA')
|
||||||
|
|||||||
Reference in New Issue
Block a user