File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -99,11 +99,12 @@ def create_card_dataframe(extract_card_info: list) -> pl.DataFrame:
9999
100100 flat ["attacks_json" ] = json .dumps (card .get ("attacks" , []), ensure_ascii = False )
101101
102- attacks = card .get ("attacks" , [])
102+ attacks = [ atk for atk in card .get ("attacks" , []) if atk . get ( "name" )]
103103 for i , atk in enumerate (attacks ):
104104 prefix = f"attack_{ i + 1 } "
105105 flat [f"{ prefix } _name" ] = atk .get ("name" )
106- flat [f"{ prefix } _damage" ] = atk .get ("damage" )
106+ damage = atk .get ("damage" )
107+ flat [f"{ prefix } _damage" ] = str (damage ) if damage is not None else None
107108 flat [f"{ prefix } _effect" ] = atk .get ("effect" )
108109 flat [f"{ prefix } _cost" ] = ", " .join (atk .get ("cost" , []))
109110
Original file line number Diff line number Diff line change @@ -93,6 +93,14 @@ sources:
9393 description : " Second attack effect"
9494 - name : attack_2_cost
9595 description : " Second attack energy cost"
96+ - name : attack_3_name
97+ description : " Third attack name"
98+ - name : attack_3_damage
99+ description : " Third attack damage"
100+ - name : attack_3_effect
101+ description : " Third attack effect"
102+ - name : attack_3_cost
103+ description : " Third attack energy cost"
96104
97105 - name : pricing_data
98106 description : " Card pricing data"
You can’t perform that action at this time.
0 commit comments