<jupyter_start><jupyter_text>Weapon Damage by Target  Setting Up<jupyter_code>import pandas as pd

%run weapon_full_data.ipynb<jupyter_output><empty_output><jupyter_text>Weapon Damages by Target<jupyter_code>weapon_damages_targets = weapon_data_targets.groupby(["weapon", "target"]).mean()
weapon_damages_targets = weapon_damages_targets[["turn_target_damage_expected"]]
weapon_damages_targets = weapon_damages_targets.rename(columns={"turn_target_damage_expected": "turn_damage"})
weapon_damages_targets = weapon_damages_targets.sort_values(by=["turn_damage"])<jupyter_output><empty_output><jupyter_text>Average<jupyter_code>weapon_damages_targets_graph = weapon_damages_targets.groupby(["target"]).mean()
ax = weapon_damages_targets_graph.plot.bar(title="Damage to target on average", legend=False)
ax.xaxis.get_label().set_visible(False)
ax.set_ylabel("Damage")<jupyter_output><empty_output><jupyter_text>Kinetic Weapons<jupyter_code>weapon_damages_targets_kinetic = weapon_damages_targets.loc[ ["dart_gun", "jet_harpoon", "gas_cannon", "hidro_jet_cannon"] ]
weapon_damages_targets_kinetic = weapon_damages_targets_kinetic.swaplevel().unstack()
weapon_damages_targets_kinetic = weapon_damages_targets_kinetic.sort_values(by=["target"])
ax = weapon_damages_targets_kinetic.plot.bar(title="Damage to target with kinetic weapons")
ax.legend(["Dart gun", "Jet harpoon", "Gas cannon", "Hydro-jet cannon"])
ax.xaxis.get_label().set_visible(False)
ax.set_ylabel("Damage")<jupyter_output><empty_output><jupyter_text>Melee<jupyter_code>weapon_damages_targets_kinetic = weapon_damages_targets.loc[ ["thermal_tazer", "vibro_blade", "thermic_lance", "heavy_thermic_lance"] ]
weapon_damages_targets_kinetic = weapon_damages_targets_kinetic.swaplevel().unstack()
weapon_damages_targets_kinetic = weapon_damages_targets_kinetic.sort_values(by=["target"])
ax = weapon_damages_targets_kinetic.plot.bar(title="Damage to target with kinetic weapons")
ax.legend(["Thermal tazer", "Vibro blade", "Thermic lance", "Heavy thermic lance"])
ax.xaxis.get_label().set_visible(False)
ax.set_ylabel("Damage")<jupyter_output><empty_output><jupyter_text>Explosive<jupyter_code>weapon_damages_targets_grenade = weapon_damages_targets.loc[ ["magna_blast_grenade", "particle_disturbance_grenade", "magna_pack_explosive", "sonic_pulser"] ]
weapon_damages_targets_grenade = weapon_damages_targets_grenade.swaplevel().unstack()
weapon_damages_targets_grenade = weapon_damages_targets_grenade.sort_values(by=["target"])
ax = weapon_damages_targets_grenade.plot.bar(title="Damage to target with grenades")
ax.legend(["Magna blast", "Particle disturbance", "Magna-pack", "Sonic pulser"])
ax.xaxis.get_label().set_visible(False)
ax.set_ylabel("Damage")
weapon_damages_targets_launcher = weapon_damages_targets.loc[ ["torpedo_launcher", "disruptor_pulse_launcher", "thermal_shok_launcher"] ]
weapon_damages_targets_launcher = weapon_damages_targets_launcher.swaplevel().unstack()
weapon_damages_targets_launcher = weapon_damages_targets_launcher.sort_values(by=["target"])
ax = weapon_damages_targets_launcher.plot.bar(title="Damage to target with launchers")
ax.legend(["Torpedo launcher", "Thermal shok launcher", "Disruptor pulse launcher"])
ax.xaxis.get_label().set_visible(False)
ax.set_ylabel("Damage")<jupyter_output><empty_output><jupyter_text>Gauss<jupyter_code>weapon_damages_targets_laser = weapon_damages_targets.loc[ ["gauss_pistol", "gauss_rifle", "heavy_gauss"] ]
weapon_damages_targets_laser = weapon_damages_targets_laser.swaplevel().unstack()
weapon_damages_targets_laser = weapon_damages_targets_laser.sort_values(by=["target"])
ax = weapon_damages_targets_laser.plot.bar(title="Damage to target with gauss")
ax.legend(["Gauss pistol", "Gauss rifle", "Heavy gauss"])
ax.xaxis.get_label().set_visible(False)
ax.set_ylabel("Damage")<jupyter_output><empty_output><jupyter_text>Sonic<jupyter_code>weapon_damages_targets_plasma = weapon_damages_targets.loc[ ["sonic_pistol", "sonic_blasta_rifle", "sonic_cannon"] ]
weapon_damages_targets_plasma = weapon_damages_targets_plasma.swaplevel().unstack()
weapon_damages_targets_plasma = weapon_damages_targets_plasma.sort_values(by=["target"])
ax = weapon_damages_targets_plasma.plot.bar(title="Damage to target with sonic")
ax.legend(["Sonic pistol", "Sonic-blasta rifle", "Sonic cannon"])
ax.xaxis.get_label().set_visible(False)
ax.set_ylabel("Damage")<jupyter_output><empty_output><jupyter_text>Tank<jupyter_code>weapon_damages_targets_tank = weapon_damages_targets.loc[ ["aqua_jet_cannon_turret", "gas_cannon_turret", "gauss_cannon_turret", "sonic_cannon_turret", "pwt_cannon_turret"] ]
weapon_damages_targets_tank = weapon_damages_targets_tank.swaplevel().unstack()
weapon_damages_targets_tank = weapon_damages_targets_tank.sort_values(by=["target"])
ax = weapon_damages_targets_tank.plot.bar(title="Damage to target with turrets")
ax.legend(["Aqua jet", "Gas cannon", "Gauss", "Sonic", "PWT"])
ax.xaxis.get_label().set_visible(False)
ax.set_ylabel("Damage")<jupyter_output><empty_output><jupyter_text>Target Damage Lists  Averages<jupyter_code>weapon_damages_average = weapon_damages_targets.groupby(["weapon"]).mean()
weapon_damages_average = weapon_damages_average.sort_values(by=["turn_damage"])
weapon_damages_max = weapon_damages_targets.groupby(["weapon"]).max()
weapon_damages_max = weapon_damages_max.sort_values(by=["turn_damage"])
average_damages_expected = weapon_damages_max.merge(weapon_damages_average, on="weapon")
average_damages_expected = average_damages_expected.rename(columns={"turn_damage_x": "max", "turn_damage_y": "average"})
average_damages_expected = average_damages_expected.sort_values(by=["average"])
average_damages_expected
ax = average_damages_expected.plot.bar(title="Damage per turn on average target", legend=False)
ax.legend(["Max", "Average"])
ax.xaxis.get_label().set_visible(False)
ax.set_ylabel("Damage")<jupyter_output><empty_output><jupyter_text>Damage Per Time Unit<jupyter_code>weapon_damages_per_tu_targets = weapon_data_targets.groupby(["weapon", "target"]).mean()
weapon_damages_per_tu_targets = weapon_damages_per_tu_targets[["target_damage_per_time_unit"]]
weapon_damages_per_tu_targets = weapon_damages_per_tu_targets.rename(columns={"target_damage_per_time_unit": "damage_per_time_unit"})
weapon_damages_per_tu_targets = weapon_damages_per_tu_targets.sort_values(by=["damage_per_time_unit"])
weapon_damages_per_tu_targets_average = weapon_damages_per_tu_targets.groupby(["weapon"]).mean()
weapon_damages_per_tu_targets_average = weapon_damages_per_tu_targets_average.sort_values(by=["damage_per_time_unit"])
weapon_damages_per_tu_targets_max = weapon_damages_per_tu_targets.groupby(["weapon"]).max()
weapon_damages_per_tu_targets_max = weapon_damages_per_tu_targets_max.sort_values(by=["damage_per_time_unit"])
weapon_damages_per_tu_targets_expected = weapon_damages_per_tu_targets_max.merge(weapon_damages_per_tu_targets_average, on="weapon")
weapon_damages_per_tu_targets_expected = weapon_damages_per_tu_targets_expected.rename(columns={"damage_per_time_unit_x": "max", "damage_per_time_unit_y": "average"})
weapon_damages_per_tu_targets_expected = weapon_damages_per_tu_targets_expected.sort_values(by=["average"])
weapon_damages_per_tu_targets_expected
ax = weapon_damages_per_tu_targets_expected.plot.bar(title="Damage per time unit on average target", legend=False)
ax.legend(["Max", "Average"])
ax.xaxis.get_label().set_visible(False)
ax.set_ylabel("Ratio")<jupyter_output><empty_output><jupyter_text>Terrain<jupyter_code>weapon_damages_terrain = weapon_damages_targets.xs("terrain", level="target")
weapon_damages_terrain = weapon_damages_terrain.sort_values(by=["turn_damage"])
ax = weapon_damages_terrain.plot.bar(title="Damage per turn to terrain", legend=False)
ax.xaxis.get_label().set_visible(False)
ax.set_ylabel("Damage")<jupyter_output><empty_output><jupyter_text>Unarmored<jupyter_code>weapon_damages_unarmored = weapon_damages_targets.xs("unarmored", level="target")
weapon_damages_unarmored = weapon_damages_unarmored.sort_values(by=["turn_damage"])
ax = weapon_damages_unarmored.plot.bar(title="Damage per turn to unarmored", legend=False)
ax.xaxis.get_label().set_visible(False)
ax.set_ylabel("Damage")<jupyter_output><empty_output><jupyter_text>Plastic Aqua Armor<jupyter_code>weapon_damages_armor = weapon_damages_targets.xs("plastic_aqua_armor", level="target")
weapon_damages_armor = weapon_damages_armor.sort_values(by=["turn_damage"])
ax = weapon_damages_unarmored.plot.bar(title="Damage per turn to plastic aqua armor", legend=False)
ax.xaxis.get_label().set_visible(False)
ax.set_ylabel("Damage")<jupyter_output><empty_output><jupyter_text>Ion Armor<jupyter_code>weapon_damages_power_suit = weapon_damages_targets.xs("ion_armor", level="target")
weapon_damages_power_suit = weapon_damages_power_suit.sort_values(by=["turn_damage"])
ax = weapon_damages_power_suit.plot.bar(title="Damage per turn to ion armor", legend=False)
ax.xaxis.get_label().set_visible(False)
ax.set_ylabel("Damage")<jupyter_output><empty_output><jupyter_text>Tank<jupyter_code>weapon_damages_tank = weapon_damages_targets.xs("tank", level="target")
weapon_damages_tank = weapon_damages_tank.sort_values(by=["turn_damage"])
ax = weapon_damages_tank.plot.bar(title="Damage per turn to tank", legend=False)
ax.xaxis.get_label().set_visible(False)
ax.set_ylabel("Damage")<jupyter_output><empty_output><jupyter_text>Gillman<jupyter_code>weapon_damages_snakeman = weapon_damages_targets.xs("gillman", level="target")
weapon_damages_snakeman = weapon_damages_snakeman.sort_values(by=["turn_damage"])
ax = weapon_damages_snakeman.plot.bar(title="Damage per turn to gillman", legend=False)
ax.xaxis.get_label().set_visible(False)
ax.set_ylabel("Damage")<jupyter_output><empty_output><jupyter_text>Deep One<jupyter_code>weapon_damages_ethereal = weapon_damages_targets.xs("deep_one", level="target")
weapon_damages_ethereal = weapon_damages_ethereal.sort_values(by=["turn_damage"])
ax = weapon_damages_ethereal.plot.bar(title="Damage per turn to deep one", legend=False)
ax.xaxis.get_label().set_visible(False)
ax.set_ylabel("Damage")<jupyter_output><empty_output><jupyter_text>Tasoth<jupyter_code>weapon_damages_muton = weapon_damages_targets.xs("tasoth", level="target")
weapon_damages_muton = weapon_damages_muton.sort_values(by=["turn_damage"])
ax = weapon_damages_muton.plot.bar(title="Damage per turn to tasoth", legend=False)
ax.xaxis.get_label().set_visible(False)
ax.set_ylabel("Damage")<jupyter_output><empty_output><jupyter_text>Calcinite<jupyter_code>weapon_damages_silacoid = weapon_damages_targets.xs("calcinite", level="target")
weapon_damages_silacoid = weapon_damages_silacoid.sort_values(by=["turn_damage"])
ax = weapon_damages_silacoid.plot.bar(title="Damage per turn to calcinite", legend=False)
ax.xaxis.get_label().set_visible(False)
ax.set_ylabel("Damage")<jupyter_output><empty_output><jupyter_text>Tentaculat<jupyter_code>weapon_damages_chryssalid = weapon_damages_targets.xs("tentaculat", level="target")
weapon_damages_chryssalid = weapon_damages_chryssalid.sort_values(by=["turn_damage"])
ax = weapon_damages_chryssalid.plot.bar(title="Damage per turn to tentaculat", legend=False)
ax.xaxis.get_label().set_visible(False)
ax.set_ylabel("Damage")<jupyter_output><empty_output><jupyter_text>Lobsterman<jupyter_code>weapon_damages_reaper = weapon_damages_targets.xs("lobsterman", level="target")
weapon_damages_reaper = weapon_damages_reaper.sort_values(by=["turn_damage"])
ax = weapon_damages_reaper.plot.bar(title="Damage per turn to lobsterman", legend=False)
ax.xaxis.get_label().set_visible(False)
ax.set_ylabel("Damage")<jupyter_output><empty_output><jupyter_text>Xarquid<jupyter_code>weapon_damages_sectopod = weapon_damages_targets.xs("xarquid", level="target")
weapon_damages_sectopod = weapon_damages_sectopod.sort_values(by=["turn_damage"])
ax = weapon_damages_sectopod.plot.bar(title="Damage per turn to xarquid", legend=False)
ax.xaxis.get_label().set_visible(False)
ax.set_ylabel("Damage")<jupyter_output><empty_output><jupyter_text>Hallucinoid<jupyter_code>weapon_damages_cyberdisk = weapon_damages_targets.xs("hallucinoid", level="target")
weapon_damages_cyberdisk = weapon_damages_cyberdisk.sort_values(by=["turn_damage"])
ax = weapon_damages_cyberdisk.plot.bar(title="Damage per turn to hallucinoid", legend=False)
ax.xaxis.get_label().set_visible(False)
ax.set_ylabel("Damage")<jupyter_output><empty_output><jupyter_text>Zombie<jupyter_code>weapon_damages_zombie = weapon_damages_targets.xs("zombie", level="target")
weapon_damages_zombie = weapon_damages_zombie.sort_values(by=["turn_damage"])
ax = weapon_damages_zombie.plot.bar(title="Damage per turn to zombie", legend=False)
ax.xaxis.get_label().set_visible(False)
ax.set_ylabel("Damage")<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12379760694455307, 'fraction_numerical': 0.0, 'mean_word_length': 14.614163614163614, 'pattern_counts': {'":': 6, '<': 101, '<?xml version=': 0, '>': 101, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '25', 'dir': 'jupyter-structured-clean-dedup', 'id': '324298', 'license': 'MIT', 'n_tokens_mistral': 4976, 'n_tokens_neox': 4792, 'n_words': 472, 'path': 'terror_from_the_deep/weapon_damage_target.ipynb', 'repo_name': 'Bernardo-MG/xcom-analysis-jupyter-notebook', 'size': '12787'}