siat 3.0.10__py3-none-any.whl → 3.0.20__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
siat/financials_china.py CHANGED
@@ -4,7 +4,7 @@
4
4
  所属工具包:证券投资分析工具SIAT
5
5
  SIAT:Security Investment Analysis Tool
6
6
  创建日期:2020年9月8日
7
- 最新修订日期:2020915
7
+ 最新修订日期:2024421
8
8
  作者:王德宏 (WANG Dehong, Peter)
9
9
  作者单位:北京外国语大学国际商学院
10
10
  作者邮件:wdehong2000@163.com
@@ -45,7 +45,7 @@ plt.rcParams['axes.unicode_minus'] = False
45
45
  import pandas as pd
46
46
  import akshare as ak
47
47
 
48
- #STOCK_SUFFIX_CHINA=['SS','SZ','BJ','NQ']
48
+ #SUFFIX_LIST_CN=['SS','SZ','BJ','NQ']
49
49
  #==============================================================================
50
50
  #==============================================================================
51
51
  if __name__=='__main__':
@@ -67,7 +67,7 @@ def get_fin_stmt_ak(ticker):
67
67
  print(" Searching financial statements for",ticker,"...")
68
68
  #是否中国股票
69
69
  result,prefix,suffix=split_prefix_suffix(ticker)
70
- if not (suffix in STOCK_SUFFIX_CHINA):
70
+ if not (suffix in SUFFIX_LIST_CN):
71
71
  print(" #Error(get_fin_stmt_ak): not a stock in China",ticker)
72
72
  return None
73
73
 
@@ -275,11 +275,17 @@ def get_fin_stmt_ak(ticker):
275
275
 
276
276
  if not ('短期现金偿债能力%' in fslist):
277
277
  #fs4['短期现金偿债能力%']=round((fs4['经营活动现金流净额'] / fs4['流动负债合计'])*100,2)
278
- fs4['短期现金偿债能力%']=fs4.apply(lambda x: round((x['经营活动现金流净额'] / x['流动负债合计'])*100,2),axis=1)
278
+ try:
279
+ fs4['短期现金偿债能力%']=fs4.apply(lambda x: round((x['经营活动现金流净额'] / x['流动负债合计'])*100,2),axis=1)
280
+ except:
281
+ fs4['短期现金偿债能力%']=np.nan
279
282
 
280
283
  if not ('长期现金偿债能力%' in fslist):
281
- #fs4['长期现金偿债能力%']=round((fs4['经营活动现金流净额'] / fs4['负债合计'])*100,2)
282
- fs4['长期现金偿债能力%']=fs4.apply(lambda x: round((x['经营活动现金流净额'] / x['负债合计'])*100,2),axis=1)
284
+ #fs4['长期现金偿债能力%']=round((fs4['经营活动现金流净额'] / fs4['负债合计'])*100,2)
285
+ try:
286
+ fs4['长期现金偿债能力%']=fs4.apply(lambda x: round((x['经营活动现金流净额'] / x['负债合计'])*100,2),axis=1)
287
+ except:
288
+ fs4['长期现金偿债能力%']==np.nan
283
289
 
284
290
  if not ('流通股股数' in fslist):
285
291
  for gs in ['实收资本(或股本)','股本']:
@@ -648,7 +654,8 @@ if __name__=='__main__':
648
654
  hatchlist=['.', 'o', '\\']
649
655
 
650
656
  def compare_dupont_china(tickerlist,fsdate='latest',scale1 = 10,scale2 = 10, \
651
- hatchlist=['.', 'o', '\\'],printout=True,sort='PM'):
657
+ hatchlist=['.', 'o', '\\'],printout=True,sort='PM', \
658
+ facecolor='papayawhip'):
652
659
  """
653
660
  功能:获得tickerlist中每只股票的杜邦分析项目,绘制柱状叠加比较图
654
661
  tickerlist:股票代码列表,建议在10只以内
@@ -792,8 +799,11 @@ def compare_dupont_china(tickerlist,fsdate='latest',scale1 = 10,scale2 = 10, \
792
799
  footnote1="2、表中数值基于期末数字直接计算,而非期初期末均值,可能与公告数字存在差异。"
793
800
  footnote2="*** 数据来源:sina/EM,"+str(today)
794
801
  footnote=footnote0+'\n'+footnote1+'\n'+footnote2
795
- df_directprint(df,title_txt,footnote)
802
+
796
803
  #print(df.to_string(index=False))
804
+ #df_directprint(df,title_txt,footnote)
805
+ df_display_CSS(df=df,titletxt=title_txt,footnote=footnote, \
806
+ facecolor=facecolor,decimals=4)
797
807
 
798
808
 
799
809
  #合并所有历史记录
@@ -832,7 +842,7 @@ def get_fin_abstract_ak(ticker):
832
842
 
833
843
  #是否中国股票
834
844
  result,prefix,suffix=split_prefix_suffix(ticker)
835
- if not (suffix in STOCK_SUFFIX_CHINA):
845
+ if not (suffix in SUFFIX_LIST_CN):
836
846
  print(" #Warning(get_fin_abstract_ak): not a stock in China",ticker)
837
847
  return None
838
848
 
@@ -900,7 +910,7 @@ def get_fin_indicator_ak(ticker):
900
910
 
901
911
  #是否中国股票
902
912
  result,prefix,suffix=split_prefix_suffix(ticker)
903
- if not (suffix in STOCK_SUFFIX_CHINA):
913
+ if not (suffix in SUFFIX_LIST_CN):
904
914
  print(" #Warning(get_fin_indicator_ak): not a stock in China",ticker)
905
915
  return None
906
916
 
@@ -991,7 +1001,7 @@ def get_fin_performance_ak(ticker,endDate):
991
1001
  """
992
1002
  #是否中国股票
993
1003
  result,prefix,suffix=split_prefix_suffix(ticker)
994
- if not (suffix in STOCK_SUFFIX_CHINA):
1004
+ if not (suffix in SUFFIX_LIST_CN):
995
1005
  print(" #Warning(get_fin_performance_ak): not a stock in China",ticker)
996
1006
  return None
997
1007
 
@@ -1378,7 +1388,7 @@ def industry_rank_em2(tickers,rates=['eps','naps'],industry="银行",top=10):
1378
1388
  for t in tickers_selected:
1379
1389
  #是否中国股票
1380
1390
  result,prefix,suffix=split_prefix_suffix(t)
1381
- if not (suffix in STOCK_SUFFIX_CHINA) and not (tickers == ''):
1391
+ if not (suffix in SUFFIX_LIST_CN) and not (tickers == ''):
1382
1392
  print(" #Warning(industry_rank_em2): not a stock in China",t)
1383
1393
  error_flag=True
1384
1394
  stocks_selected=stocks_selected+[prefix]
@@ -1597,7 +1607,7 @@ def get_fin_performance_akm(tickers,endDate):
1597
1607
  prefix_list=[]
1598
1608
  for t in tickers:
1599
1609
  result,prefix,suffix=split_prefix_suffix(t)
1600
- if not (suffix in STOCK_SUFFIX_CHINA):
1610
+ if not (suffix in SUFFIX_LIST_CN):
1601
1611
  print(" #Warning(get_fin_performance_akm): not a stock in China",t)
1602
1612
  return None
1603
1613
  prefix_list=prefix_list+[prefix]
@@ -1945,7 +1955,7 @@ def prepare_fin_rate1t2r_china(ticker,rate1,rate2,start,end,period_type='all'):
1945
1955
 
1946
1956
  #是否中国股票
1947
1957
  result,prefix,suffix=split_prefix_suffix(ticker)
1948
- if not (suffix in STOCK_SUFFIX_CHINA):
1958
+ if not (suffix in SUFFIX_LIST_CN):
1949
1959
  print(" #Warning(prepare_fin_rate1t2r_china): not a stock in China",ticker)
1950
1960
  return None,None
1951
1961
 
@@ -2066,7 +2076,7 @@ def prepare_fin_rate1tmr_china(ticker,rates,start,end,period_type='all'):
2066
2076
 
2067
2077
  #是否中国股票
2068
2078
  result,prefix,suffix=split_prefix_suffix(ticker)
2069
- if not (suffix in STOCK_SUFFIX_CHINA):
2079
+ if not (suffix in SUFFIX_LIST_CN):
2070
2080
  print(" #Warning(prepare_fin_rate1tmr_china): not a stock in China",ticker)
2071
2081
  return None
2072
2082
 
@@ -2177,7 +2187,7 @@ def prepare_fin_ratemt1r_china(tickers,rate,start,end,period_type='all'):
2177
2187
  prefix_list=[]
2178
2188
  for t in mticker_list:
2179
2189
  result,prefix,suffix=split_prefix_suffix(t)
2180
- if not (suffix in STOCK_SUFFIX_CHINA):
2190
+ if not (suffix in SUFFIX_LIST_CN):
2181
2191
  print(" #Warning(prepare_fin_ratemt1r_china): not a stock in China",ticker)
2182
2192
  return None
2183
2193
  prefix_list=prefix_list+[prefix]
@@ -2257,11 +2267,11 @@ def cn_codetranslate(ticker):
2257
2267
  注意:既能转换带后缀的股票代码,也能转换不带后缀的股票代码
2258
2268
  """
2259
2269
  result,prefix,suffix=split_prefix_suffix(ticker)
2260
- if suffix in STOCK_SUFFIX_CHINA:
2270
+ if suffix in SUFFIX_LIST_CN:
2261
2271
  name=ticker_name(ticker)
2262
2272
 
2263
2273
  if suffix =='':
2264
- for s in STOCK_SUFFIX_CHINA:
2274
+ for s in SUFFIX_LIST_CN:
2265
2275
  ticker_try=ticker+'.'+s
2266
2276
  name=ticker_name(ticker_try)
2267
2277
  print('\b'*99," Looking for the short name of stock",ticker)
@@ -2805,7 +2815,7 @@ if __name__=='__main__':
2805
2815
 
2806
2816
  g=dupont_decompose_china(ticker,fsdate)
2807
2817
 
2808
- def dupont_decompose_china(ticker,fsdate,gview=False):
2818
+ def dupont_decompose_china(ticker,fsdate,gview=False,facecolor='papayawhip'):
2809
2819
  """
2810
2820
  功能:杜邦分析分解图
2811
2821
  ticker: 股票代码
@@ -2965,7 +2975,7 @@ def dupont_decompose_china(ticker,fsdate,gview=False):
2965
2975
  """
2966
2976
  #是否中国股票
2967
2977
  result,prefix,suffix=split_prefix_suffix(ticker)
2968
- if not (suffix in STOCK_SUFFIX_CHINA):
2978
+ if not (suffix in SUFFIX_LIST_CN):
2969
2979
  print(" #Error(dupont_decompose_china): not a stock in China",ticker)
2970
2980
  return None
2971
2981
 
@@ -3529,7 +3539,7 @@ if __name__=='__main__':
3529
3539
  tickers=['000002.SZ','600048.SS','001979.SZ','600325.SS','000069.SZ','600383.SS','600895.SS','601155.SS']
3530
3540
  fsdates='2022-12-31'
3531
3541
 
3532
- def compare_fin_summary_china(tickers,fsdates):
3542
+ def compare_fin_summary_china(tickers,fsdates,facecolor='whitesmoke'):
3533
3543
  """
3534
3544
  功能:分类别显示财报摘要中的指标
3535
3545
  """
@@ -3614,14 +3624,14 @@ def compare_fin_summary_china(tickers,fsdates):
3614
3624
 
3615
3625
  # 注释
3616
3626
  notesdict={'常用指标': \
3617
- '\n注:\n'+ \
3627
+ '注:\n'+ \
3618
3628
  '1. 毛利率=毛利润 / 营业(总)收入 ×100% \n'+ \
3619
3629
  '2. 毛利润=营业(总)收入-营业(总)成本 \n'+ \
3620
3630
  '3. 销售净利率=净利润 / 营业(总)收入 ×100% \n'+ \
3621
3631
  '4. 期间费用率=期间费用 / 营业(总)收入 ×100%,期间费用包括管理费用,销售费用和财务费用。 \n', \
3622
3632
 
3623
3633
  '每股指标': \
3624
- '\n注:\n'+ \
3634
+ '注:\n'+ \
3625
3635
  '1. 稀释每股指标:假设企业所有发行在外的稀释性潜在普通股期间内均转换为普通股,导致普通股股数增加 \n'+ \
3626
3636
  '2. 潜在普通股:指赋予其持有者在报告期或以后期间享有取得普通股权利的金融工具或者其他合同,例如公司可转债、认股权证、股份期权等 \n'+ \
3627
3637
  '3. 摊薄每股指标:使用期末数值计算,而非期初期末均值,其结果更能反应期末情况,可能大于、小于或等于每股指标 \n'+ \
@@ -3639,13 +3649,13 @@ def compare_fin_summary_china(tickers,fsdates):
3639
3649
  '15.(企业)自由现金流可以理解为归属于股东与债权人的最大现金流,而股东(股权)自由现金流则是归属于股东的最大现金流。 \n', \
3640
3650
 
3641
3651
  '营运能力': \
3642
- '\n注:\n'+ \
3652
+ '注:\n'+ \
3643
3653
  '1. 指标周转率/周转次数:营业(总)收入 / 指标的起初期末均值。一般来说数值越大越好 \n'+ \
3644
3654
  '2. 指标周转天数:360/周转率(或周转次数)。一般来说数值越小越好 \n'+ \
3645
3655
  '3. 注意:本表指标主要针对非金融行业,部分指标不适用于金融行业。 \n', \
3646
3656
 
3647
3657
  '盈利能力':
3648
- '\n注:\n'+ \
3658
+ '注:\n'+ \
3649
3659
  '1. 毛利润=营业(总)收入-营业(总)成本 \n'+ \
3650
3660
  '2. 营业利润=毛利润-营业税金及附加-期间费用-资产减值损失+公允价值变动损益+投资损益 \n'+ \
3651
3661
  '3. 营业利润率=营业利润 / 营业(总)收入 x100% \n'+ \
@@ -3669,18 +3679,18 @@ def compare_fin_summary_china(tickers,fsdates):
3669
3679
  '21.投入资本回报率的意义:更多地从投资而非财务角度看,每单位投资的资本所能赚取息税前利润的多少。 \n', \
3670
3680
 
3671
3681
  '收益质量':
3672
- '\n注:\n'+ \
3682
+ '注:\n'+ \
3673
3683
  '1. 销售成本率=营业(总)成本 / 营业(总)收入 x100%,=1-毛利润 \n'+ \
3674
3684
  '2. 成本费用率=(营业(总)成本+期间费用) / 营业(总)收入 x100%,=销售成本率+期间费用率,可评价企业对成本费用的控制能力 \n'+ \
3675
3685
  '3. 期间费用率=期间费用 / 营业(总)收入 x100% \n',
3676
3686
 
3677
3687
  '成长能力':
3678
- '\n注:\n'+ \
3688
+ '注:\n'+ \
3679
3689
  '1. 扣费(后)净利润=净利润-非经常性损益,即扣除了偶然的不可持续或不常发生的收益,可持续性更强,可能大于或小于净利润 \n'+ \
3680
3690
  '2. 归属母公司净利润:简称归母净利润,指企业合并报表中归属控股公司(母公司)的利润,不包括归属子公司中非控股股东的利润。 \n',
3681
3691
 
3682
3692
  '财务风险':
3683
- '\n注:\n'+ \
3693
+ '注:\n'+ \
3684
3694
  '1. 保守速动比率:又称超速动比率,=(现金+短期证券投资+应收账款净额) / 流动负债,比速动比能够更好地评价企业短期偿债能力 \n'+ \
3685
3695
  '2. 应收账款净额:指应收账款和其他应收款减去备抵坏账的净额,实质即为信誉高客户的应收款净额 \n'+ \
3686
3696
  '3. 产权比率(equity ratio)=负债总额 / 所有者权益总额(净资产) x100%,从一个方面说明企业长期偿债能力,越高越弱 \n'+ \
@@ -3691,8 +3701,11 @@ def compare_fin_summary_china(tickers,fsdates):
3691
3701
  # 一只股票情形:多日期
3692
3702
  if len(tickers_found) == 1:
3693
3703
  ticker1=tickers[0]
3704
+ """
3694
3705
  titletxt="\n===== 上市公司财务报表摘要:"+ticker_name(ticker1)+" ====="
3695
3706
  print(titletxt)
3707
+ """
3708
+ titletxt=ticker_name(ticker1)+':'+"财报摘要"
3696
3709
 
3697
3710
  fsdf1=fsdf[fsdf['ticker']==ticker1]
3698
3711
  for ty in typelist:
@@ -3707,11 +3720,15 @@ def compare_fin_summary_china(tickers,fsdates):
3707
3720
  dft.index=dft.index + 1
3708
3721
  dft2=dft.drop(labels=['选项','ticker'],axis=1)
3709
3722
 
3723
+ """
3710
3724
  print("\n***",ty+':')
3711
3725
  colalign=['center','left']+['right']*(len(list(dft2)) - 1)
3712
3726
  print(dft2.to_markdown(tablefmt='Simple',index=True,colalign=colalign))
3713
3727
  print(notesdict[ty])
3714
-
3728
+ """
3729
+ titletxt1=titletxt+','+ty
3730
+ df_display_CSS(df=dft2,titletxt=titletxt1,footnote=notesdict[ty], \
3731
+ facecolor=facecolor,decimals=2)
3715
3732
 
3716
3733
  # 多只股票情形:单日期
3717
3734
  import pandas as pd
@@ -3723,9 +3740,12 @@ def compare_fin_summary_china(tickers,fsdates):
3723
3740
  fsdates3=sorted(fsdates2,reverse=True)
3724
3741
 
3725
3742
  if len(tickers_found) > 1:
3743
+ """
3726
3744
  titletxt="\n===== 上市公司财务报表摘要对比:报表日期"+fsdates3[0]+" ====="
3727
3745
  print('\n'+titletxt)
3728
-
3746
+ """
3747
+ titletxt="财报摘要:报表日"+fsdates3[0]
3748
+
3729
3749
  mdf=pd.DataFrame()
3730
3750
  for t in tickers_found:
3731
3751
  dft=fsdf[fsdf['ticker']==t]
@@ -3752,12 +3772,16 @@ def compare_fin_summary_china(tickers,fsdates):
3752
3772
  dft.reset_index(drop=True,inplace=True)
3753
3773
  dft.index=dft.index + 1
3754
3774
  dft2=dft.drop(labels=['选项'],axis=1)
3755
-
3775
+ """
3756
3776
  print("\n***",ty+':')
3757
3777
  colalign=['center','left']+['right']*(len(list(dft2)) - 1)
3758
3778
  print(dft2.to_markdown(tablefmt='Simple',index=True,colalign=colalign))
3759
3779
  print(notesdict[ty])
3760
-
3780
+ """
3781
+ titletxt1=titletxt+','+ty
3782
+ df_display_CSS(df=dft2,titletxt=titletxt1,footnote=notesdict[ty], \
3783
+ facecolor=facecolor,decimals=2)
3784
+
3761
3785
  return dft2
3762
3786
 
3763
3787
  #==============================================================================
@@ -3952,7 +3976,7 @@ if __name__=='__main__':
3952
3976
  '2018-12-31',
3953
3977
  ]
3954
3978
 
3955
- def compare_fin_indicator_china(tickers,fsdates):
3979
+ def compare_fin_indicator_china(tickers,fsdates,facecolor='papayawhip'):
3956
3980
  """
3957
3981
  功能:分类别显示财报摘要中的指标
3958
3982
  """
@@ -4077,12 +4101,12 @@ def compare_fin_indicator_china(tickers,fsdates):
4077
4101
 
4078
4102
  # 注释
4079
4103
  notesdict={'规模指标': \
4080
- '\n注:\n'+ \
4104
+ '注:\n'+ \
4081
4105
  '1. 短期=一年以内,长期=一年以上 \n'+ \
4082
4106
  '2. 非经常性损益=非经常性或偶然活动带来的损益,一般不可持续。 \n', \
4083
4107
 
4084
4108
  '利润回报': \
4085
- '\n注:\n'+ \
4109
+ '注:\n'+ \
4086
4110
  '1. 销售毛利率=毛利率=毛利润/营业(总)收入*100%,毛利润=营业(总)收入-营业(总)成本 \n'+ \
4087
4111
  '2. 主营业务利润率=主营业务利润/主营业务收入*100%,主营业务利润=主营业务收入-主营业务成本-主营业务税金及附加 \n'+ \
4088
4112
  '3. 营业利润率=营业利润/营业(总)收入*100%,营业利润=主营业务利润+其他业务利润-期间费用+其他损益 \n'+ \
@@ -4106,7 +4130,7 @@ def compare_fin_indicator_china(tickers,fsdates):
4106
4130
  '21.股息发放率=股利支付率=股利/净利润*100%,反映公司的股利分配政策,比例高表明公司不需更多的资金进行再投入。 \n', \
4107
4131
 
4108
4132
  '每股指标': \
4109
- '\n注:\n'+ \
4133
+ '注:\n'+ \
4110
4134
  '1. 每股收益=净利润/流通股数量,其中流通股数量按期初期末均值计算 \n'+ \
4111
4135
  '2. 扣除非经常性损益后的每股收益=扣除非经常性损益后的净利润/流通股数量 \n'+ \
4112
4136
  '3. 加权每股收益=净利润/加权流通股数量,加权流通股数量含期间内流通股数量的变化(增发新股、送股、转增股本或配股等) \n'+ \
@@ -4118,20 +4142,20 @@ def compare_fin_indicator_china(tickers,fsdates):
4118
4142
  '9. 每股资本公积金=资本公积金/流通股数量,资本公积金含发行股份的溢价、资产重估增值、接受捐赠等,仅可用于转增股本。 \n', \
4119
4143
 
4120
4144
  '营运能力':
4121
- '\n注:\n'+ \
4145
+ '注:\n'+ \
4122
4146
  '1. 指标周转率/周转次数:营业(总)收入 / 指标的起初期末均值,从企业自身角度来说越大越好,但若涉及供应商则可能相反 \n'+ \
4123
4147
  '2. 指标周转天数:360/周转率(或周转次数),从企业自身角度来说越小越好,但若涉及供应商则可能相反 \n'+ \
4124
4148
  '3. 注意:本表指标主要针对非金融行业,部分指标不适用于金融行业。 \n', \
4125
4149
 
4126
4150
  '现金指标':
4127
- '\n注:\n'+ \
4151
+ '注:\n'+ \
4128
4152
  '1. 现金流量比率=经营活动产生的现金净流量/期末流动负债*100%,反映企业短期偿债能力 \n'+ \
4129
4153
  '2. 经营现金净流量对销售收入比率=销售现金比率,与赊销政策有关,若企业有虚假收入,也会使该指标过低 \n'+ \
4130
4154
  '3. 资产的经营现金流量回报率=经营现金流量净额/总资产*100%,体现企业经营活动的收现能力 \n'+ \
4131
4155
  '4. 经营现金净流量与净利润的比率=净现比=经营现金流量净额/净利润*100%。比率越大,企业盈利质量越高。 \n',
4132
4156
 
4133
4157
  '偿债能力':
4134
- '\n注:\n'+ \
4158
+ '注:\n'+ \
4135
4159
  '1. 流动比率=流动资产/流动负债,反映企业的短期偿债能力,属于宽松指标 \n'+ \
4136
4160
  '2. 速动比率=(流动资产-存货)/流动负债,反映企业的短期偿债能力,属于较严的指标 \n'+ \
4137
4161
  '3. 现金比率=(货币资金+短期有价证券)/流动负债*100%,反映企业的短期偿债能力,属于严厉的指标 \n'+ \
@@ -4146,17 +4170,17 @@ def compare_fin_indicator_china(tickers,fsdates):
4146
4170
  '12. 经营现金净流量对负债比率=现金流量负债比=经营活动现金流量净额/负债总额*100%,比率越高,财务弹性越好。 \n',
4147
4171
 
4148
4172
  '应收账款':
4149
- '\n注:\n'+ \
4173
+ '注:\n'+ \
4150
4174
  '1. 使用账龄法对应收账款/其他应收款分类 \n'+ \
4151
4175
  '2. 一般而言,应收款项的账龄越长,成为呆坏账的可能性就越大。 \n',
4152
4176
 
4153
4177
  '预付账款':
4154
- '\n注:\n'+ \
4178
+ '注:\n'+ \
4155
4179
  '1. 一般而言,预付款项数额越大,企业在供应链中的地位越低 \n'+ \
4156
4180
  '2. 一般而言,预付款项的账龄越长,企业在供应链中的地位越低。 \n',
4157
4181
 
4158
4182
  '其他指标':
4159
- '\n注:\n'+ \
4183
+ '注:\n'+ \
4160
4184
  '1. 长期资产与长期资金比率=非流动资产/(长期负债+股东权益)*100%,长期资金少,流动负债较多,财务风险较大 \n'+ \
4161
4185
  '2. 资本化比率=长期负债/(长期负债+股东权益)*100%,指标值越小,负债的资本化程度就越低,长期偿债压力就越小 \n'+ \
4162
4186
  '3. 固定资产净值率=(固定资产原值-累计折旧)/固定资产原值*100%,反映企业全部固定资产平均新旧程度 \n'+ \
@@ -4173,8 +4197,11 @@ def compare_fin_indicator_china(tickers,fsdates):
4173
4197
  # 一只股票情形:多日期
4174
4198
  if len(tickers_found) == 1:
4175
4199
  ticker1=tickers[0]
4200
+ """
4176
4201
  titletxt="\n===== 上市公司主要财务比率和重要指标:"+ticker_name(ticker1)+" ====="
4177
4202
  print(titletxt)
4203
+ """
4204
+ titletxt="主要财务比率和指标:"+ticker_name(ticker1)
4178
4205
 
4179
4206
  fsdf1=fsdf[fsdf['ticker']==ticker1]
4180
4207
  for ty in typelist:
@@ -4199,16 +4226,19 @@ def compare_fin_indicator_china(tickers,fsdates):
4199
4226
  dft2.reset_index(drop=True,inplace=True)
4200
4227
  dft2.index=dft2.index + 1
4201
4228
  dft3=dft2.drop(labels=['选项','ticker'],axis=1)
4202
-
4229
+ """
4203
4230
  print("\n***",ty+':')
4204
4231
  colalign=['center','left']+['right']*(len(list(dft3)) - 1)
4205
4232
  print(dft3.to_markdown(tablefmt='Simple',index=True,colalign=colalign))
4233
+ print(notesdict[ty])
4234
+ """
4206
4235
  """
4207
4236
  注意:若dft3为空,则会出现错误:list assignment index out of range
4208
4237
  无论如何修改colalign都没用
4209
4238
  """
4210
-
4211
- print(notesdict[ty])
4239
+ titletxt1=titletxt+','+ty
4240
+ df_display_CSS(df=dft3,titletxt=titletxt1,footnote=notesdict[ty], \
4241
+ facecolor=facecolor,decimals=2)
4212
4242
 
4213
4243
  return dft3
4214
4244
 
@@ -4238,9 +4268,11 @@ def compare_fin_indicator_china(tickers,fsdates):
4238
4268
  mdf=dft2
4239
4269
  else:
4240
4270
  mdf=mdf.merge(dft2,how='outer',left_on=['选项','指标'], right_on=['选项','指标'])
4241
-
4271
+ """
4242
4272
  titletxt="\n===== 上市公司财务报表主要比率和重要项目对比:报表日期"+fsdates3[0]+" ====="
4243
4273
  print('\n'+titletxt)
4274
+ """
4275
+ titletxt="主要财务比率和指标:报表日"+fsdates3[0]
4244
4276
 
4245
4277
  for ty in typelist:
4246
4278
  dft=mdf[mdf['选项']==ty]
@@ -4256,11 +4288,15 @@ def compare_fin_indicator_china(tickers,fsdates):
4256
4288
  dft2.reset_index(drop=True,inplace=True)
4257
4289
  dft2.index=dft2.index + 1
4258
4290
  dft3=dft2.drop(labels=['选项'],axis=1)
4259
-
4291
+ """
4260
4292
  print("\n***",ty+':')
4261
4293
  colalign=['center','left']+['right']*(len(list(dft3))-2)
4262
4294
  print(dft3.to_markdown(tablefmt='Simple',index=True,colalign=colalign))
4263
4295
  print(notesdict[ty])
4296
+ """
4297
+ titletxt1=titletxt+','+ty
4298
+ df_display_CSS(df=dft3,titletxt=titletxt1,footnote=notesdict[ty], \
4299
+ facecolor=facecolor,decimals=2)
4264
4300
 
4265
4301
  return dft3
4266
4302