KKKMatthias commited on
Commit
ee5c0b1
·
verified ·
1 Parent(s): 1fdcb21

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -10
app.py CHANGED
@@ -44,13 +44,8 @@ def get_stock(ticker: str):
44
  # 假设数据按时间升序排列,第0行是当前年,第1行是明年
45
  # 注意:有时 yfinance 返回的顺序可能是反的,或者包含季度数据,
46
  # 但 earnings_estimate 通常是年度数据且按时间排序。
47
- #eps_est_current = est.iloc[2]['avg'] # 当前财年
48
- #eps_est_next = est.iloc[3]['avg'] # 下一财年
49
-
50
- if '0Y' in est.index:
51
- eps_est_current = est.loc['0Y'].get('avg')
52
- if '+1Y' in est.index:
53
- eps_est_next = est.loc['+1Y'].get('avg')
54
 
55
  except Exception as e:
56
  print(f"Error parsing dataframe: {e}")
@@ -71,9 +66,7 @@ def get_stock(ticker: str):
71
 
72
  if ept is not None and not ept.empty:
73
  try:
74
- if '0Y' in ept.index:
75
- eps_current = ept.loc['0Y'].get('Current Estimate') # 当前财年
76
-
77
  except Exception as e:
78
  print(f"Error parsing dataframe: {e}")
79
 
 
44
  # 假设数据按时间升序排列,第0行是当前年,第1行是明年
45
  # 注意:有时 yfinance 返回的顺序可能是反的,或者包含季度数据,
46
  # 但 earnings_estimate 通常是年度数据且按时间排序。
47
+ eps_est_current = est.iloc[2]['avg'] # 当前财年
48
+ eps_est_next = est.iloc[3]['avg'] # 下一财年
 
 
 
 
 
49
 
50
  except Exception as e:
51
  print(f"Error parsing dataframe: {e}")
 
66
 
67
  if ept is not None and not ept.empty:
68
  try:
69
+ eps_current = ept.iloc[2][0] # 当前财年
 
 
70
  except Exception as e:
71
  print(f"Error parsing dataframe: {e}")
72