def save(self): df,unit,instructi = recognize_df_and_instucti(self.indexcontent) if df is not None: chines_name = df.iloc[list(np.where(df.iloc[:,0] == '公司的中文名称')[0]), 1].values[0] if len(list(np.where(df.iloc[:,0] == '公司的中文名称')[0]))==1 else '' chines_abbrevi = df.iloc[list(np.where(df.iloc[:, 0] == '公司的中文简称')[0]), 1].values[0] if len(list(np.where(df.iloc[:,0] == '公司的中文简称')[0]))==1 else '' foreign_name = df.iloc[list(np.where(df.iloc[:, 0] == '公司的外文名称(如有)')[0]), 1].values[0] if len(list(np.where(df.iloc[:,0] == '公司的外文名称(如有)')[0]))==1 else '' foreign_abbrevi = df.iloc[list(np.where(df.iloc[:, 0] == '公司的外文名称缩写(如有)')[0]), 1].values[0] if len(list(np.where(df.iloc[:,0] == '公司的外文名称缩写(如有)')[0]))==1 else '' legal_repres = df.iloc[list(np.where(df.iloc[:, 0] == '公司的法定代表人')[0]), 1].values[0] if len(list(np.where(df.iloc[:,0] == '公司的法定代表人')[0]))==1 else '' compani_regist_addre = df.iloc[list(np.where(df.iloc[:, 0] == '注册地址')[0]), 1].values[0] if len(list(np.where(df.iloc[:,0] == '注册地址')[0]))==1 else '' postal_regist = df.iloc[list(np.where(df.iloc[:, 0] == '注册地址的邮政编码')[0]), 1].values[0] if len(list(np.where(df.iloc[:,0] == '注册地址的邮政编码')[0]))==1 else '' compani_offic_addres = df.iloc[list(np.where(df.iloc[:, 0] == '办公地址')[0]), 1].values[0] if len(list(np.where(df.iloc[:,0] == '办公地址')[0]))==1 else '' postal_offic = df.iloc[list(np.where(df.iloc[:, 0] == '办公地址的邮政编码')[0]), 1].values[0] if len(list(np.where(df.iloc[:,0] == '办公地址的邮政编码')[0]))==1 else '' compani_websit = df.iloc[list(np.where(df.iloc[:, 0].str.contains('网址'))[0]), 1].values[0] if len(list(np.where(df.iloc[:, 0].str.contains('网址'))[0]))==1 else '' compani_email = df.iloc[list(np.where(df.iloc[:, 0] == '电子信箱')[0]), 1].values[0] if len(list(np.where(df.iloc[:,0] == '电子信箱')[0]))==1 else '' value_dict = dict( stk_cd_id=self.stk_cd_id, acc_per=self.acc_per, chines_name=chines_name, chines_abbrevi=chines_abbrevi, foreign_name=foreign_name, foreign_abbrevi=foreign_abbrevi, legal_repres=legal_repres, postal_regist=postal_regist, compani_regist_addre=compani_regist_addre, compani_offic_addres=compani_offic_addres, postal_offic=postal_offic, compani_websit=compani_websit, compani_email=compani_email, ) create_and_update('CompaniProfil',**value_dict) else: pass
def save(self): df, unit, instructi = recognize_df_and_instucti(self.indexcontent) if df is not None and len(df) > 0: name_pos = list(np.where(df.iloc[0, :].str.contains('法人股东名称'))[0]) unit_owner_pos = list( np.where(df.iloc[0, :].str.contains('法定代表人'))[0]) date_of_establish_pos = list( np.where(df.iloc[0, :].str.contains('成立日期'))[0]) main_busines_pos = list( np.where(df.iloc[0, :].str.contains('主要经营业务或管理活动'))[0]) regist_capit_pos = list( np.where(df.iloc[0, :].str.contains('注册资本'))[0]) names = list(df.iloc[:, name_pos[0]]) unit_owners = list(df.iloc[:, unit_owner_pos[0]]) date_of_establishs = list(df.iloc[:, date_of_establish_pos[0]]) main_busineses = list(df.iloc[:, main_busines_pos[0]]) regist_capits = list(df.iloc[:, regist_capit_pos[0]]) for (name,unit_owner,date_of_establish,main_busines,regist_capit) in\ zip(names,unit_owners,date_of_establishs,main_busineses,regist_capits): value_dict = dict( stk_cd_id=self.stk_cd_id, acc_per=self.acc_per, type='os', name=name, unit_owner=unit_owner, date_of_establish=date_of_establish, main_busines=main_busines, regist_capit=regist_capit, ) create_and_update('ShareholdCorpor', **value_dict) else: pass
def save(self): df, unit, instructi = recognize_df_and_instucti(self.indexcontent) if df is not None and len(df) > 1: df = df.drop([0]) major_assets = list(df.iloc[:, 0]) change_reasons = list(df.iloc[:, len(df.columns) - 1]) for major_asset, change_reason in zip(major_assets, change_reasons): value_dict = dict(stk_cd_id=self.stk_cd_id, acc_per=self.acc_per, major_asset=major_asset, change_reason=change_reason) create_and_update('CompaniBusiOverview', **value_dict) # if models.CompaniBusiOverview.objects.filter(stk_cd_id=self.stk_cd_id, acc_per=self.acc_per): # obj = models.CompaniBusiOverview.objects.get(stk_cd_id=self.stk_cd_id, acc_per=self.acc_per) # obj.major_asset = major_asset # obj.change_reason = change_reason # obj.save() # else: # models.CompaniBusiOverview.objects.create( # stk_cd_id=self.stk_cd_id, # acc_per=self.acc_per, # major_asset=major_asset, # change_reason=change_reason # ) else: pass save_instructi(instructi, models.CompaniBusiOverview, self.stk_cd_id, self.acc_per, 'major_chang_in_major_asset')
def save(self): df,unti,instructi = recognize_df_and_instucti(self.indexcontent) if df is not None: account_firm_name = df.iloc[list(np.where((df.iloc[:, 0].str.contains("会计师事务所")) & (df.iloc[:, 1].str.match("名称")))[0]), 2].values[0] account_offic_addres = df.iloc[list(np.where((df.iloc[:, 0].str.contains("会计师事务所")) & (df.iloc[:, 1].str.match("办公地址")))[0]), 2].values[0] sign_accountant_nam = df.iloc[list(np.where((df.iloc[:, 0].str.contains("会计师事务所")) & (df.iloc[:, 1].str.match("签字会计师姓名")))[0]), 2].values[0] sponsor_name = df.iloc[list(np.where((df.iloc[:, 0].str.contains("保荐机构")) & (df.iloc[:, 1].str.match("名称")))[0]), 2].values[0] sponsor_addres = df.iloc[list(np.where((df.iloc[:, 0].str.contains("保荐机构")) & (df.iloc[:, 1].str.match("办公地址")))[0]), 2].values[0] sponsor_repr = df.iloc[list(np.where((df.iloc[:, 0].str.contains("保荐机构")) & (df.iloc[:, 1].str.contains("保荐代表人")))[0]), 2].values[0] continu_supervis_per = df.iloc[list(np.where((df.iloc[:, 0].str.contains("保荐机构")) & (df.iloc[:, 1].str.contains("持续督导的期间")))[0]), 2].values[0] value_dict = dict( stk_cd_id=self.stk_cd_id, acc_per=self.acc_per, account_firm_name=account_firm_name, account_offic_addres=account_offic_addres, sign_accountant_nam=sign_accountant_nam, sponsor_name=sponsor_name, sponsor_addres=sponsor_addres, sponsor_repr=sponsor_repr, continu_supervis_per=continu_supervis_per ) create_and_update('CompaniProfil',**value_dict) else: pass
def save(self): dfs, unit, instructi = self.recognize() if dfs.get('股票') is not None: df = dfs.get('股票') type = 'stock' stock = df.iloc[0, 0] date = df.iloc[0, 1] price = df.iloc[0, 2] num = df.iloc[0, 3] to_market_date = df.iloc[0, 4] number_permit_trade = df.iloc[0, 5] transact_termin_date = df.iloc[0, 6] value_dict = dict( stk_cd_id=self.stk_cd_id, acc_per=self.acc_per, type=type, stock=stock, date=date, price=price, num=num, to_market_date=to_market_date, number_permit_trade=number_permit_trade, transact_termin_date=transact_termin_date, ) create_and_update('SecurIssuanc', **value_dict) else: pass save_instructi(instructi, models.ChangInShareAndSharehold, self.stk_cd_id, self.acc_per, 'secur_issuanc')
def save(self): df, unit, instructi = recognize_df_and_instucti(self.indexcontent) if df is not None and len(df) > 0: unit_change = { '元': 1, '千元': 1000, '万元': 10000, '百万元': 1000000, '亿元': 100000000 } bond_name_pos = list( np.where(df.iloc[0, :].str.contains('债券名称'))[0]) abbrevi_pos = list(np.where(df.iloc[0, :].str.contains('简称'))[0]) code_pos = list(np.where(df.iloc[0, :].str.contains('代码'))[0]) releas_date_pos = list( np.where(df.iloc[0, :].str.contains('发行日'))[0]) expiri_date_pos = list( np.where(df.iloc[0, :].str.contains('到期日'))[0]) bond_balanc_pos = list( np.where(df.iloc[0, :].str.contains('债券余额'))[0]) interest_rate_pos = list( np.where(df.iloc[0, :].str.contains('利率'))[0]) debt_servic_pos = list( np.where(df.iloc[0, :].str.contains('还本付息方式'))[0]) trade_place_pos = list( np.where(df.iloc[0, :].str.contains('交易场所'))[0]) df = df.drop([0]) bond_names = list(df.iloc[:, bond_name_pos[0]]) abbrevis = list(df.iloc[:, abbrevi_pos[0]]) codes = list(df.iloc[:, code_pos[0]]) releas_dates = list(df.iloc[:, releas_date_pos[0]]) expiri_dates = list(df.iloc[:, expiri_date_pos[0]]) bond_balancs = list(df.iloc[:, bond_balanc_pos[0]]) interest_rates = list(df.iloc[:, interest_rate_pos[0]]) debt_servics = list(df.iloc[:, debt_servic_pos[0]]) trade_places = list(df.iloc[:, trade_place_pos[0]]) for (bond_name, abbrevi,code,releas_date,expiri_date,bond_balanc, \ interest_rate,debt_servic,trade_place) \ in zip(bond_names, abbrevis,codes,releas_dates,expiri_dates,bond_balancs, \ interest_rates,debt_servics,trade_places): value_dict = dict(stk_cd_id=self.stk_cd_id, acc_per=self.acc_per, bond_name=bond_name, abbrevi=abbrevi, code=code, releas_date=releas_date, expiri_date=expiri_date, bond_balanc=num_to_decimal( bond_balanc, unit), interest_rate=num_to_decimal(interest_rate), debt_servic=debt_servic, trade_place=trade_place) create_and_update('BasicCorporBond', **value_dict)
def save(self): df, unit, instructi = recognize_df_and_instucti(self.indexcontent) if df is not None and len(df) > 0: bond_man_name_pos = list( np.where((df.iloc[:, 0].str.contains('债券受托管理人')) & (df.iloc[:, 1].str.contains('名称')))[0]) bond_man_addr_pos = list( np.where((df.iloc[:, 0].str.contains('债券受托管理人')) & (df.iloc[:, 1].str.contains('办公地址')))[0]) bond_man_contact_person_pos = list( np.where((df.iloc[:, 0].str.contains('债券受托管理人')) & (df.iloc[:, 1].str.contains('联系人')))[0]) bond_man_contact_tel_pos = list( np.where((df.iloc[:, 0].str.contains('债券受托管理人')) & (df.iloc[:, 1].str.contains('联系电话')))[0]) credit_name_pos = list( np.where((df.iloc[:, 0].str.contains('资信评级机构')) & (df.iloc[:, 1].str.contains('名称')))[0]) credit_addr_pos = list( np.where((df.iloc[:, 0].str.contains('资信评级机构')) & (df.iloc[:, 1].str.contains('办公地址')))[0]) bond_man_names = list(df.iloc[bond_man_name_pos, 2]) bond_man_addrs = list(df.iloc[bond_man_addr_pos, 2]) bond_man_contact_persons = list( df.iloc[bond_man_contact_person_pos, 2]) bond_man_contact_tels = list(df.iloc[bond_man_contact_tel_pos, 2]) credit_names = list(df.iloc[credit_name_pos, 2]) credit_addrs = list(df.iloc[credit_addr_pos, 2]) for (credit_name,credit_addr) \ in zip(credit_names,credit_addrs): value_dict = dict( stk_cd_id=self.stk_cd_id, acc_per=self.acc_per, institut_categori='credit', name=credit_name, addr=credit_addr, ) create_and_update('BondManagAndCreditRateAgenc', **value_dict) for (bond_man_name,bond_man_addr,bond_man_contact_person,bond_man_contact_tel) \ in zip(bond_man_names,bond_man_addrs,bond_man_contact_persons,bond_man_contact_tels): value_dict = dict( stk_cd_id=self.stk_cd_id, acc_per=self.acc_per, institut_categori='manager', name=bond_man_name, addr=bond_man_addr, contact_person=bond_man_contact_person, contact_tel=bond_man_contact_tel, ) create_and_update('BondManagAndCreditRateAgenc', **value_dict)
def save(self): df = self.converse() if df is not None: # 将第一列赋值给字段interpret_item,将第二列赋值给字段definit interpret_items = list(df.iloc[:, 0]) definits = list(df.iloc[:, 2]) for interpret_item, definit in zip(interpret_items, definits): value_dict = dict(stk_cd_id=self.stk_cd_id, acc_per=self.acc_per, interpret_item=interpret_item, definit=definit) create_and_update('Interpret', **value_dict)
def save(self): dfs, unit, instructi = self.recognize() if dfs.get('np_control') is not None: df = dfs.get('np_control') name_pos = list(np.where(df.iloc[0, :].str.contains('实际控制人姓名'))[0]) countri_of_citizensh_pos = list( np.where(df.iloc[0, :].str.contains('国籍'))[0]) other_right_of_abod_pos = list( np.where(df.iloc[0, :].str.contains('是否取得其他国家或地区居留权'))[0]) major_occup_and_job_pos = list( np.where(df.iloc[:, 0].str.contains('主要职业及职务'))[0]) sharehold_other_company_pos = list( np.where(df.iloc[:, 0].str.contains('过去10年曾控股的境内外上市公司情况'))[0]) name = df.iloc[1, name_pos[0]] countri_of_citizensh = df.iloc[1, countri_of_citizensh_pos[0]] other_right_of_abod = df.iloc[1, other_right_of_abod_pos[0]] major_occup_and_job = df.iloc[major_occup_and_job_pos[0], 1] sharehold_other_company = df.iloc[sharehold_other_company_pos[0], 1] value_dict = dict( stk_cd_id=self.stk_cd_id, acc_per=self.acc_per, type='ac', name=name, countri_of_citizensh=countri_of_citizensh, other_right_of_abod=other_right_of_abod, major_occup_and_job=major_occup_and_job, sharehold_other_company=sharehold_other_company, ) create_and_update('ControlShareholdNaturPerson', **value_dict) else: pass if dfs.get('np_control') is not None and dfs.get( 'control_change') is not None: df = dfs.get('control_change') chang_date_pos = list( np.where(df.iloc[:, 0].str.contains('变更日期'))[0]) chang_date = df.iloc[chang_date_pos[0], 1] value_dict = dict( stk_cd_id=self.stk_cd_id, acc_per=self.acc_per, ac_chang_date=chang_date, ) create_and_update('ControlShareholdNaturPerson', **value_dict) else: pass
def save(self): df,unit,instructi = recognize_df_and_instucti(self.indexcontent) if df is not None: organ_code = df.iloc[list(np.where(df.iloc[:, 0] == '组织机构代码')[0]), 1].values[0] chang_in_main_busi = df.iloc[list(np.where(df.iloc[:, 0] == '公司上市以来主营业务的变化情况(如有)')[0]), 1].values[0] chang_in_control_sha = df.iloc[list(np.where(df.iloc[:, 0] == '历次控股股东的变更情况(如有)')[0]), 1].values[0] value_dict = dict( stk_cd_id=self.stk_cd_id, acc_per=self.acc_per, organ_code=organ_code, chang_in_main_busi=chang_in_main_busi, chang_in_control_sha=chang_in_control_sha ) create_and_update('CompaniProfil',**value_dict) else: pass
def save(self): df,unit,instructi = recognize_df_and_instucti(self.indexcontent) if df is not None: board_secretary_nam = df.iloc[list(np.where(df.iloc[:, 0] == '姓名')[0]), 1].values[0] board_secretary_addr = df.iloc[list(np.where(df.iloc[:, 0] == '联系地址')[0]), 1].values[0] board_secretary_tel = df.iloc[list(np.where(df.iloc[:, 0] == '电话')[0]), 1].values[0] board_secretary_fax = df.iloc[list(np.where(df.iloc[:, 0] == '传真')[0]), 1].values[0] board_secretary_email = df.iloc[list(np.where(df.iloc[:, 0] == '电子信箱')[0]), 1].values[0] value_dict = dict(stk_cd_id=self.stk_cd_id, acc_per=self.acc_per, board_secretary_nam=board_secretary_nam, board_secretary_addr=board_secretary_addr, board_secretary_tel=board_secretary_tel, board_secretary_fax=board_secretary_fax, board_secretary_email=board_secretary_email) create_and_update('CompaniProfil',**value_dict) else: pass
def save(self): df,unit,instructi = recognize_df_and_instucti(self.indexcontent) if df is not None: chines_name = df.iloc[list(np.where(df.iloc[:,0] == '公司的中文名称')[0]), 1].values[0] chines_abbrevi = df.iloc[list(np.where(df.iloc[:, 0] == '公司的中文简称')[0]), 1].values[0] foreign_name = df.iloc[list(np.where(df.iloc[:, 0] == '公司的外文名称')[0]), 1].values[0] foreign_abbrevi = df.iloc[list(np.where(df.iloc[:, 0] == '公司的外文名称缩写')[0]), 1].values[0] legal_repres = df.iloc[list(np.where(df.iloc[:, 0] == '公司的法定代表人')[0]), 1].values[0] value_dict = dict( stk_cd_id=self.stk_cd_id, acc_per=self.acc_per, chines_name=chines_name, chines_abbrevi=chines_abbrevi, foreign_name=foreign_name, foreign_abbrevi=foreign_abbrevi, legal_repres=legal_repres) create_and_update('CompaniProfil',**value_dict) else: pass
def save(self): df, unit, instructi = recognize_df_and_instucti(self.indexcontent) if df is not None and len(df) > 0: sharehold_name_pos = list( np.where(df.iloc[0, :].str.contains('股东名称'))[0]) begin_pos = list(np.where(df.iloc[0, :].str.contains('初限售股数'))[0]) releas_pos = list( np.where(df.iloc[0, :].str.contains('解除限售股数'))[0]) increas_pos = list( np.where(df.iloc[0, :].str.contains('增加限售股数'))[0]) end_pos = list(np.where(df.iloc[0, :].str.contains('末限售股数'))[0]) reason_pos = list(np.where(df.iloc[0, :].str.contains('限售原因'))[0]) restrict_sale_date_pos = list( np.where(df.iloc[0, :].str.contains('解除限售日期'))[0]) df = df.drop([0, len(df) - 1]) sharehold_names = list(df.iloc[:, sharehold_name_pos[0]]) begins = list(df.iloc[:, begin_pos[0]]) releases = list(df.iloc[:, releas_pos[0]]) increases = list(df.iloc[:, increas_pos[0]]) ends = list(df.iloc[:, end_pos[0]]) reasons = list(df.iloc[:, reason_pos[0]]) restrict_sale_dates = list(df.iloc[:, restrict_sale_date_pos[0]]) for (sharehold_name,begin,releas,increas,end, reason,restrict_sale_date) \ in zip(sharehold_names,begins,releases,increases,ends, reasons,restrict_sale_dates): value_dict = dict( stk_cd_id=self.stk_cd_id, acc_per=self.acc_per, sharehold_name=sharehold_name, begin=begin if begin != 'nan' else 0, releas=releas if releas != 'nan' else 0, increas=increas if increas != 'nan' else 0, end=end if end != 'nan' else 0, reason=reason, restrict_sale_date=restrict_sale_date, ) create_and_update('ChangInRestrictSaleOfShare', **value_dict) else: pass
def save(self): df,unit,instructi = recognize_df_and_instucti(self.indexcontent) if df is not None: compani_regist_addre = df.iloc[list(np.where(df.iloc[:, 0] == '公司注册地址')[0]), 1].values[0] postal_regist = df.iloc[list(np.where(df.iloc[:, 0] == '公司注册地址的邮政编码')[0]), 1].values[0] compani_offic_addres = df.iloc[list(np.where(df.iloc[:, 0] == '公司办公地址')[0]), 1].values[0] postal_offic = df.iloc[list(np.where(df.iloc[:, 0] == '公司办公地址的邮政编码')[0]), 1].values[0] compani_websit = df.iloc[list(np.where(df.iloc[:, 0] == '公司网址')[0]), 1].values[0] compani_email = df.iloc[list(np.where(df.iloc[:, 0] == '电子信箱')[0]), 1].values[0] value_dict = dict( stk_cd_id=self.stk_cd_id, acc_per=self.acc_per, compani_regist_addre=compani_regist_addre, postal_regist=postal_regist, compani_offic_addres=compani_offic_addres, postal_offic=postal_offic, compani_websit=compani_websit, compani_email=compani_email ) create_and_update('CompaniProfil',**value_dict) else: pass
def save(self): df, unit, instructi = recognize_df_and_instucti(self.indexcontent) if df is not None and len(df) > 0: name_pos = list(np.where(df.iloc[:, 0].str.contains('名称'))[0]) unit_owner_pos = list( np.where(df.iloc[:, 0].str.contains('单位负责人或法定代表人'))[0]) date_of_establish_pos = list( np.where(df.iloc[:, 0].str.contains('成立日期'))[0]) main_busines_pos = list( np.where(df.iloc[:, 0].str.contains('主要经营业务'))[0]) contor_other_list_com_pos = list( np.where( df.iloc[:, 0].str.contains('报告期内控股和参股的其他境内外上市公司的股权情况'))[0]) other_desc_pos = list( np.where(df.iloc[:, 0].str.contains('其他情况说明'))[0]) # df = df.drop([0, 1]) name = df.iloc[name_pos[0], 1] unit_owner = df.iloc[unit_owner_pos[0], 1] date_of_establish = df.iloc[date_of_establish_pos[0], 1] main_busines = df.iloc[main_busines_pos[0], 1] contor_other_list_com = df.iloc[contor_other_list_com_pos[0], 1] other_desc = df.iloc[other_desc_pos[0], 1] value_dict = dict( stk_cd_id=self.stk_cd_id, acc_per=self.acc_per, type='cs', name=name, unit_owner=unit_owner, date_of_establish=date_of_establish, main_busines=main_busines, control_other_list_com=contor_other_list_com, other_desc=other_desc, ) create_and_update('ShareholdCorpor', **value_dict) else: pass
def save(self): df, unit, instructi = recognize_df_and_instucti(self.indexcontent) if df is not None and len(df) > 0: report_end_sharehold_num_pos = list( np.where(df.iloc[:, 0].str.contains('截止报告期末普通股股东总数'))[0]) disclos_last_month_sharehold_num_pos = list( np.where(df.iloc[:, 0].str.contains('披露日前上一月末的普通股股东总数'))[0]) report_end_sharehold_num = df.iloc[report_end_sharehold_num_pos[0], 1] disclos_last_month_sharehold_num = df.iloc[ disclos_last_month_sharehold_num_pos[0], 1] value_dict = dict( stk_cd_id=self.stk_cd_id, acc_per=self.acc_per, report_end_sharehold_num=report_end_sharehold_num, disclos_last_month_sharehold_num= disclos_last_month_sharehold_num, ) create_and_update('ChangInShareAndSharehold', **value_dict) else: pass
def save(self): dfs = self.recognize() df = dfs.get('accout') if df is not None: account_firm_name = df.iloc[list(np.where(df.iloc[:, 0] == '会计师事务所名称')[0]), 1].values[0] account_offic_addres = df.iloc[list(np.where(df.iloc[:, 0] == '会计师事务所办公地址')[0]), 1].values[0] sign_accountant_nam = df.iloc[list(np.where(df.iloc[:, 0] == '签字会计师姓名')[0]), 1].values[0] value_dict = dict( stk_cd_id=self.stk_cd_id, acc_per=self.acc_per, account_firm_name=account_firm_name, account_offic_addres=account_offic_addres, sign_accountant_nam=sign_accountant_nam ) create_and_update('CompaniProfil',**value_dict) else: pass df1 = dfs.get('sponsor') if df1 is not None: df = df1.T print(df) sponsor_name = df.iloc[list(np.where(df.iloc[:, 0] == '财务顾问名称')[0]), 1].values[0] sponsor_addres = df.iloc[list(np.where(df.iloc[:, 0] == '财务顾问办公地址')[0]), 1].values[0] sponsor_repr = df.iloc[list(np.where(df.iloc[:, 0] == '财务顾问主办人姓名')[0]), 1].values[0] continu_supervis_per = df.iloc[list(np.where(df.iloc[:, 0] == '持续督导期间')[0]), 1].values[0] value_dict = dict( stk_cd_id=self.stk_cd_id, acc_per=self.acc_per, sponsor_name=sponsor_name, sponsor_addres=sponsor_addres, sponsor_repr=sponsor_repr, continu_supervis_per=continu_supervis_per ) create_and_update('CompaniProfil',**value_dict) else: pass
def save(self): df, unit, instructi = recognize_df_and_instucti(self.indexcontent) if df is not None: asset_contentss = list( chain.from_iterable( df.iloc[:, list(np.where( df.iloc[0, :] == '资产的具体内容')[0])].values)) caus_of_formats = list( chain.from_iterable( df.iloc[:, list(np.where( df.iloc[0, :] == '形成原因')[0])].values)) asset_sizes = list( chain.from_iterable( df.iloc[:, list(np.where( df.iloc[0, :] == '资产规模')[0])].values)) locats = list( chain.from_iterable( df.iloc[:, list(np.where(df.iloc[0, :] == '所在地')[0])].values)) oper_modes = list( chain.from_iterable( df.iloc[:, list(np.where( df.iloc[0, :] == '运营模式')[0])].values)) control_measurs = list( chain.from_iterable( df.iloc[:, list(np.where( df.iloc[0, :] == '保障资产安全性的控制措施')[0])].values)) revenu_status = list( chain.from_iterable( df.iloc[:, list(np.where( df.iloc[0, :] == '收益状况')[0])].values)) proport_of_overseas = list( chain.from_iterable( df. iloc[:, list(np.where( df.iloc[0, :] == '境外资产占公司净资产的比重')[0])].values)) impair_risks = list( chain.from_iterable( df.iloc[:, list(np.where( df.iloc[0, :] == '是否存在重大减值风险')[0])].values)) for asset_contents,caus_of_format,asset_size,locat,oper_mode,control_measur,revenu_statu, \ proport_of_oversea,impair_risk in zip(asset_contentss,caus_of_formats,asset_sizes,locats, oper_modes,control_measurs,revenu_status,proport_of_overseas,impair_risks): if asset_contents == '资产的具体内容': continue value_dict = dict(stk_cd_id=self.stk_cd_id, acc_per=self.acc_per, asset_contents=asset_contents, caus_of_format=caus_of_format, asset_size=asset_size, locat=locat, oper_mode=oper_mode, control_measur=control_measur, revenu_statu=revenu_statu, proport_of_oversea=proport_of_oversea, impair_risk=impair_risk) create_and_update('MajorOverseaAsset', **value_dict) # if models.MajorOverseaAsset.objects.filter(stk_cd_id=self.stk_cd_id, acc_per=self.acc_per): # obj = models.MajorOverseaAsset.objects.get(stk_cd_id=self.stk_cd_id, acc_per=self.acc_per) # obj.asset_contents = asset_contents # obj.caus_of_format = caus_of_format # obj.asset_size = asset_size # obj.locat = locat # obj.oper_mode = oper_mode # obj.control_measur = control_measur # obj.revenu_statu = revenu_statu # obj.proport_of_oversea = proport_of_oversea # obj.impair_risk = impair_risk # obj.save() # else: # models.MajorOverseaAsset.objects.create( # stk_cd_id=self.stk_cd_id, # acc_per=self.acc_per, # asset_contents=asset_contents, # caus_of_format=caus_of_format, # asset_size=asset_size, # locat=locat, # oper_mode=oper_mode, # control_measur=control_measur, # revenu_statu=revenu_statu, # proport_of_oversea=proport_of_oversea, # impair_risk=impair_risk # # ) else: pass
def save(self): dfs, unit, instructi = self.recognize() if dfs.get('持股5%以上') is not None: df = dfs.get('持股5%以上') sharehold_name_pos = list( np.where(df.iloc[0, :].str.contains('股东名称'))[0]) increas_and_decreas_pos = list( np.where(df.iloc[0, :].str.contains('报告期内增减'))[0]) end_hold_num_pos = list( np.where(df.iloc[0, :].str.contains('期末持股数量'))[0]) ratio_pos = list(np.where(df.iloc[0, :].str.contains('比例'))[0]) restrict_share_pos = list( np.where(df.iloc[0, :].str.contains('持有有限售条件'))[0]) natur_of_sharehold_pos = list( np.where(df.iloc[0, :].str.contains('股东性质'))[0]) pledg_or_freez_pos = list( np.where(df.iloc[0, :].str.contains('质押或冻结情况'))[0]) stragy_investor = list( np.where(df.iloc[:, 0].str.contains('战略投资者'))[0]) sharehold_relat_pos = list( np.where(df.iloc[:, 0].str.contains('上述股东关联关系或一致行动的说明'))[0]) sharehold_relat = df.iloc[sharehold_relat_pos[0], 2] df = df.iloc[2:stragy_investor[0], :] if len( stragy_investor) > 0 else df.drop([0, 1, len(df) - 1]) sharehold_names = list(df.iloc[:, sharehold_name_pos[0]]) increas_and_decreases = list(df.iloc[:, increas_and_decreas_pos[0]]) end_hold_nums = list(df.iloc[:, end_hold_num_pos[0]]) ratios = list(df.iloc[:, ratio_pos[0]]) restrict_shares = list(df.iloc[:, restrict_share_pos[0]]) pledg_or_freez_statuses = list(df.iloc[:, pledg_or_freez_pos[0]]) pledg_or_freez_nums = list(df.iloc[:, pledg_or_freez_pos[1]]) natur_of_shareholds = list(df.iloc[:, (natur_of_sharehold_pos[0])]) for (sharehold_name, increas_and_decreas, end_hold_num, ratio, \ restrict_share, pledg_or_freez_status, pledg_or_freez_num, natur_of_sharehold) \ in zip(sharehold_names, increas_and_decreases, end_hold_nums, ratios, \ restrict_shares, pledg_or_freez_statuses, pledg_or_freez_nums, natur_of_shareholds): value_dict = dict( stk_cd_id=self.stk_cd_id, acc_per=self.acc_per, sharehold_name=sharehold_name, increas_and_decreas=num_to_decimal(increas_and_decreas), end_hold_num=num_to_decimal(end_hold_num), ratio=num_to_decimal(ratio), restrict_share=num_to_decimal(restrict_share), pledg_or_freez_status=pledg_or_freez_status, pledg_or_freez_num=num_to_decimal(pledg_or_freez_num), natur_of_sharehold=natur_of_sharehold, ) create_and_update('TopTenSharehold', **value_dict) save_instructi(sharehold_relat, models.ChangInShareAndSharehold, self.stk_cd_id, self.acc_per, 'sharehold_relat') else: pass if dfs.get('无限售条件') is not None: df = dfs.get('无限售条件') sharehold_name_pos = list( np.where(df.iloc[0, :].str.contains('股东名称'))[0]) hold_num_pos = list( np.where(df.iloc[0, :].str.contains('持有无限售条件'))[0]) type_pos = list(np.where(df.iloc[0, :].str.contains('股份种类'))[0]) unlimit_sharehold_relat_pos = list( np.where(df.iloc[:, 0].str.contains('前10名无限售流通股股东之间'))[0]) unlimit_sharehold_relat = df.iloc[unlimit_sharehold_relat_pos[0], 1] pattern = re.compile('^[\d,\.]*?$') start_pos = list( np.where(df.iloc[:, hold_num_pos[0]].str.match(pattern) | df.iloc[:, hold_num_pos[0]].str.match('nan'))[0]) sharehold_names = list(df.iloc[start_pos[0]:start_pos[-1], sharehold_name_pos[0]]) hold_nums = list(df.iloc[start_pos[0]:start_pos[-1], hold_num_pos[0]]) types = list(df.iloc[start_pos[0]:start_pos[-1], type_pos[0]]) type_nums = list(df.iloc[start_pos[0]:start_pos[-1], type_pos[1]]) for (sharehold_name, hold_num, type, type_num) \ in zip(sharehold_names, hold_nums, types, type_nums): value_dict = dict( stk_cd_id=self.stk_cd_id, acc_per=self.acc_per, sharehold_name=sharehold_name, hold_num=hold_num if hold_num != 'nan' else 0, type=type, type_num=type_num if type_num != 'nan' else 0, ) create_and_update('TopTenUnlimitSharehold', **value_dict) save_instructi(unlimit_sharehold_relat, models.ChangInShareAndSharehold, self.stk_cd_id, self.acc_per, 'unlimit_sharehold_relat') else: pass if dfs.get('first') is not None: df = dfs.get('first') print(df) report_end_sharehold_num_pos = list( np.where(df.iloc[0, :].str.contains('报告期末普通股股东总数'))[0]) disclos_last_month_sharehold_num_pos = list( np.where(df.iloc[0, :].str.contains('报告披露日前上一月末普通股股东总数'))[0]) report_end_sharehold_num = df.iloc[ 0, report_end_sharehold_num_pos[0] + 1] disclos_last_month_sharehold_num = df.iloc[ 0, disclos_last_month_sharehold_num_pos[0] + 1] value_dict = dict( stk_cd_id=self.stk_cd_id, acc_per=self.acc_per, report_end_sharehold_num=report_end_sharehold_num, disclos_last_month_sharehold_num= disclos_last_month_sharehold_num, ) create_and_update('ChangInShareAndSharehold', **value_dict) else: pass
def save(self): dfs, unit, instructi = self.recognize() # print(dfs) if dfs.get('topten') is not None: df = dfs.get('topten') sharehold_name_pos = list( np.where(df.iloc[0, :].str.contains('股东名称'))[0]) increas_and_decreas_pos = list( np.where(df.iloc[0, :].str.contains('报告期内增减'))[0]) end_hold_num_pos = list( np.where(df.iloc[0, :].str.contains('期末持股数量'))[0]) ratio_pos = list(np.where(df.iloc[0, :].str.contains('比例'))[0]) restrict_share_pos = list( np.where(df.iloc[0, :].str.contains('持有有限售条件股份数量'))[0]) natur_of_sharehold_pos = list( np.where(df.iloc[0, :].str.contains('股东性质'))[0]) df = df.drop([0, 1]) sharehold_names = list(df.iloc[:, sharehold_name_pos[0]]) increas_and_decreases = list(df.iloc[:, increas_and_decreas_pos[0]]) end_hold_nums = list(df.iloc[:, end_hold_num_pos[0]]) ratios = list(df.iloc[:, ratio_pos[0]]) restrict_shares = list(df.iloc[:, restrict_share_pos[0]]) pledg_or_freez_statuses = list(df.iloc[:, (restrict_share_pos[0] + 1)]) pledg_or_freez_nums = list(df.iloc[:, (restrict_share_pos[0] + 2)]) natur_of_shareholds = list(df.iloc[:, (natur_of_sharehold_pos[0])]) for (sharehold_name, increas_and_decreas, end_hold_num, ratio, \ restrict_share,pledg_or_freez_status,pledg_or_freez_num,natur_of_sharehold) \ in zip(sharehold_names, increas_and_decreases, end_hold_nums, ratios, \ restrict_shares,pledg_or_freez_statuses,pledg_or_freez_nums,natur_of_shareholds ): value_dict = dict( stk_cd_id=self.stk_cd_id, acc_per=self.acc_per, sharehold_name=sharehold_name, increas_and_decreas=increas_and_decreas if increas_and_decreas != 'nan' else 0, end_hold_num=end_hold_num if end_hold_num != 'nan' else 0, ratio=num_to_decimal(ratio), restrict_share=restrict_share if restrict_share != 'nan' else 0, pledg_or_freez_status=pledg_or_freez_status, pledg_or_freez_num=pledg_or_freez_num if pledg_or_freez_num != 'nan' else 0, natur_of_sharehold=natur_of_sharehold, ) create_and_update('TopTenSharehold', **value_dict) else: pass if dfs.get('unlimit_sale') is not None: df = dfs.get('unlimit_sale') sharehold_name_pos = list( np.where(df.iloc[0, :].str.contains('股东名称'))[0]) hold_num_pos = list( np.where(df.iloc[0, :].str.contains('持有无限售条件流通股的数量'))[0]) sharehold_relat_pos = list( np.where(df.iloc[:, 0].str.contains('上述股东关联关系或一致行动的说明'))[0]) sharehold_relat = df.iloc[sharehold_relat_pos[0], 1] df = df.drop([0, 1, len(df) - 1]) sharehold_names = list(df.iloc[:, sharehold_name_pos[0]]) hold_nums = list(df.iloc[:, hold_num_pos[0]]) types = list(df.iloc[:, (hold_num_pos[0] + 1)]) type_nums = list(df.iloc[:, (hold_num_pos[0] + 2)]) for (sharehold_name,hold_num,type,type_num) \ in zip(sharehold_names,hold_nums,types,type_nums): value_dict = dict( stk_cd_id=self.stk_cd_id, acc_per=self.acc_per, sharehold_name=sharehold_name, hold_num=hold_num if hold_num != 'nan' else 0, type=type, type_num=type_num if type_num != 'nan' else 0, ) create_and_update('TopTenUnlimitSharehold', **value_dict) save_instructi(sharehold_relat, models.ChangInShareAndSharehold, self.stk_cd_id, self.acc_per, 'sharehold_relat') else: pass
def save(self): df, unit, instructi = recognize_df_and_instucti(self.indexcontent) if df is not None and len(df) > 0: quantiti_befor_chang_pos = list( np.where((df.iloc[0, :].str.contains('本次变动前')) & (df.iloc[1, :].str.contains('数量')))[0]) issu_new_share_pos = list( np.where(df.iloc[1, :].str.contains('发行新股'))[0]) give_share_pos = list( np.where(df.iloc[1, :].str.contains('送股'))[0]) turnov_from_cpf_pos = list( np.where(df.iloc[1, :].str.contains('公积金转股'))[0]) other_pos = list(np.where(df.iloc[1, :].str.contains('其他'))[0]) subtot_chang_pos = list( np.where(df.iloc[1, :].str.contains('小计'))[0]) quantiti_after_chang_pos = list( np.where((df.iloc[0, :].str.contains('本次变动后')) & (df.iloc[1, :].str.contains('数量')))[0]) choice_dict = { '一、有限售条件股份': 'restrict_sale', '1、国家持股': 'state_hold', '2、国有法人持股': 'state_own_legal_pers', '3、其他内资持股': 'other_domest_capit', '其中:境内非国有法人持股': 'domest_non_state_own', '境内自然人持股': 'domest_natur_person', '4、外资持股': 'foreign_hold', '其中:境外法人持股': 'oversea_legal_person', '境外自然人持股': 'oversea_natur_person', '二、无限售条件流通股份': 'unlimit_sale', '1、人民币普通股': 'rmb_ordinari_share', '2、境内上市的外资股': 'domest_list_foreign', '3、境外上市的外资股': 'overseas_list_foreig', '4、其他': 'others', '三、普通股股份总数': 'total_number', } df = df.drop([0, 1]) projects = [] for item in df.iloc[:, 0]: for key in choice_dict.keys(): if similar(str(item), str(key)): projects.append(choice_dict[key]) quantiti_befor_changs = list(df.iloc[:, quantiti_befor_chang_pos[0]]) issu_new_shares = list(df.iloc[:, issu_new_share_pos[0]]) give_shares = list(df.iloc[:, give_share_pos[0]]) turnov_from_cpfs = list(df.iloc[:, turnov_from_cpf_pos[0]]) others = list(df.iloc[:, other_pos[0]]) subtot_changs = list(df.iloc[:, subtot_chang_pos[0]]) quantiti_after_changs = list(df.iloc[:, quantiti_after_chang_pos[0]]) for (project,quantiti_befor_chang,issu_new_share,give_share,turnov_from_cpf, other,subtot_chang ,quantiti_after_chang) \ in zip(projects,quantiti_befor_changs,issu_new_shares,give_shares,turnov_from_cpfs, others,subtot_changs ,quantiti_after_changs): value_dict = dict( stk_cd_id=self.stk_cd_id, acc_per=self.acc_per, name=project, quantiti_befor_chang=quantiti_befor_chang if quantiti_befor_chang != 'nan' else 0, issu_new_share=issu_new_share if issu_new_share != 'nan' else 0, give_share=give_share if give_share != 'nan' else 0, turnov_from_cpf=turnov_from_cpf if turnov_from_cpf != 'nan' else 0, other=other if other != 'nan' else 0, subtot_chang=subtot_chang if subtot_chang != 'nan' else 0, quantiti_after_chang=quantiti_after_chang if quantiti_after_chang != 'nan' else 0, ) create_and_update('ChangInOrdinariShare', **value_dict) else: pass save_instructi(instructi, models.ChangInShareAndSharehold, self.stk_cd_id, self.acc_per, 'change_desc')