polars-ta 0.5.6__py3-none-any.whl → 0.5.7__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
polars_ta/_version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "0.5.6"
1
+ __version__ = "0.5.7"
@@ -290,7 +290,7 @@ def cs_rank(x: Expr, pct: bool = True) -> Expr:
290
290
 
291
291
 
292
292
  def cs_rank_if(condition: Expr, x: Expr, pct: bool = True) -> Expr:
293
- """动态票池过滤排名
293
+ """横截面筛选排名。可实现动态票池
294
294
 
295
295
  Parameters
296
296
  ----------
@@ -299,17 +299,34 @@ def cs_rank_if(condition: Expr, x: Expr, pct: bool = True) -> Expr:
299
299
  x:Expr
300
300
  因子
301
301
  pct:bool
302
+ 排名百分比。范围:[0,1]
302
303
 
303
304
  Examples
304
305
  --------
305
306
  ```python
306
307
  df = pl.DataFrame({
307
308
  'a': [None, 1, 1, 1, 2, 2, 3, 10],
308
- 'b': [1, 2, 3, 4, 5, 6, 7, 8],
309
+ 'b': [1, 2, 3, 4, 5, 6, None, 8],
309
310
  }).with_columns(
310
- out1=cs_rank_if(True, pl.col('a'), True), # 与cs_rank等价
311
+ out1=cs_rank_if(True, pl.col('a'), True), # 与cs_rank等价
311
312
  out2=cs_rank_if(pl.col('b') > 3, -pl.col('a'), False),
312
313
  )
314
+
315
+ shape: (8, 4)
316
+ ┌──────┬──────┬──────────┬──────┐
317
+ │ a ┆ b ┆ out1 ┆ out2 │
318
+ │ --- ┆ --- ┆ --- ┆ --- │
319
+ │ i64 ┆ i64 ┆ f64 ┆ u32 │
320
+ ╞══════╪══════╪══════════╪══════╡
321
+ │ null ┆ 1 ┆ null ┆ null │
322
+ │ 1 ┆ 2 ┆ 0.0 ┆ null │
323
+ │ 1 ┆ 3 ┆ 0.0 ┆ null │
324
+ │ 1 ┆ 4 ┆ 0.0 ┆ 3 │
325
+ │ 2 ┆ 5 ┆ 0.333333 ┆ 2 │
326
+ │ 2 ┆ 6 ┆ 0.333333 ┆ 2 │
327
+ │ 3 ┆ null ┆ 0.666667 ┆ null │
328
+ │ 10 ┆ 8 ┆ 1.0 ┆ 1 │
329
+ └──────┴──────┴──────────┴──────┘
313
330
  ```
314
331
 
315
332
  Notes
@@ -275,3 +275,8 @@ def bool_(a: Expr) -> Expr:
275
275
  def float_(a: Expr) -> Expr:
276
276
  """int转成float"""
277
277
  return a.cast(Float32)
278
+
279
+
280
+ def nop(x: Expr) -> Expr:
281
+ """空操作"""
282
+ return x
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: polars_ta
3
- Version: 0.5.6
3
+ Version: 0.5.7
4
4
  Summary: polars expressions
5
5
  Author-email: wukan <wu-kan@163.com>
6
6
  License: MIT License
@@ -1,5 +1,5 @@
1
1
  polars_ta/__init__.py,sha256=ig6f6c1AMSpntwKjqaX3msBzVIwkI7J776IujEmiuvA,123
2
- polars_ta/_version.py,sha256=CMH34Gt1AqO7z_TqRj94XwohGoVCf8aes0djkqm45mk,22
2
+ polars_ta/_version.py,sha256=KiyyYbyEe0O858kmiWcg1RdmqGUYtk_JqRmc3_Ev2Q8,22
3
3
  polars_ta/noise.py,sha256=LJHubBqnWlU3Bz84z07N1JB-b-hAMW2rgBF1BT4m0FE,1471
4
4
  polars_ta/candles/__init__.py,sha256=AW68IuFC0gD4_OyjwLP3p22WSzSIYqlSrsS9fW_15xw,141
5
5
  polars_ta/candles/cdl1.py,sha256=RnRu1QzpqEt5y0-1hlfZRUvza1no-Gj4x_dx2QWxr5A,3130
@@ -64,13 +64,13 @@ polars_ta/wq/__init__.py,sha256=C3YYJc997XCUI7H_afGT_mj2m4UdHMcql4sboCVvrXU,327
64
64
  polars_ta/wq/_nb.py,sha256=9N7afRiABqdjO1QPnRlP1RIKJ98cQLpv6nF3dsqUA6k,11281
65
65
  polars_ta/wq/_slow.py,sha256=MfWg9FYX8NGNLWN4ezI_awf3pPTqhSq_zo0LOS4nCzw,937
66
66
  polars_ta/wq/arithmetic.py,sha256=NwyX-K8j9ul7XHHSNuGimBq6f3NvcOGQ4le5PQuaRPc,26346
67
- polars_ta/wq/cross_sectional.py,sha256=wAVG8jUpF8wZlJPm1LExmwLHdgmx2u1OOCECumYjy10,15457
67
+ polars_ta/wq/cross_sectional.py,sha256=zmJd1tBj8IV-7mE6Z2ukk67KAlXuuOKs4U_Xufcs6Yc,16382
68
68
  polars_ta/wq/logical.py,sha256=PfcPrY3iYoYFDTJ-B1IlCfpab1uTWV7GN1TdRtjauEk,2241
69
69
  polars_ta/wq/preprocess.py,sha256=sGvCKMpGMWKXwd2OC7mM65G4Ecd-dIGH9jkyQraIZhE,3705
70
70
  polars_ta/wq/time_series.py,sha256=nywBEfkVrTsUgyUL7NCSMUSBoLm09e0ToCp9zwrxbvM,33155
71
- polars_ta/wq/transformational.py,sha256=ewZPwzeg5ak6fxCDI_PY5mDJrNryOIoCX4x7LTyPXNU,7371
71
+ polars_ta/wq/transformational.py,sha256=4ns97vxarJFDNu5jOL7jhZNEKO-s-jViUB6y2tSndAU,7432
72
72
  polars_ta/wq/vector.py,sha256=Hkg5q3zi1QOylccB43FvnR_AcCjG4JxhmeKW5RdMn3Q,1957
73
- polars_ta-0.5.6.dist-info/METADATA,sha256=9Xm_okfFEEFZM1MOq_0h8txvRq-06ZnX4Z-V_UDXcCM,8839
74
- polars_ta-0.5.6.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
75
- polars_ta-0.5.6.dist-info/licenses/LICENSE,sha256=nREFtfwxWCCYD-ZA1jMzhhxMyTz-wGWFlnkpgg0DCtQ,1062
76
- polars_ta-0.5.6.dist-info/RECORD,,
73
+ polars_ta-0.5.7.dist-info/METADATA,sha256=w8cwDbIkvivKc6RTVGjTko8sAeuZv-sU_hV0lryaZLs,8839
74
+ polars_ta-0.5.7.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
75
+ polars_ta-0.5.7.dist-info/licenses/LICENSE,sha256=nREFtfwxWCCYD-ZA1jMzhhxMyTz-wGWFlnkpgg0DCtQ,1062
76
+ polars_ta-0.5.7.dist-info/RECORD,,