问答交流

【代码报错】ValueError: NaTType does not support strftime

由bq6yiat7创建,最终由small_q 被浏览 9 用户

因子分析框架运行问题

当我运行以下因子分析框架代码的时候,总是出现一个问题,即:ValueError Traceback (most recent call last) Cell In[6], line 1 ----> 1 alpha_instance = AlphaMiner(params=params, factor_data=factor_data) 2 report_html = alpha_instance.render() Cell In[5], line 41 38 print("数据格式检查失败:" + str(e)) 40 # 进行数据池过滤 ---> 41 self.stock_pool_filter() **42 t2 = time.time() 43 print('耗时:{0}**秒 股票池过滤完成'.format(np.round(t2-t1))) Cell In[5], line 130 127 factor_data.dropna(inplace=True) 128 return factor_data[columns] --> 130 self.factor_data = factor_data_filter(merge_df) Cell In[5], line 117 115 def factor_data_filter(factor_data): 116 columns = factor_data.columns --> 117 start_date = factor_data.date.min().strftime('%Y-%m-%d') 118 end_date = factor_data.date.max().strftime('%Y-%m-%d') 119 factor_data['instrument'] = factor_data['instrument'].apply(lambda x:x[:9]) File nattype.pyx:54, in pandas._libs.tslibs.nattype._make_error_func.f() ValueError: NaTType does not support strftime

但是我找不出问题,麻烦老师解答一下,谢谢。

https://bigquant.com/codesharev3/4c865bed-11bd-4cf8-be08-50a5ec45e432

\

标签

因子分析
{link}