是你这个代码中pro_daily_stock这个函数的问题吧,这段代码中有这个函数吗
你这个pro_daily_stock这里报错,这个函数不是tushare里面的函数,需要你自己写的:
def pro_daily_stock(code_val,start_val ,end_val):
#获取日行情
df_stock = pro.daily( ts_code=code_val,start_date=start_val, end_date=end_val)
#修改时间格式
df_stock.trade_date = pd.DatetimeIndex(df_stock.trade_date)
df_stock.set_index('trade_date',drop = True,inplace = True)
df_stock.sort_index(inplace = True)
df_stock.index = df_stock.index.set_names('Date')
#聚合
recon_data = {'Open': df_stock.open, 'Close': df_stock.close, 'High': df_stock.high, 'Low': df_stock.low,'Volume': df_stock.vol}
df_stock = pd.DataFrame(recon_data)
#返回
return df_stock
1.%s :string(字符串)型
2.%d :int(整数)型
3.%f : float(浮点数)型
age = (input("你的年龄:"))
try:
s = "yourage:%d" % eval(age)
except:
print("你输入的不是数字哦。")