Professional Documents
Culture Documents
[2]:
import pandas as pd
import numpy as np
In [6]:
d=pd.read_csv('C:\\Users\\UP\\Downloads\\charcters_stats.csv')
In [11]:
d.head()
Out[11]: Name Alignment Intelligence Strength Speed Durability Power Combat Total
In [12]:
d.shape
Out[12]: (611, 9)
In [14]:
d['Alignment'].value_counts()
bad 165
neutral 11
In [15]:
good=d[d['Alignment']=='good']
In [19]:
good.head()
Out[19]: Name Alignment Intelligence Strength Speed Durability Power Combat Total
In [24]:
good.sort_values(by=['Speed'],ascending=False)
Out[24]:
Name Alignment Intelligence Strength Speed Durability Power Combat Total
... ... ... ... ... ... ... ... ... ...
In [25]:
good.sort_values(by=['Speed'],ascending=False).head()
Out[25]: Name Alignment Intelligence Strength Speed Durability Power Combat Total
In [27]:
good_max_power_full=good[good['Power']==100]
In [28]:
good_max_power_full.shape
Out[28]: (33, 9)
In [29]:
good_max_power_full
Out[29]: Name Alignment Intelligence Strength Speed Durability Power Combat Total
Martian
361 good 100 100 96 100 100 85 581
Manhunter
In [33]:
good_max_power=good.sort_values(by=['Total'],ascending=False)
In [36]:
good_max_power.head()
Out[36]: Name Alignment Intelligence Strength Speed Durability Power Combat Total
Martian
361 good 100 100 96 100 100 85 581
Manhunter
In [40]:
plt.figure(figsize=(8,5))
plt.bar(list(good_max_power['Name'])[0:5],list(good_max_power['Total'])[0:5],color='r')
plt.show()
In [41]:
bad=d[d['Alignment']=="bad"]
In [42]:
bad.head()
Out[42]: Name Alignment Intelligence Strength Speed Durability Power Combat Total
17 Ammo bad 1 1 1 1 0 1 5
In [44]:
bad.sort_values(by=['Speed'],ascending=False).head()
Out[44]: Name Alignment Intelligence Strength Speed Durability Power Combat Total
Name Alignment Intelligence Strength Speed Durability Power Combat Total
In [46]:
bad.sort_values(by=['Intelligence'],ascending=False).head()
Out[46]: Name Alignment Intelligence Strength Speed Durability Power Combat Total
In [47]:
bad.sort_values(by=['Total'],ascending=False).head()
Out[47]: Name Alignment Intelligence Strength Speed Durability Power Combat Total
In [48]:
bad_max_power=bad.sort_values(by=['Total'],ascending=False)
In [49]:
plt.figure(figsize=(10,5))
plt.bar(list(bad_max_power['Name'])[0:5],list(bad_max_power['Total'])[0:5],color=["red"
plt.show()
In [50]:
plt.figure(figsize=(10,5))
plt.hist(good['Speed'])
plt.title("Distribution of Speed")
plt.xlabel("Speed")
plt.show()
In [51]:
plt.figure(figsize=(10,5))
plt.hist(bad['Combat'])
plt.title("Distribution of Combat")
plt.xlabel("Combat")
plt.show()
In [ ]: