Skip to content

Commit

Permalink
默认^表示异或
Browse files Browse the repository at this point in the history
  • Loading branch information
wukan1986 committed Nov 7, 2024
1 parent ac4b493 commit d0f436c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ df = codegen_exec(df, _code_block_1, _code_block_2) # 只执行,不保存代
1. `(A<B)*-1`,底层将转换成`int_(A<B)*-1`
2. 支持`C?T:F`三元表达式(只能在字符串中使用),Python只支持`T if C else F`, 而在本项目中会自动转成`if_else(C,T,F)`
3. 为防止`A==B``sympy`替换成`False`,底层会换成`Eq(A,B)`
4. `A^B`的含义与`convert_xor`参数有关,`convert_xor=True`底层会转换成`Pow(A,B)`,反之为`Xor(A,B)`
4. `A^B`的含义与`convert_xor`参数有关,`convert_xor=True`底层会转换成`Pow(A,B)`,反之为`Xor(A,B)`。默认为`False`,用`**`表示乘方
5. 支持`A&B&C`,但不支持`A==B==C`。如果C是布尔,AB是数值,可以替换成`(A==B)==C`。如果ABC是数值需手工替换成`(A==B)&(B==C)`
6. 不支持`A<=B<=C`,需手工替换成`(A<=B)&(B<=C)`
7. 支持`A[0]+B[1]+C[2]`,底层会转成`A+ts_delay(B,1)+ts_delay(C,2)`
Expand Down
2 changes: 1 addition & 1 deletion expr_codegen/tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ def codegen_exec(df,
*codes,
extra_codes: str = r'CS_SW_L1 = pl.col(r"^sw_l1_\d+$")',
output_file: Optional[str] = None,
convert_xor: bool = True,
convert_xor: bool = False,
style: str = 'polars', template_file: str = 'template.py.j2',
date: str = 'date', asset: str = 'asset'
):
Expand Down

0 comments on commit d0f436c

Please sign in to comment.