spells-mtg 0.3.0__tar.gz → 0.3.1__tar.gz

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.

Potentially problematic release.


This version of spells-mtg might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: spells-mtg
3
- Version: 0.3.0
3
+ Version: 0.3.1
4
4
  Summary: analaysis of 17Lands.com public datasets
5
5
  Author-Email: Joel Barnes <oelarnes@gmail.com>
6
6
  License: MIT
@@ -424,6 +424,7 @@ A table of all included columns. Columns can be referenced by enum or by string
424
424
  | `CARD_TYPE` | `"card_type"` | `CARD` | `CARD_ATTR` | | String |
425
425
  | `SUBTYPE` | `"subtype"` | `CARD` | `CARD_ATTR` | | String |
426
426
  | `MANA_VALUE` | `"mana_value"` | `CARD` | `CARD_ATTR` | | Float |
427
+ | `DECK_MANA_VALUE` | `"deck_mana_value"` | | `CARD_SUM` | `DECK` * `MANA_VALUE` | Float |
427
428
  | `MANA_COST` | `"mana_cost"` | `CARD` | `CARD_ATTR` | | String |
428
429
  | `POWER` | `"power"` | `CARD` | `CARD_ATTR` | | Float |
429
430
  | `TOUGHNESS` | `"toughness"` | `CARD` | `CARD_ATTR` | | Float |
@@ -462,6 +463,7 @@ A table of all included columns. Columns can be referenced by enum or by string
462
463
  | `GIH_WR_VAR` | `"gih_wr_var"` | | `AGG` | Game-weighted Variance | Float |
463
464
  | `GIH_WR_STDEV` | `"gh_wr_stdev"` | | `AGG` | Sqrt of `GIH_WR_VAR` | Float |
464
465
  | `GIH_WR_Z` | `"gih_wr_z"` | | `AGG` |`GIH_WR_EXCESS` / `GIH_WR_STDEV` | Float |
466
+ | `DECK_MANA_VALUE_AVG` | `"deck_mana_value_avg"` | | `AGG` | `DECK_MANA_VALUE ` / `DECK` | Float |
465
467
 
466
468
  # Roadmap to 1.0
467
469
 
@@ -413,6 +413,7 @@ A table of all included columns. Columns can be referenced by enum or by string
413
413
  | `CARD_TYPE` | `"card_type"` | `CARD` | `CARD_ATTR` | | String |
414
414
  | `SUBTYPE` | `"subtype"` | `CARD` | `CARD_ATTR` | | String |
415
415
  | `MANA_VALUE` | `"mana_value"` | `CARD` | `CARD_ATTR` | | Float |
416
+ | `DECK_MANA_VALUE` | `"deck_mana_value"` | | `CARD_SUM` | `DECK` * `MANA_VALUE` | Float |
416
417
  | `MANA_COST` | `"mana_cost"` | `CARD` | `CARD_ATTR` | | String |
417
418
  | `POWER` | `"power"` | `CARD` | `CARD_ATTR` | | Float |
418
419
  | `TOUGHNESS` | `"toughness"` | `CARD` | `CARD_ATTR` | | Float |
@@ -451,6 +452,7 @@ A table of all included columns. Columns can be referenced by enum or by string
451
452
  | `GIH_WR_VAR` | `"gih_wr_var"` | | `AGG` | Game-weighted Variance | Float |
452
453
  | `GIH_WR_STDEV` | `"gh_wr_stdev"` | | `AGG` | Sqrt of `GIH_WR_VAR` | Float |
453
454
  | `GIH_WR_Z` | `"gih_wr_z"` | | `AGG` |`GIH_WR_EXCESS` / `GIH_WR_STDEV` | Float |
455
+ | `DECK_MANA_VALUE_AVG` | `"deck_mana_value_avg"` | | `AGG` | `DECK_MANA_VALUE ` / `DECK` | Float |
454
456
 
455
457
  # Roadmap to 1.0
456
458
 
@@ -11,7 +11,7 @@ dependencies = [
11
11
  ]
12
12
  requires-python = ">=3.11"
13
13
  readme = "README.md"
14
- version = "0.3.0"
14
+ version = "0.3.1"
15
15
 
16
16
  [project.license]
17
17
  text = "MIT"
@@ -76,7 +76,10 @@ def _extract_value(set_code: str, name: str, card_dict: dict, field: CardAttr):
76
76
 
77
77
  def card_df(draft_set_code: str, names: list[str]) -> pl.DataFrame:
78
78
  draft_set_json = _fetch_mtg_json(draft_set_code)
79
- set_codes = draft_set_json["data"]["booster"]["play"]["sourceSetCodes"]
79
+ booster_info = draft_set_json["data"]["booster"]
80
+
81
+ booster_type = "play" if "play" in booster_info else "draft"
82
+ set_codes = booster_info[booster_type]["sourceSetCodes"]
80
83
  set_codes.reverse()
81
84
 
82
85
  card_data_map = {}
@@ -510,6 +510,20 @@ _column_specs = [
510
510
  expr=pl.col(ColName.MANA_VALUE) * pl.col(ColName.DECK),
511
511
  dependencies=[ColName.MANA_VALUE, ColName.DECK],
512
512
  ),
513
+ ColumnSpec(
514
+ name=ColName.DECK_LANDS,
515
+ col_type=ColType.CARD_SUM,
516
+ expr=pl.when(pl.col(ColName.CARD_TYPE).str.contains("Land"))
517
+ .then(pl.col(ColName.DECK))
518
+ .otherwise(0),
519
+ dependencies=[ColName.CARD_TYPE, ColName.DECK],
520
+ ),
521
+ ColumnSpec(
522
+ name=ColName.DECK_SPELLS,
523
+ col_type=ColType.CARD_SUM,
524
+ expr=pl.col(ColName.DECK) - pl.col(ColName.DECK_SPELLS),
525
+ dependencies=[ColName.DECK, ColName.DECK_SPELLS],
526
+ ),
513
527
  ColumnSpec(
514
528
  name=ColName.MANA_COST,
515
529
  col_type=ColType.CARD_ATTR,
@@ -733,6 +747,18 @@ _column_specs = [
733
747
  expr=pl.col(ColName.DECK_MANA_VALUE) / pl.col(ColName.DECK),
734
748
  dependencies=[ColName.DECK_MANA_VALUE, ColName.DECK],
735
749
  ),
750
+ ColumnSpec(
751
+ name=ColName.DECK_LANDS_AVG,
752
+ col_type=ColType.AGG,
753
+ expr=pl.col(ColName.DECK_LANDS) / pl.col(ColName.NUM_GAMES),
754
+ dependencies=[ColName.DECK_LANDS, ColName.NUM_GAMES],
755
+ ),
756
+ ColumnSpec(
757
+ name=ColName.DECK_SPELLS_AVG,
758
+ col_type=ColType.AGG,
759
+ expr=pl.col(ColName.DECK_SPELLS) / pl.col(ColName.NUM_GAMES),
760
+ dependencies=[ColName.DECK_SPELLS, ColName.NUM_GAMES],
761
+ ),
736
762
  ]
737
763
 
738
764
  col_spec_map = {col.name: col for col in _column_specs}
@@ -117,6 +117,8 @@ class ColName(StrEnum):
117
117
  SUBTYPE = "subtype"
118
118
  MANA_VALUE = "mana_value"
119
119
  DECK_MANA_VALUE = "deck_mana_value"
120
+ DECK_LANDS = "deck_lands"
121
+ DECK_SPELLS = "deck_spells"
120
122
  MANA_COST = "mana_cost"
121
123
  POWER = "power"
122
124
  TOUGHNESS = "toughness"
@@ -157,3 +159,5 @@ class ColName(StrEnum):
157
159
  GIH_WR_STDEV = "gh_wr_stdev"
158
160
  GIH_WR_Z = "gih_wr_z"
159
161
  DECK_MANA_VALUE_AVG = "deck_mana_value_avg"
162
+ DECK_LANDS_AVG = "deck_lands_avg"
163
+ DECK_SPELLS_AVG = "deck_spells_avg"
File without changes
File without changes
File without changes
File without changes
File without changes