def evt_serie_btn_clicked(self): serie_list = [] drivers_df = source.driver_data_to_df() for col in drivers_df.columns: if ".Status" in col: serie_list.append(col.split(".")[0]) self.serie_cbb.clear() self.serie_cbb.addItems(serie_list)
def get_all_racer_info(): drivers_df = source.driver_data_to_df() drivers_df = drivers_df.sort_values( by=['Name'], ascending=[True]) drivers_df['iRacingNr'] = drivers_df['iRacingNr'].astype(int) drivers_df.columns = map(str.upper, drivers_df.columns) print(drivers_df) return [drivers_df, heute_datum, "FLANC Fahrerdatenbank"]
def evt_name_btn_clicked(self): self.name_cbb.clear() drivers_df = source.driver_data_to_df() self.driverlist = drivers_df['Name'].sort_values(ascending=True) self.name_cbb.addItems(self.driverlist) self.track_btn.setEnabled(False) self.datum_btn.setEnabled(False) self.teams_btn.setEnabled(False) self.all_drivers_btn.setEnabled(True) self.all_races_btn.setEnabled(False) self.track_cbb.clear()
def get_team_races_and_korr(saison): race_driver_df = combine_race_drivers() drivers_df = source.driver_data_to_df() saison_df = race_driver_df[race_driver_df['Seriename'] == saison] saison_df['Team'] = saison_df.apply(lambda row: row[saison + '.Team'], axis=1) saison_df['Status'] = saison_df.apply(lambda row: row[saison + '.Status'], axis=1) saison_team_df = saison_df[['Team', 'Status', 'Starts', 'Inc', 'Points']] saison_team_df = saison_team_df.groupby(['Team', 'Status'], as_index=False).sum() drivers_df['Team'] = drivers_df.apply(lambda row: row[saison + '.Team'], axis=1) drivers_df['Status'] = drivers_df.apply(lambda row: row[saison + '.Status'], axis=1) drivers_df['TeamStKorr'] = drivers_df.apply(lambda row: row[saison + '.TeamStKorr'], axis=1) drivers_df['TeamIncKorr'] = drivers_df.apply(lambda row: row[saison + '.TeamIncKorr'], axis=1) drivers_df['TeamPktKorr'] = drivers_df.apply(lambda row: row[saison + '.TeamPktKorr'], axis=1) saison_teamKorr_df = drivers_df[['Team', 'Status', 'TeamStKorr', 'TeamIncKorr', 'TeamPktKorr']] saison_teamKorr_df = saison_teamKorr_df.groupby(['Team', 'Status'], as_index=False).sum() saison_team_with_korr_df = pd.merge(saison_team_df, saison_teamKorr_df, how="left", on=['Team', 'Status']) saison_team_with_korr_df['Team'] = saison_team_df['Team'].str.upper() saison_team_with_korr_df = saison_team_with_korr_df.sort_values(by=['Team'], ascending=[True]) # print(saison_team_with_korr_df) return saison_team_with_korr_df
def combine_race_drivers(): all_info_df = pd.DataFrame() race_df = source.race_data_to_df() drivers_df = source.driver_data_to_df() all_info_df = pd.merge(race_df, drivers_df, how="left", on=['iRacingName']) return all_info_df
def evt_mgmt_selected_name(self): self.name = self.mgmt_name_cbb.currentText() if self.layout_v_details_container.findChild(QtWidgets.QHBoxLayout, "layout_h_serie_details"): self.del_items_in_detail_layout() else: pass self.drivers_df = source.driver_data_to_df() self.driver = self.drivers_df.loc[self.drivers_df['Name'] == self.name] self.name = self.driver['Name'].item() self.mail = self.driver['Mail'].item() self.iracingnr = self.driver['iRacingNr'].item() self.iracingname = self.driver['iRacingName'].item() if self.name == '1 neuer Eintrag': self.name_edit.setText("") self.iracingnr_edit.setText("") self.mail_edit.setText("") self.iracingname_edit.setText("") else: self.name_edit.setText(self.name) self.iracingnr_edit.setText(str(self.iracingnr)) self.mail_edit.setText(self.mail) self.iracingname_edit.setText(self.iracingname) for col in self.driver.columns: if ".Status" in col: self.serie = (col.split(".")[0]) self.status = self.driver[self.serie + ".Status"] self.layout_h_serie_details = QtWidgets.QHBoxLayout() self.layout_h_serie_details.setObjectName( "layout_h_serie_details") self.serie_active_chbox = QtWidgets.QCheckBox( self.mgmt_fahrer_groupBox) self.serie_active_chbox.setObjectName("serie_active_chbox") self.serie_active_chbox.setText(self.serie) self.serie_active_chbox.serie = self.serie self.serie_active_chbox.toggled.connect( self.evt_select_serie_active_chkbx_toggeld) self.layout_h_serie_details.addWidget(self.serie_active_chbox) spacerItem_links = QtWidgets.QSpacerItem( 50, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.layout_h_serie_details.addItem(spacerItem_links) self.serie_active_aktiv_chbox = QtWidgets.QRadioButton( self.mgmt_fahrer_groupBox) self.serie_active_aktiv_chbox.setObjectName( "serie_active_aktiv_chbox") self.serie_active_aktiv_chbox.setText("aktiv") self.serie_active_aktiv_chbox.serie = self.serie self.serie_detail_buttonGroup = QtWidgets.QButtonGroup( self.layout_h_serie_details) self.serie_detail_buttonGroup.setObjectName( "serie_detail_buttonGroup") self.serie_detail_buttonGroup.addButton( self.serie_active_aktiv_chbox) self.layout_h_serie_details.addWidget( self.serie_active_aktiv_chbox) self.serie_active_out_chbox = QtWidgets.QRadioButton( self.mgmt_fahrer_groupBox) self.serie_active_out_chbox.setObjectName( "serie_active_out_chbox") self.serie_active_out_chbox.setText("out") self.serie_active_out_chbox.serie = self.serie self.serie_detail_buttonGroup.addButton( self.serie_active_out_chbox) self.layout_h_serie_details.addWidget( self.serie_active_out_chbox) self.team_details_btn = QtWidgets.QPushButton( self.mgmt_fahrer_groupBox) self.team_details_btn.setObjectName("team_details_btn") self.team_details_btn.setText("Team Details") self.team_details_btn.serie = self.serie self.team_details_btn.clicked.connect( self.evt_team_details_btn_clicked) self.layout_h_serie_details.addWidget(self.team_details_btn) spacerItem_rechts = QtWidgets.QSpacerItem( 600, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum) self.layout_h_serie_details.addItem(spacerItem_rechts) self.layout_v_details_container.addLayout( self.layout_h_serie_details) if self.status.item() == "aktiv" or self.status.item( ) == "out": self.serie_active_chbox.setChecked(True) if self.status.item() == "aktiv": self.serie_active_aktiv_chbox.setChecked(True) else: self.serie_active_aktiv_chbox.setChecked(False) if self.status.item() == "out": self.serie_active_out_chbox.setChecked(True) else: self.serie_active_out_chbox.setChecked(False) else: self.serie_active_chbox.setChecked(False) self.serie_active_aktiv_chbox.setEnabled(False) self.serie_active_out_chbox.setEnabled(False) self.team_details_btn.setEnabled(False) self.name_edit.setEnabled(True) self.mail_edit.setEnabled(True) self.iracingnr_edit.setEnabled(True) self.iracingname_edit.setEnabled(True) self.team_details_lbl.setText("Team Details") self.teamname_edit.setText("") self.korrekturper_edit.setText("") self.korrekturgrund_edit.setText("") self.starts_edit.setText("") self.incs_edit.setText("") self.points_edit.setText("")
def evt_mgmt_name_btn_clicked(self): self.mgmt_name_cbb.clear() drivers_df = source.driver_data_to_df() self.driverlist = drivers_df['Name'].sort_values(ascending=True) self.mgmt_name_cbb.addItems(self.driverlist)