Files
Machine-Learning-Models/TestModel/testFile.ipynb

486 lines
15 KiB
Plaintext

{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Rank</th>\n",
" <th>Name</th>\n",
" <th>Platform</th>\n",
" <th>Year</th>\n",
" <th>Genre</th>\n",
" <th>Publisher</th>\n",
" <th>NA_Sales</th>\n",
" <th>EU_Sales</th>\n",
" <th>JP_Sales</th>\n",
" <th>Other_Sales</th>\n",
" <th>Global_Sales</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>1</td>\n",
" <td>Wii Sports</td>\n",
" <td>Wii</td>\n",
" <td>2006.0</td>\n",
" <td>Sports</td>\n",
" <td>Nintendo</td>\n",
" <td>41.49</td>\n",
" <td>29.02</td>\n",
" <td>3.77</td>\n",
" <td>8.46</td>\n",
" <td>82.74</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>2</td>\n",
" <td>Super Mario Bros.</td>\n",
" <td>NES</td>\n",
" <td>1985.0</td>\n",
" <td>Platform</td>\n",
" <td>Nintendo</td>\n",
" <td>29.08</td>\n",
" <td>3.58</td>\n",
" <td>6.81</td>\n",
" <td>0.77</td>\n",
" <td>40.24</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>3</td>\n",
" <td>Mario Kart Wii</td>\n",
" <td>Wii</td>\n",
" <td>2008.0</td>\n",
" <td>Racing</td>\n",
" <td>Nintendo</td>\n",
" <td>15.85</td>\n",
" <td>12.88</td>\n",
" <td>3.79</td>\n",
" <td>3.31</td>\n",
" <td>35.82</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>4</td>\n",
" <td>Wii Sports Resort</td>\n",
" <td>Wii</td>\n",
" <td>2009.0</td>\n",
" <td>Sports</td>\n",
" <td>Nintendo</td>\n",
" <td>15.75</td>\n",
" <td>11.01</td>\n",
" <td>3.28</td>\n",
" <td>2.96</td>\n",
" <td>33.00</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>5</td>\n",
" <td>Pokemon Red/Pokemon Blue</td>\n",
" <td>GB</td>\n",
" <td>1996.0</td>\n",
" <td>Role-Playing</td>\n",
" <td>Nintendo</td>\n",
" <td>11.27</td>\n",
" <td>8.89</td>\n",
" <td>10.22</td>\n",
" <td>1.00</td>\n",
" <td>31.37</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>6</td>\n",
" <td>Tetris</td>\n",
" <td>GB</td>\n",
" <td>1989.0</td>\n",
" <td>Puzzle</td>\n",
" <td>Nintendo</td>\n",
" <td>23.20</td>\n",
" <td>2.26</td>\n",
" <td>4.22</td>\n",
" <td>0.58</td>\n",
" <td>30.26</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6</th>\n",
" <td>7</td>\n",
" <td>New Super Mario Bros.</td>\n",
" <td>DS</td>\n",
" <td>2006.0</td>\n",
" <td>Platform</td>\n",
" <td>Nintendo</td>\n",
" <td>11.38</td>\n",
" <td>9.23</td>\n",
" <td>6.50</td>\n",
" <td>2.90</td>\n",
" <td>30.01</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7</th>\n",
" <td>8</td>\n",
" <td>Wii Play</td>\n",
" <td>Wii</td>\n",
" <td>2006.0</td>\n",
" <td>Misc</td>\n",
" <td>Nintendo</td>\n",
" <td>14.03</td>\n",
" <td>9.20</td>\n",
" <td>2.93</td>\n",
" <td>2.85</td>\n",
" <td>29.02</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8</th>\n",
" <td>9</td>\n",
" <td>New Super Mario Bros. Wii</td>\n",
" <td>Wii</td>\n",
" <td>2009.0</td>\n",
" <td>Platform</td>\n",
" <td>Nintendo</td>\n",
" <td>14.59</td>\n",
" <td>7.06</td>\n",
" <td>4.70</td>\n",
" <td>2.26</td>\n",
" <td>28.62</td>\n",
" </tr>\n",
" <tr>\n",
" <th>9</th>\n",
" <td>10</td>\n",
" <td>Duck Hunt</td>\n",
" <td>NES</td>\n",
" <td>1984.0</td>\n",
" <td>Shooter</td>\n",
" <td>Nintendo</td>\n",
" <td>26.93</td>\n",
" <td>0.63</td>\n",
" <td>0.28</td>\n",
" <td>0.47</td>\n",
" <td>28.31</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Rank Name Platform Year Genre Publisher \\\n",
"0 1 Wii Sports Wii 2006.0 Sports Nintendo \n",
"1 2 Super Mario Bros. NES 1985.0 Platform Nintendo \n",
"2 3 Mario Kart Wii Wii 2008.0 Racing Nintendo \n",
"3 4 Wii Sports Resort Wii 2009.0 Sports Nintendo \n",
"4 5 Pokemon Red/Pokemon Blue GB 1996.0 Role-Playing Nintendo \n",
"5 6 Tetris GB 1989.0 Puzzle Nintendo \n",
"6 7 New Super Mario Bros. DS 2006.0 Platform Nintendo \n",
"7 8 Wii Play Wii 2006.0 Misc Nintendo \n",
"8 9 New Super Mario Bros. Wii Wii 2009.0 Platform Nintendo \n",
"9 10 Duck Hunt NES 1984.0 Shooter Nintendo \n",
"\n",
" NA_Sales EU_Sales JP_Sales Other_Sales Global_Sales \n",
"0 41.49 29.02 3.77 8.46 82.74 \n",
"1 29.08 3.58 6.81 0.77 40.24 \n",
"2 15.85 12.88 3.79 3.31 35.82 \n",
"3 15.75 11.01 3.28 2.96 33.00 \n",
"4 11.27 8.89 10.22 1.00 31.37 \n",
"5 23.20 2.26 4.22 0.58 30.26 \n",
"6 11.38 9.23 6.50 2.90 30.01 \n",
"7 14.03 9.20 2.93 2.85 29.02 \n",
"8 14.59 7.06 4.70 2.26 28.62 \n",
"9 26.93 0.63 0.28 0.47 28.31 "
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import pandas as pd\n",
"df = pd.read_csv('vgsales.csv')\n",
"df.head(10)"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(16598, 11)"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df.shape"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Rank</th>\n",
" <th>Year</th>\n",
" <th>NA_Sales</th>\n",
" <th>EU_Sales</th>\n",
" <th>JP_Sales</th>\n",
" <th>Other_Sales</th>\n",
" <th>Global_Sales</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>count</th>\n",
" <td>16598.000000</td>\n",
" <td>16327.000000</td>\n",
" <td>16598.000000</td>\n",
" <td>16598.000000</td>\n",
" <td>16598.000000</td>\n",
" <td>16598.000000</td>\n",
" <td>16598.000000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>mean</th>\n",
" <td>8300.605254</td>\n",
" <td>2006.406443</td>\n",
" <td>0.264667</td>\n",
" <td>0.146652</td>\n",
" <td>0.077782</td>\n",
" <td>0.048063</td>\n",
" <td>0.537441</td>\n",
" </tr>\n",
" <tr>\n",
" <th>std</th>\n",
" <td>4791.853933</td>\n",
" <td>5.828981</td>\n",
" <td>0.816683</td>\n",
" <td>0.505351</td>\n",
" <td>0.309291</td>\n",
" <td>0.188588</td>\n",
" <td>1.555028</td>\n",
" </tr>\n",
" <tr>\n",
" <th>min</th>\n",
" <td>1.000000</td>\n",
" <td>1980.000000</td>\n",
" <td>0.000000</td>\n",
" <td>0.000000</td>\n",
" <td>0.000000</td>\n",
" <td>0.000000</td>\n",
" <td>0.010000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>25%</th>\n",
" <td>4151.250000</td>\n",
" <td>2003.000000</td>\n",
" <td>0.000000</td>\n",
" <td>0.000000</td>\n",
" <td>0.000000</td>\n",
" <td>0.000000</td>\n",
" <td>0.060000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>50%</th>\n",
" <td>8300.500000</td>\n",
" <td>2007.000000</td>\n",
" <td>0.080000</td>\n",
" <td>0.020000</td>\n",
" <td>0.000000</td>\n",
" <td>0.010000</td>\n",
" <td>0.170000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>75%</th>\n",
" <td>12449.750000</td>\n",
" <td>2010.000000</td>\n",
" <td>0.240000</td>\n",
" <td>0.110000</td>\n",
" <td>0.040000</td>\n",
" <td>0.040000</td>\n",
" <td>0.470000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>max</th>\n",
" <td>16600.000000</td>\n",
" <td>2020.000000</td>\n",
" <td>41.490000</td>\n",
" <td>29.020000</td>\n",
" <td>10.220000</td>\n",
" <td>10.570000</td>\n",
" <td>82.740000</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Rank Year NA_Sales EU_Sales JP_Sales \\\n",
"count 16598.000000 16327.000000 16598.000000 16598.000000 16598.000000 \n",
"mean 8300.605254 2006.406443 0.264667 0.146652 0.077782 \n",
"std 4791.853933 5.828981 0.816683 0.505351 0.309291 \n",
"min 1.000000 1980.000000 0.000000 0.000000 0.000000 \n",
"25% 4151.250000 2003.000000 0.000000 0.000000 0.000000 \n",
"50% 8300.500000 2007.000000 0.080000 0.020000 0.000000 \n",
"75% 12449.750000 2010.000000 0.240000 0.110000 0.040000 \n",
"max 16600.000000 2020.000000 41.490000 29.020000 10.220000 \n",
"\n",
" Other_Sales Global_Sales \n",
"count 16598.000000 16598.000000 \n",
"mean 0.048063 0.537441 \n",
"std 0.188588 1.555028 \n",
"min 0.000000 0.010000 \n",
"25% 0.000000 0.060000 \n",
"50% 0.010000 0.170000 \n",
"75% 0.040000 0.470000 \n",
"max 10.570000 82.740000 "
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df.describe()"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([[1, 'Wii Sports', 'Wii', ..., 3.77, 8.46, 82.74],\n",
" [2, 'Super Mario Bros.', 'NES', ..., 6.81, 0.77, 40.24],\n",
" [3, 'Mario Kart Wii', 'Wii', ..., 3.79, 3.31, 35.82],\n",
" ...,\n",
" [16598, 'SCORE International Baja 1000: The Official Game', 'PS2',\n",
" ..., 0.0, 0.0, 0.01],\n",
" [16599, 'Know How 2', 'DS', ..., 0.0, 0.0, 0.01],\n",
" [16600, 'Spirits & Spells', 'GBA', ..., 0.0, 0.0, 0.01]],\n",
" dtype=object)"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df.values"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"<class 'pandas.core.frame.DataFrame'>\n",
"RangeIndex: 16598 entries, 0 to 16597\n",
"Data columns (total 11 columns):\n",
" # Column Non-Null Count Dtype \n",
"--- ------ -------------- ----- \n",
" 0 Rank 16598 non-null int64 \n",
" 1 Name 16598 non-null object \n",
" 2 Platform 16598 non-null object \n",
" 3 Year 16327 non-null float64\n",
" 4 Genre 16598 non-null object \n",
" 5 Publisher 16540 non-null object \n",
" 6 NA_Sales 16598 non-null float64\n",
" 7 EU_Sales 16598 non-null float64\n",
" 8 JP_Sales 16598 non-null float64\n",
" 9 Other_Sales 16598 non-null float64\n",
" 10 Global_Sales 16598 non-null float64\n",
"dtypes: float64(6), int64(1), object(4)\n",
"memory usage: 1.4+ MB\n"
]
}
],
"source": [
"df.info()"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3.8.11 ('base')",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.13"
},
"orig_nbformat": 4,
"vscode": {
"interpreter": {
"hash": "5819c1eaf6d552792a1bbc5e8998e6c2149ab26a1973a0d78107c0d9954e5ba0"
}
}
},
"nbformat": 4,
"nbformat_minor": 2
}