<jupyter_start><jupyter_text>1. Read the dataset<jupyter_code>import pandas as pd 
import seaborn as sns
data = pd.read_csv("pubg - Dr. <NAME>.csv")
data.head()<jupyter_output><empty_output><jupyter_text>2. Check the datatype of all the columns.<jupyter_code>#checking datatype of all columns
data.dtypes<jupyter_output><empty_output><jupyter_text>3. Find the summary of all the numerical columns and write your findings about it.<jupyter_code>#Summary of all numerical columns
data.describe()<jupyter_output><empty_output><jupyter_text>As seen above, describe() function gives the stats of only the numerical columns. Each column consists a "count" of 10000 values. The "mean" parameter indicates the mean value of all the columns. The "std" parameter represents standard deviation, which is the deviation from the mean. The "min" and "max" parameters represent the maximum and minimum values respectively of each column. For example, consider the column "killPlace". Now, 25% indicates that 25% of the players have the kill place of 24 or less. Same goes for 50% and 75%.<jupyter_code>data['kills'].describe()<jupyter_output><empty_output><jupyter_text>4. The average person kills how many players?  5. 99% of people have how many kills?  6. The most kills ever recorded are how much?<jupyter_code>#Observations from "kills" column
average_kills = data['kills'].mean()
print("The average person kills: ", average_kills)
Q99 = data["kills"].quantile(0.99)
print("99% of people have", Q99, "kills")
max_kills = data['kills'].max()
print("The maximum kills ever recorded are: ",max_kills,"kills")<jupyter_output>The average person kills:  0.9134
99% of people have 7.0 kills
The maximum kills ever recorded are:  35 kills<jupyter_text>7. Print all the columns of the dataframe.<jupyter_code>#printing all the columns of the dataframe
data.columns<jupyter_output><empty_output><jupyter_text>8. Comment on distribution of the match's duration. Use seaborn.<jupyter_code>#distribution of match duration
import matplotlib.pyplot as plt
plt.figure(figsize=(15,5))
import seaborn as sns
sns.distplot(data["matchDuration"]);
data["matchDuration"].describe()<jupyter_output><empty_output><jupyter_text>As seen from the Seaborn's distplot above, the longest duration match played is between 1350 and 1400 seconds. The second longest duration is between 1850 and 1890 seconds.  9. Comment on distribution of the walk distance. Use seaborn.<jupyter_code>#distribution of walk distance
%matplotlib inline
import matplotlib.pyplot as plt
plt.figure(figsize=(15,5))
import seaborn as sns
sns.distplot(data["walkDistance"],bins=10);<jupyter_output><empty_output><jupyter_text>The maximum walk distance seen from the above  Seaborn's distplot is approx. 1000 mts  10. Plot distribution of the match's duration vs walk distance one below the other.<jupyter_code># matchDuration and walkDistance plots one below the other
import matplotlib.pyplot as plt
import seaborn as sns
plt.figure(figsize=(15,8))

plt.subplot(2,1,1)
sns.distplot(data["matchDuration"])

plt.subplot(2,1,2)
sns.distplot(data["walkDistance"]);<jupyter_output><empty_output><jupyter_text>11. Plot distribution of the match's duration vs walk distance side by side.<jupyter_code># matchDuration and walkDistance plots side by side
import matplotlib.pyplot as plt
import seaborn as sns
plt.figure(figsize=(15,5))

plt.subplot(1,2,1)
sns.distplot(data["matchDuration"])

plt.subplot(1,2,2)
sns.distplot(data["walkDistance"]);<jupyter_output><empty_output><jupyter_text>12. Pairplot the dataframe. Comment on kills vs damage dealt, Comment on maxPlace vs numGroups<jupyter_code>columns = data[["kills","damageDealt","maxPlace","numGroups"]]
columns.head()
import seaborn as sns
sns.pairplot(columns);<jupyter_output><empty_output><jupyter_text>Pairplot observations:1. kills vs damage dealtMore the kills, damage dealt is more. There's a linear relationship as seen in the plot above.2. maxPlace vs numGroupsThere's a positive linear relationship between maxPlace and numGroups<jupyter_code>import seaborn as sns
sns.distplot(data["maxPlace"]);
solo = data[data["numGroups"]>50]
duos = data[(data['numGroups']>25) & (data['numGroups']<=50)]
squad = data[data["numGroups"]<=25]
solo.head()
#for solo
solo_col = solo[["kills","damageDealt","maxPlace","numGroups"]]
sns.pairplot(solo_col)
#for duos
duo_col = duos[["kills","damageDealt","maxPlace","numGroups"]]
sns.pairplot(duo_col)
#for squad
squad_col = squad[["kills","damageDealt","maxPlace","numGroups"]]
sns.pairplot(squad_col)<jupyter_output><empty_output><jupyter_text>13. How many unique values are there in 'matchType' and what are their counts?<jupyter_code># Unique values and their count in "matchType" column
data["matchType"].value_counts()<jupyter_output><empty_output><jupyter_text>14. Plot a barplot of ‘matchType’ vs 'killPoints'. Write your inferences.<jupyter_code>plt.figure(figsize=(15,8))
sns.barplot(x="matchType", y="killPoints", data = data)
plt.xticks(rotation=90);<jupyter_output><empty_output><jupyter_text>As seen from the bar plot above, maximum kill points are achieved for the match types normal-squad-fpp and normal-duo-fppThe kill points are the least for solo and solo-fpp match types  15. Plot a barplot of ‘matchType’ vs ‘weaponsAcquired’. Write your inferences<jupyter_code>plt.figure(figsize=(15,8))
sns.barplot(x="matchType", y="weaponsAcquired", data = data)
plt.xticks(rotation=90);<jupyter_output><empty_output><jupyter_text>As seen from the bar plot above, normal-solo-fpp and normal-squad-fpp have acquired the maximum number of weaponsWhereas, crashtpp and crashtpp have acquired the least number of weapons  16. Find the Categorical columns<jupyter_code>#listing all the categorical columns
categorical = data.select_dtypes(include = ['object'])
categorical.columns<jupyter_output><empty_output><jupyter_text>17. Plot a boxplot of ‘matchType’ vs ‘winPlacePerc’. Write your inferences<jupyter_code>plt.figure(figsize=(10,8))
sns.boxplot(x='matchType',y='winPlacePerc',data=data)
plt.xticks(rotation=90);<jupyter_output><empty_output><jupyter_text>The match type "normal-duo-fpp" has the highest spread of winPlacePerc. Therefore, its probability of winning is more.  18. Plot a boxplot of ‘matchType’ vs ‘matchDuration’. Write your inferences<jupyter_code>plt.figure(figsize=(10,8))
sns.boxplot(x='matchType',y='matchDuration',data=data)
plt.xticks(rotation=90);<jupyter_output><empty_output><jupyter_text>The match type "normal-squad-fpp" has the highest spread of matchDuration   19. Change the orientation of the above plot to horizontal<jupyter_code>#changing the orientation of above plot to horizontal
plt.figure(figsize=(15,10))
sns.boxplot(x='matchDuration',y='matchType',data=data,orient="h");<jupyter_output><empty_output><jupyter_text>20. Add a new column called ‘KILL’ which contains the sum of following columns viz. headshotKills, teamKills, roadKills.<jupyter_code>#Adding a new column "KILL" to the dataset
data["KILL"] = data["headshotKills"]+data["teamKills"]+data["roadKills"]
data.head()
data["KILL"].describe()<jupyter_output><empty_output><jupyter_text>21. Round off column ‘winPlacePerc’ to 2 decimals.<jupyter_code>#rounding off column "winPlacePerc" to 2 decimal places
data['winPlacePerc'] = round(data['winPlacePerc'] , 2)
data['winPlacePerc'].head()<jupyter_output><empty_output><jupyter_text>22. Take a sample of size 50 from the column damageDealt for 100 times and calculate its mean. Plot it on a histogram and comment on its distribution.<jupyter_code>#taking sample of size 50 from the column "damageDealt" and calculating its mean for 100 times
l = []
x=0
while x<100:
    sample = data["damageDealt"].sample(n=50).mean()
    sample = round(sample,2)
    l.append(sample)
    x = x + 1
print(l)
#plotting histogram for damageDealt
%matplotlib inline
plt.figure(figsize=(10,8))
plt.hist(l,histtype="step");
plt.title("Damage Dealt by the player");<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1127734473221021, 'fraction_numerical': 0.022127231581594166, 'mean_word_length': 7.329842931937173, 'pattern_counts': {'":': 0, '<': 92, '<?xml version=': 0, '>': 91, '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': '22', 'dir': 'jupyter-structured-clean-dedup', 'id': '12575', 'license': 'Apache-2.0', 'n_tokens_mistral': 2740, 'n_tokens_neox': 2588, 'n_words': 756, 'path': 'Project/Project_PUBG.ipynb', 'repo_name': 'ChinmayJog89/LetsUpgrade_DataScience_Essentials', 'size': '7961'}