factor优化(暂存版)
This commit is contained in:
@@ -33,7 +33,7 @@ def holder_trade_factors(all_data_df: pd.DataFrame,
|
||||
# 或者如果 'in_de' 已经是 1 和 -1 (或类似数值),则可以跳过映射,但要确保类型正确
|
||||
stk_trade_processed_df['_direction'] = stk_trade_processed_df['in_de'].map(in_de_map)
|
||||
# 如果 _direction 列在映射后可能产生NaN (因为in_de中有未覆盖的值),需要处理
|
||||
if stk_trade_processed_df['_direction'].isnull().any():
|
||||
if stk_trade_processed_df['_direction'].is_null().any():
|
||||
print("警告: 'in_de' 列中存在未映射的值,可能导致 _direction 列出现NaN。")
|
||||
# 可以选择填充NaN,例如用0填充,或者移除这些行
|
||||
# stk_trade_processed_df['_direction'].fillna(0, inplace=True)
|
||||
@@ -109,4 +109,3 @@ def holder_trade_factors(all_data_df: pd.DataFrame,
|
||||
|
||||
print("股东增减持因子计算完成。")
|
||||
return df_merged
|
||||
|
||||
|
||||
Reference in New Issue
Block a user