Когда я использую gspread_dataframe
и gspread
для экспорта данных из блокнота Jupyter в таблицу Google, строки перемешиваются, а это не то, что мне нужно. Кто-нибудь может помочь?
emp_uniq = gspread_df['E_code'].unique() dict_e_code = {} x_df = pd.DataFrame()
for emp in list(emp_uniq):
dict_e_code[emp] = gspread_df[gspread_df['E_code']==emp]
a = dict_e_code[emp][["Month","E_code","Allocation_ID","Project","Effective_days","Percentage_Util","Onsite/Offshore","Mapping","Payroll"]]
a_fin = a.groupby(['Month','E_code','Project','Allocation_ID','Percentage_Util','Onsite/Offshore']).sum()['Effective_days']
new_df = a_fin.to_frame().reset_index()
new_df['Percentage_Util'] = (new_df['Effective_days']/new_df['Effective_days'].sum())*100
x_df = x_df.append(new_df)
x_df.reset_index(inplace=True)
x_df.drop(['index'],axis=1,inplace=True)
sheet = client.open(input("Please Enter Main Spreadsheet as Output Data: ")) worksheet_new = sheet.worksheet(input("Please Enter Sheet Name as Output Data:"))
existing = get_as_dataframe(worksheet_new)
a = existing.append(x_df)
gsdf.set_with_dataframe(worksheet_new, a)