resolve_weight_to_array¶
yohou.utils.weighting.resolve_weight_to_array(weight, key_series, join_column, group_name=None)
¶
Resolve a weight specification to a raw numpy array.
Accepts three formats (callable, DataFrame, or dict) and returns an
unnormalized weight array aligned to key_series. Validation is
performed via validate_weight_array after resolution.
Parameters¶
| Name | Type | Description | Default |
|---|---|---|---|
weight
|
callable, pl.DataFrame, or dict
|
Weight specification in one of the supported formats. |
required |
key_series
|
Series
|
Data series whose values are used for alignment (e.g., time values, forecasting steps, vintage times). |
required |
join_column
|
str
|
Column name used for DataFrame joins ( |
required |
group_name
|
str or None
|
Panel group name for 2-parameter callables and group-specific
DataFrame columns. |
None
|
Returns¶
| Type | Description |
|---|---|
ndarray
|
Raw (unnormalized) weight array of same length as |
Raises¶
| Type | Description |
|---|---|
ValueError
|
If |
Source Code¶
Show/Hide source
612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 | |