chalkpy 2.96.8__py3-none-any.whl → 2.97.0__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.
- chalk/_version.py +1 -1
- chalk/df/LazyFramePlaceholder.py +69 -25
- chalk/features/resolver.py +7 -7
- {chalkpy-2.96.8.dist-info → chalkpy-2.97.0.dist-info}/METADATA +1 -1
- {chalkpy-2.96.8.dist-info → chalkpy-2.97.0.dist-info}/RECORD +8 -8
- {chalkpy-2.96.8.dist-info → chalkpy-2.97.0.dist-info}/WHEEL +0 -0
- {chalkpy-2.96.8.dist-info → chalkpy-2.97.0.dist-info}/entry_points.txt +0 -0
- {chalkpy-2.96.8.dist-info → chalkpy-2.97.0.dist-info}/top_level.txt +0 -0
chalk/_version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "2.
|
|
1
|
+
__version__ = "2.97.0"
|
chalk/df/LazyFramePlaceholder.py
CHANGED
|
@@ -566,7 +566,7 @@ class LazyFramePlaceholder:
|
|
|
566
566
|
columns=columns,
|
|
567
567
|
)
|
|
568
568
|
|
|
569
|
-
def select(self, *columns: str, strict: bool = True) -> "LazyFramePlaceholder":
|
|
569
|
+
def select(self, *columns: str | Underscore, strict: bool = True) -> "LazyFramePlaceholder":
|
|
570
570
|
"""Select existing columns by name.
|
|
571
571
|
|
|
572
572
|
Parameters
|
|
@@ -595,7 +595,7 @@ class LazyFramePlaceholder:
|
|
|
595
595
|
strict=strict,
|
|
596
596
|
)
|
|
597
597
|
|
|
598
|
-
def drop(self, *columns: str, strict: bool = True) -> LazyFramePlaceholder:
|
|
598
|
+
def drop(self, *columns: str | Underscore, strict: bool = True) -> LazyFramePlaceholder:
|
|
599
599
|
"""Drop specified columns from the DataFrame.
|
|
600
600
|
|
|
601
601
|
Parameters
|
|
@@ -624,7 +624,7 @@ class LazyFramePlaceholder:
|
|
|
624
624
|
strict=strict,
|
|
625
625
|
)
|
|
626
626
|
|
|
627
|
-
def explode(self, column: str) -> "LazyFramePlaceholder":
|
|
627
|
+
def explode(self, column: str | Underscore) -> "LazyFramePlaceholder":
|
|
628
628
|
"""Explode a list or array column into multiple rows.
|
|
629
629
|
|
|
630
630
|
Each element in the list becomes a separate row, with other column
|
|
@@ -654,7 +654,10 @@ class LazyFramePlaceholder:
|
|
|
654
654
|
def join(
|
|
655
655
|
self,
|
|
656
656
|
other: "LazyFramePlaceholder",
|
|
657
|
-
|
|
657
|
+
*,
|
|
658
|
+
on: typing.Mapping[str | Underscore, str | Underscore] | typing.Sequence[str | Underscore] | None = None,
|
|
659
|
+
left_on: typing.Sequence[str | Underscore] | None = None,
|
|
660
|
+
right_on: typing.Sequence[str | Underscore] | None = None,
|
|
658
661
|
how: str = "inner",
|
|
659
662
|
right_suffix: str | None = None,
|
|
660
663
|
) -> "LazyFramePlaceholder":
|
|
@@ -665,11 +668,29 @@ class LazyFramePlaceholder:
|
|
|
665
668
|
other
|
|
666
669
|
Right-hand ``DataFrame``.
|
|
667
670
|
on
|
|
668
|
-
|
|
671
|
+
Join keys. Can be specified in multiple ways:
|
|
672
|
+
- A sequence of column names (same names on both sides): ``on=["col1", "col2"]``
|
|
673
|
+
- A mapping of left->right column names: ``on={"left_col": "right_col"}``
|
|
674
|
+
- If None, must specify ``left_on`` and ``right_on`` separately.
|
|
675
|
+
left_on
|
|
676
|
+
Column names for left DataFrame join keys. Only used when ``on`` is None.
|
|
677
|
+
Must be paired with ``right_on``.
|
|
678
|
+
right_on
|
|
679
|
+
Column names for right DataFrame join keys. Only used when ``on`` is None.
|
|
680
|
+
Must be paired with ``left_on``.
|
|
669
681
|
how
|
|
670
|
-
Join type
|
|
682
|
+
Join type. Supported values:
|
|
683
|
+
- ``"inner"``: Keep only rows that match in both DataFrames (default)
|
|
684
|
+
- ``"left"``: Keep all rows from left DataFrame
|
|
685
|
+
- ``"right"``: Keep all rows from right DataFrame
|
|
686
|
+
- ``"outer"`` or ``"full"``: Keep all rows from both DataFrames
|
|
687
|
+
- ``"semi"``: Return rows from left that have matches in right (no right columns)
|
|
688
|
+
- ``"anti"``: Return rows from left that have no matches in right
|
|
689
|
+
- ``"cross"``: Cartesian product (do not pass in ``on``)
|
|
671
690
|
right_suffix
|
|
672
691
|
Optional suffix applied to right-hand columns when names collide.
|
|
692
|
+
For example, if both DataFrames have a column ``"value"`` and ``right_suffix="_right"``,
|
|
693
|
+
the result will have ``"value"`` and ``"value_right"``.
|
|
673
694
|
|
|
674
695
|
Returns
|
|
675
696
|
-------
|
|
@@ -681,18 +702,22 @@ class LazyFramePlaceholder:
|
|
|
681
702
|
function_name="join",
|
|
682
703
|
other=other,
|
|
683
704
|
on=on,
|
|
705
|
+
left_on=left_on,
|
|
706
|
+
right_on=right_on,
|
|
684
707
|
how=how,
|
|
685
708
|
right_suffix=right_suffix,
|
|
686
709
|
)
|
|
687
710
|
|
|
688
711
|
def join_asof(
|
|
689
712
|
self,
|
|
690
|
-
other: LazyFramePlaceholder,
|
|
691
|
-
on: str,
|
|
713
|
+
other: "LazyFramePlaceholder",
|
|
692
714
|
*,
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
715
|
+
on: str | Underscore | None = None,
|
|
716
|
+
left_on: str | Underscore | None = None,
|
|
717
|
+
right_on: str | Underscore | None = None,
|
|
718
|
+
by: typing.Mapping[str | Underscore, str | Underscore] | typing.Sequence[str | Underscore] | None = None,
|
|
719
|
+
left_by: typing.Sequence[str | Underscore] | None = None,
|
|
720
|
+
right_by: typing.Sequence[str | Underscore] | None = None,
|
|
696
721
|
strategy: typing.Literal["forward", "backward"] = "backward",
|
|
697
722
|
right_suffix: str | None = None,
|
|
698
723
|
coalesce: bool = True,
|
|
@@ -703,24 +728,41 @@ class LazyFramePlaceholder:
|
|
|
703
728
|
it matches on the nearest key from the right DataFrame. This is commonly used
|
|
704
729
|
for time-series data where you want to join with the most recent observation.
|
|
705
730
|
|
|
706
|
-
**Important**: Both DataFrames must be sorted by the ``on``
|
|
707
|
-
this method. Use ``.order_by(on)`` to sort if needed.
|
|
731
|
+
**Important**: Both DataFrames must be sorted by the ``on`` (or ``left_on/right_on``)
|
|
732
|
+
column before calling this method. Use ``.order_by(on)`` to sort if needed.
|
|
708
733
|
|
|
709
734
|
Parameters
|
|
710
735
|
----------
|
|
711
736
|
other
|
|
712
737
|
Right-hand DataFrame to join with.
|
|
713
738
|
on
|
|
714
|
-
Column name
|
|
739
|
+
Column name to use as the as-of join key (must be sorted).
|
|
740
|
+
This column is used for both left and right DataFrames.
|
|
741
|
+
The join finds the nearest match according to the ``strategy``.
|
|
742
|
+
Either ``on`` or both ``left_on`` and ``right_on`` must be specified.
|
|
743
|
+
left_on
|
|
744
|
+
Column name in left DataFrame for the as-of join key. Only used when ``on``
|
|
745
|
+
is None. Must be paired with ``right_on``.
|
|
715
746
|
right_on
|
|
716
|
-
Column name in
|
|
747
|
+
Column name in right DataFrame for the as-of join key. Can be used with ``on``
|
|
748
|
+
(to specify a different right column name) or with ``left_on`` (when ``on`` is None).
|
|
717
749
|
by
|
|
718
|
-
Additional exact-match columns
|
|
750
|
+
Additional exact-match columns (optional). These columns must match exactly
|
|
751
|
+
before performing the as-of match on the ``on`` column. Can be specified as:
|
|
752
|
+
- A sequence of column names (same names on both sides): ``by=["col1", "col2"]``
|
|
753
|
+
- A mapping of left->right column names: ``by={"left_col": "right_col"}``
|
|
754
|
+
- If None, can specify ``left_by`` and ``right_by`` separately.
|
|
755
|
+
left_by
|
|
756
|
+
Column names in left DataFrame for exact-match conditions. Only used when
|
|
757
|
+
``by`` is None. Must be paired with ``right_by``.
|
|
719
758
|
right_by
|
|
720
|
-
|
|
759
|
+
Column names in right DataFrame for exact-match conditions. Only used when
|
|
760
|
+
``by`` is None. Must be paired with ``left_by``.
|
|
721
761
|
strategy
|
|
722
|
-
Join strategy
|
|
723
|
-
"
|
|
762
|
+
Join strategy controlling which match to select:
|
|
763
|
+
- ``"backward"`` (default): Match with the most recent past value
|
|
764
|
+
- ``"forward"``: Match with the nearest future value
|
|
765
|
+
Can also pass ``AsOfJoinStrategy.BACKWARD`` or ``AsOfJoinStrategy.FORWARD``.
|
|
724
766
|
right_suffix
|
|
725
767
|
Suffix to add to overlapping column names from the right DataFrame.
|
|
726
768
|
coalesce
|
|
@@ -737,8 +779,10 @@ class LazyFramePlaceholder:
|
|
|
737
779
|
function_name="join_asof",
|
|
738
780
|
other=other,
|
|
739
781
|
on=on,
|
|
782
|
+
left_on=left_on,
|
|
740
783
|
right_on=right_on,
|
|
741
784
|
by=by,
|
|
785
|
+
left_by=left_by,
|
|
742
786
|
right_by=right_by,
|
|
743
787
|
strategy=strategy,
|
|
744
788
|
right_suffix=right_suffix,
|
|
@@ -748,13 +792,13 @@ class LazyFramePlaceholder:
|
|
|
748
792
|
# # Window is not yet supported in LazyFramePlaceholder:
|
|
749
793
|
# def window(
|
|
750
794
|
# self,
|
|
751
|
-
# by: typing.Sequence[str],
|
|
752
|
-
# order_by: typing.Sequence[str | tuple[str, str]],
|
|
795
|
+
# by: typing.Sequence[str | Underscore],
|
|
796
|
+
# order_by: typing.Sequence[str | Underscore | tuple[str | Underscore, str]],
|
|
753
797
|
# *expressions: WindowExpr,
|
|
754
798
|
# ) -> LazyFramePlaceholder:
|
|
755
799
|
# ...
|
|
756
800
|
|
|
757
|
-
def agg(self, by: typing.Sequence[str], *aggregations: Underscore) -> "LazyFramePlaceholder":
|
|
801
|
+
def agg(self, by: typing.Sequence[str | Underscore], *aggregations: Underscore) -> "LazyFramePlaceholder":
|
|
758
802
|
"""Group by columns and apply aggregation expressions.
|
|
759
803
|
|
|
760
804
|
Parameters
|
|
@@ -785,7 +829,7 @@ class LazyFramePlaceholder:
|
|
|
785
829
|
args=(by, *aggregations),
|
|
786
830
|
)
|
|
787
831
|
|
|
788
|
-
def distinct_on(self, *columns: str) -> "LazyFramePlaceholder":
|
|
832
|
+
def distinct_on(self, *columns: str | Underscore) -> "LazyFramePlaceholder":
|
|
789
833
|
"""Remove duplicate rows based on specified columns.
|
|
790
834
|
|
|
791
835
|
For rows with identical values in the specified columns, only one
|
|
@@ -813,7 +857,7 @@ class LazyFramePlaceholder:
|
|
|
813
857
|
args=columns,
|
|
814
858
|
)
|
|
815
859
|
|
|
816
|
-
def order_by(self, *columns: str | tuple[str, str]) -> LazyFramePlaceholder:
|
|
860
|
+
def order_by(self, *columns: str | Underscore | tuple[str | Underscore, str]) -> LazyFramePlaceholder:
|
|
817
861
|
"""Sort the DataFrame by one or more columns.
|
|
818
862
|
|
|
819
863
|
Parameters
|
|
@@ -889,7 +933,7 @@ class LazyFramePlaceholder:
|
|
|
889
933
|
connector_id=connector_id,
|
|
890
934
|
)
|
|
891
935
|
|
|
892
|
-
def rename(self, new_names:
|
|
936
|
+
def rename(self, new_names: typing.Mapping[str | Underscore, str]) -> LazyFramePlaceholder:
|
|
893
937
|
"""Rename columns in the DataFrame.
|
|
894
938
|
|
|
895
939
|
Parameters
|
chalk/features/resolver.py
CHANGED
|
@@ -4588,7 +4588,7 @@ def validate_message_attributes(
|
|
|
4588
4588
|
def make_model_resolver(
|
|
4589
4589
|
name: str,
|
|
4590
4590
|
model: "ModelVersion",
|
|
4591
|
-
|
|
4591
|
+
input: Dict[Feature, str] | List[Feature],
|
|
4592
4592
|
output: Feature | List[Feature] | Dict[Feature, str],
|
|
4593
4593
|
feature_class: Optional[type[Features]] = None,
|
|
4594
4594
|
resource_group: Optional[str] = None,
|
|
@@ -4656,7 +4656,7 @@ def make_model_resolver(
|
|
|
4656
4656
|
>>> resolver = make_model_resolver(
|
|
4657
4657
|
... name="risk_model",
|
|
4658
4658
|
... model=model,
|
|
4659
|
-
...
|
|
4659
|
+
... input=[User.age, User.income],
|
|
4660
4660
|
... output=User.risk_score,
|
|
4661
4661
|
... )
|
|
4662
4662
|
>>>
|
|
@@ -4664,7 +4664,7 @@ def make_model_resolver(
|
|
|
4664
4664
|
>>> resolver = make_model_resolver(
|
|
4665
4665
|
... name="multi_output_model",
|
|
4666
4666
|
... model=model,
|
|
4667
|
-
...
|
|
4667
|
+
... input=[User.age, User.income],
|
|
4668
4668
|
... output=[User.risk_score, User.credit_score],
|
|
4669
4669
|
... )
|
|
4670
4670
|
>>>
|
|
@@ -4672,16 +4672,16 @@ def make_model_resolver(
|
|
|
4672
4672
|
>>> resolver = make_model_resolver(
|
|
4673
4673
|
... name="named_model",
|
|
4674
4674
|
... model=model,
|
|
4675
|
-
...
|
|
4675
|
+
... input={User.age: "age_input", User.income: "income_input"},
|
|
4676
4676
|
... output={User.risk_score: "risk_output", User.credit_score: "credit_output"},
|
|
4677
4677
|
... )
|
|
4678
4678
|
"""
|
|
4679
4679
|
from chalk.features.inference import build_inference_function
|
|
4680
4680
|
|
|
4681
|
-
if isinstance(
|
|
4682
|
-
input_features_raw = list(
|
|
4681
|
+
if isinstance(input, dict):
|
|
4682
|
+
input_features_raw = list(input.keys())
|
|
4683
4683
|
else:
|
|
4684
|
-
input_features_raw =
|
|
4684
|
+
input_features_raw = input
|
|
4685
4685
|
|
|
4686
4686
|
input_features = [unwrap_feature(f) for f in input_features_raw]
|
|
4687
4687
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
chalk/__init__.py,sha256=vKsx9-cl5kImlVWGHVRYO6bweBm79NAzGs3l36u71wM,2657
|
|
2
|
-
chalk/_version.py,sha256=
|
|
2
|
+
chalk/_version.py,sha256=AzuYEr2BkAnDfw_LTLHrqH9MJasLCRVWoZmn_HmxL2s,23
|
|
3
3
|
chalk/cli.py,sha256=ckqqfOI-A2mT23-rnZzDMmblYj-2x1VBX8ebHlIEn9A,5873
|
|
4
4
|
chalk/importer.py,sha256=m4lMn1lSYj_euDq8CS7LYTBnek9JOcjGJf9-82dJHbA,64441
|
|
5
5
|
chalk/prompts.py,sha256=2H9UomLAamdfRTNUdKs9i3VTpiossuyRhntqsAXUhhg,16117
|
|
@@ -636,7 +636,7 @@ chalk/config/_validator.py,sha256=QC1y52m704_bV_TYjq0sdZJ-km8iSkDX1V4sHgw4RJk,13
|
|
|
636
636
|
chalk/config/auth_config.py,sha256=HAALkQrvDD0i7gaZK5iufS8vDDVbzLIpHLOpcJO1kmw,4498
|
|
637
637
|
chalk/config/project_config.py,sha256=YHB3upvtBJu-tWfNOchBRSc9xGebDbrIpCVmKbBzJ8Q,7217
|
|
638
638
|
chalk/df/ChalkDataFrameImpl.py,sha256=BRwnjQcie3gxaKhKau8HG17NWzS1zdr8SnNVurxF8QY,133
|
|
639
|
-
chalk/df/LazyFramePlaceholder.py,sha256=
|
|
639
|
+
chalk/df/LazyFramePlaceholder.py,sha256=6MGwaQRMvgOOqSRl7NC_BsRkiFfzH7eX-ylGH-biNsU,42562
|
|
640
640
|
chalk/df/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
641
641
|
chalk/df/ast_parser.py,sha256=t-DwUxd2hN8LECRSBx85DIv9FtILgMiHyGyCTINfgQw,11199
|
|
642
642
|
chalk/features/__init__.py,sha256=5doD7bFwRthzwdmizbRaPVHiCABiNpiOiAJVFlwqNnA,6943
|
|
@@ -660,7 +660,7 @@ chalk/features/live_updates.py,sha256=8ZbiDjcLqfFruSL15_aycwzSqJ0TbKNhas06KfZLyL
|
|
|
660
660
|
chalk/features/namespace_context.py,sha256=fL-nPohqtNiyPDS1uQTAaHLns4aivuBL2Flf50DajU4,1813
|
|
661
661
|
chalk/features/primary.py,sha256=BZ8mrMmKfRNy_wnKGDJt2cdnejP_CZb6xBsD9Ljgajc,5209
|
|
662
662
|
chalk/features/pseudofeatures.py,sha256=50Pe_Xi8ttYWtgNNRpgkhBxP8xoCZCYwyLb0aWUQ-PI,2147
|
|
663
|
-
chalk/features/resolver.py,sha256=
|
|
663
|
+
chalk/features/resolver.py,sha256=txAhcTv60QHn5Ge0Hr1z2LSWVKNDuZZYSogTnY31YMA,193542
|
|
664
664
|
chalk/features/tag.py,sha256=LRmKRA8ANCOvmaIAk-L5j1QW2U0aah2SeASy8Uydkmk,2675
|
|
665
665
|
chalk/features/underscore.py,sha256=4xnfQV3bfvVn0PNEtkT4J-k7hW4ebtH9KBe4_BvGjY4,26763
|
|
666
666
|
chalk/features/underscore_features.py,sha256=PlVCoaDDffOgtiSMaxPSWCoj8IjscbkOzDLA471HsJ4,13005
|
|
@@ -827,8 +827,8 @@ chalk/utils/tracing.py,sha256=NiiM-9dbuJhSCv6R1npR1uYNKWlkqTR6Ygm0Voi2NrY,13078
|
|
|
827
827
|
chalk/utils/weak_set_by_identity.py,sha256=VmikA_laYwFeOphCwXJIuyOIkrdlQe0bSzaXq7onoQw,953
|
|
828
828
|
chalk/utils/pydanticutil/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
829
829
|
chalk/utils/pydanticutil/pydantic_compat.py,sha256=O575lLYJ5GvZC4HMzR9yATxf9XwjC6NrDUXbNwZidlE,3031
|
|
830
|
-
chalkpy-2.
|
|
831
|
-
chalkpy-2.
|
|
832
|
-
chalkpy-2.
|
|
833
|
-
chalkpy-2.
|
|
834
|
-
chalkpy-2.
|
|
830
|
+
chalkpy-2.97.0.dist-info/METADATA,sha256=MAiYY-F0FLqqxH6fDhU2KpF3FL38NqmMJJoCiVq8bSY,27754
|
|
831
|
+
chalkpy-2.97.0.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
832
|
+
chalkpy-2.97.0.dist-info/entry_points.txt,sha256=Vg23sd8icwq-morJrljVFr-kQnMbm95rZfZj5wsZGis,42
|
|
833
|
+
chalkpy-2.97.0.dist-info/top_level.txt,sha256=1Q6_19IGYfNxSw50W8tYKEJ2t5HKQ3W9Wiw4ia5yg2c,6
|
|
834
|
+
chalkpy-2.97.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|