{ "cells": [ { "cell_type": "code", "execution_count": 97, "id": "12ec3e54", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
BrandNameAudience scorePricePaceArch supportWeight lab Weight brandLightweightDrop lab Drop brandStrike pattern...Heel lab Heel brandForefoot lab Forefoot brandWidths availableOrthotic friendlySeasonRemovable insoleRankingPopularityGenderTerrain
0BrooksLaunch 987\\n Great!$110Daily runningTempoNeutral7.9 oz / 225g 8.1 oz / 230g19.4 mm 10.0 mmHeelMid/forefoot...32.4 mm 36.0 mm23.0 mm 26.0 mmNormalWide1-1#301 Top 47%#352 Bottom 45%NaNNaN
1BrooksLevitate 690\\n Superb!$150Daily runningNeutral10.7 oz / 304g 10.9 oz / 309g07.7 mm 8.0 mmMid/forefoot...34.3 mm 32.5 mm26.6 mm 24.5 mmNormal1SummerAll seasons1#72 Top 20%#255 Bottom 30%NaNNaN
2Adidas4DFWD90\\n Superb!$200Daily runningNeutral11.9 oz / 336g 11.5 oz / 327g08.9 mm 10.0 mmHeelMid/forefoot...33.3 mm 32.5 mm24.4 mm 22.5 mmNormal1All seasons1#104 Top 17%#368 Bottom 42%NaNNaN
3Adidas4DFWD 290\\n Superb!$200Daily runningNeutral12.6 oz / 356g 12.4 oz / 352g010.6 mm 11.0 mmHeel...31.8 mm 32.0 mm21.2 mm 21.0 mmNormal1All seasons1#126 Top 20%#541 Bottom 16%NaNNaN
4Adidas4DFWD 388\\n Great!$200Daily runningNeutral12.3 oz / 348g 12.2 oz / 345g09.9 mm 10.0 mmHeelMid/forefoot...32.6 mm 34.0 mm22.7 mm 24.0 mmNormal1All seasons1#116 Top 32%#339 Bottom 7%NaNNaN
\n", "

5 rows × 33 columns

\n", "
" ], "text/plain": [ " Brand Name Audience score Price Pace Arch support \\\n", "0 Brooks Launch 9 87\\n Great! $110 Daily runningTempo Neutral \n", "1 Brooks Levitate 6 90\\n Superb! $150 Daily running Neutral \n", "2 Adidas 4DFWD 90\\n Superb! $200 Daily running Neutral \n", "3 Adidas 4DFWD 2 90\\n Superb! $200 Daily running Neutral \n", "4 Adidas 4DFWD 3 88\\n Great! $200 Daily running Neutral \n", "\n", " Weight lab Weight brand Lightweight Drop lab Drop brand \\\n", "0 7.9 oz / 225g 8.1 oz / 230g 1 9.4 mm 10.0 mm \n", "1 10.7 oz / 304g 10.9 oz / 309g 0 7.7 mm 8.0 mm \n", "2 11.9 oz / 336g 11.5 oz / 327g 0 8.9 mm 10.0 mm \n", "3 12.6 oz / 356g 12.4 oz / 352g 0 10.6 mm 11.0 mm \n", "4 12.3 oz / 348g 12.2 oz / 345g 0 9.9 mm 10.0 mm \n", "\n", " Strike pattern ... Heel lab Heel brand Forefoot lab Forefoot brand \\\n", "0 HeelMid/forefoot ... 32.4 mm 36.0 mm 23.0 mm 26.0 mm \n", "1 Mid/forefoot ... 34.3 mm 32.5 mm 26.6 mm 24.5 mm \n", "2 HeelMid/forefoot ... 33.3 mm 32.5 mm 24.4 mm 22.5 mm \n", "3 Heel ... 31.8 mm 32.0 mm 21.2 mm 21.0 mm \n", "4 HeelMid/forefoot ... 32.6 mm 34.0 mm 22.7 mm 24.0 mm \n", "\n", " Widths available Orthotic friendly Season Removable insole \\\n", "0 NormalWide 1 - 1 \n", "1 Normal 1 SummerAll seasons 1 \n", "2 Normal 1 All seasons 1 \n", "3 Normal 1 All seasons 1 \n", "4 Normal 1 All seasons 1 \n", "\n", " Ranking Popularity Gender Terrain \n", "0 #301 Top 47% #352 Bottom 45% NaN NaN \n", "1 #72 Top 20% #255 Bottom 30% NaN NaN \n", "2 #104 Top 17% #368 Bottom 42% NaN NaN \n", "3 #126 Top 20% #541 Bottom 16% NaN NaN \n", "4 #116 Top 32% #339 Bottom 7% NaN NaN \n", "\n", "[5 rows x 33 columns]" ] }, "execution_count": 97, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import pandas as pd\n", "\n", "df_ori = pd.read_csv('../../data/SONIX utilities - Road.csv')\n", "df_ori.head()" ] }, { "cell_type": "markdown", "id": "eb6307f4", "metadata": {}, "source": [ "# Remove Duplicates" ] }, { "cell_type": "code", "execution_count": 98, "id": "2edb9233", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "1170\n" ] }, { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
BrandName
5Adidas4DFWD 3
11AdidasAdistar 3
12AdidasAdistar 3
13AdidasAdistar 3
14AdidasAdistar 3
.........
166OnCloudgo
169OnCloudmonster 2
170OnCloudmonster 2
171OnCloudmonster 2
172OnCloudmonster 2
\n", "

100 rows × 2 columns

\n", "
" ], "text/plain": [ " Brand Name\n", "5 Adidas 4DFWD 3\n", "11 Adidas Adistar 3\n", "12 Adidas Adistar 3\n", "13 Adidas Adistar 3\n", "14 Adidas Adistar 3\n", ".. ... ...\n", "166 On Cloudgo\n", "169 On Cloudmonster 2\n", "170 On Cloudmonster 2\n", "171 On Cloudmonster 2\n", "172 On Cloudmonster 2\n", "\n", "[100 rows x 2 columns]" ] }, "execution_count": 98, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dup_mask = df_ori.duplicated(subset=[\"Brand\", \"Name\"], keep=\"first\")\n", "print(len(dup_mask))\n", "df_ori.loc[dup_mask, [\"Brand\", \"Name\"]].head(100)" ] }, { "cell_type": "code", "execution_count": 99, "id": "5e7c5b10", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Before: 1170\n", "After : 443\n" ] }, { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
BrandNameAudience scorePricePaceArch supportWeight lab Weight brandLightweightDrop lab Drop brandStrike pattern...Heel lab Heel brandForefoot lab Forefoot brandWidths availableOrthotic friendlySeasonRemovable insoleRankingPopularityGenderTerrain
0BrooksLaunch 987\\n Great!$110Daily runningTempoNeutral7.9 oz / 225g 8.1 oz / 230g19.4 mm 10.0 mmHeelMid/forefoot...32.4 mm 36.0 mm23.0 mm 26.0 mmNormalWide1-1#301 Top 47%#352 Bottom 45%NaNNaN
1BrooksLevitate 690\\n Superb!$150Daily runningNeutral10.7 oz / 304g 10.9 oz / 309g07.7 mm 8.0 mmMid/forefoot...34.3 mm 32.5 mm26.6 mm 24.5 mmNormal1SummerAll seasons1#72 Top 20%#255 Bottom 30%NaNNaN
2Adidas4DFWD90\\n Superb!$200Daily runningNeutral11.9 oz / 336g 11.5 oz / 327g08.9 mm 10.0 mmHeelMid/forefoot...33.3 mm 32.5 mm24.4 mm 22.5 mmNormal1All seasons1#104 Top 17%#368 Bottom 42%NaNNaN
3Adidas4DFWD 290\\n Superb!$200Daily runningNeutral12.6 oz / 356g 12.4 oz / 352g010.6 mm 11.0 mmHeel...31.8 mm 32.0 mm21.2 mm 21.0 mmNormal1All seasons1#126 Top 20%#541 Bottom 16%NaNNaN
4Adidas4DFWD 388\\n Great!$200Daily runningNeutral12.3 oz / 348g 12.2 oz / 345g09.9 mm 10.0 mmHeelMid/forefoot...32.6 mm 34.0 mm22.7 mm 24.0 mmNormal1All seasons1#116 Top 32%#339 Bottom 7%NaNNaN
5BrooksAddiction GTS 1585\\n Good!$140Daily runningMotion control12.5 oz / 353g 12.2 oz / 346g012.1 mm 12.0 mmHeel...36.5 mm 36.0 mm24.4 mm 24.0 mmNarrowNormalWideX-Wide1All seasons1#221 Bottom 39%#159 Top 44%NaNNaN
6AdidasAdidas Adizero SL290\\n Superb!$130Daily runningTempoNeutral8.6 oz / 245g 8.4 oz / 238g18.2 mm 9.0 mmHeelMid/forefoot...34.9 mm 35.0 mm26.7 mm 26.0 mmNormalWide1SummerAll seasons1#44 Top 13%#166 Top 46%NaNNaN
7AdidasAdistar88\\n Great!$130Daily runningNeutral11.5 oz / 325g 11.2 oz / 318g09.6 mm 6.0 mmHeelMid/forefoot...34.4 mm 37.5 mm24.8 mm 31.5 mmNormal1All seasons1#267 Top 42%#247 Top 39%NaNNaN
8AdidasAdistar 2.083\\n Good!$130Daily runningNeutral11.6 oz / 328g 11.6 oz / 328g08.0 mm 6.0 mmHeelMid/forefoot...33.8 mm 33.0 mm25.8 mm 27.0 mmNormal1SummerAll seasons1#506 Bottom 21%#643 Bottom 1%NaNNaN
9AdidasAdistar 389\\n Great!$130Daily runningNeutral9.7 oz / 274g 9.5 oz / 270g010.5 mm 5.0 mmHeel...40.7 mm 40.0 mm30.2 mm 35.0 mmNormalWide1SummerAll seasons1#97 Top 27%#241 Bottom 33%NaNNaN
10AdidasAdizero Adios 781\\n Good!$130TempoNeutral7.5 oz / 212g 7.5 oz / 212g18.7 mm 8.0 mmHeelMid/forefoot...31.6 mm 27.0 mm22.9 mm 19.0 mmNormalWide1SummerAll seasons1#535 Bottom 17%#614 Bottom 4%NaNNaN
11AdidasAdizero Adios 890\\n Superb!$130TempoNeutral7.4 oz / 210g 7 oz / 198g17.6 mm 8.0 mmMid/forefoot...28.0 mm 28.0 mm20.4 mm 20.0 mmNormal1SummerAll seasons1#129 Top 20%#553 Bottom 14%NaNNaN
12AdidasAdizero Adios 992\\n Superb!$140CompetitionTempoNeutral6.2 oz / 176g 6.2 oz / 176g16.2 mm 7.0 mmMid/forefoot...25.0 mm 28.0 mm18.8 mm 21.0 mmNormal1All seasons1#7 Top 2%#245 Bottom 33%NaNNaN
13AdidasAdizero Adios Pro 2.091\\n Superb!$220CompetitionNeutral7.9 oz / 223g 7.6 oz / 215g110.3 mm 10.0 mmHeel...40.0 mm 39.5 mm29.7 mm 29.5 mmNormal0-0#32 Top 5%#569 Bottom 11%NaNNaN
14AdidasAdizero Adios Pro 391\\n Superb!$250CompetitionNeutral7.7 oz / 218g 7.9 oz / 223g18.0 mm 6.5 mmHeelMid/forefoot...37.8 mm 39.5 mm29.8 mm 33.0 mmNormal1SummerAll seasons1#41 Top 7%#202 Top 32%NaNNaN
15AdidasAdizero Adios Pro 493\\n Superb!$250CompetitionNeutral7.1 oz / 200g 7.1 oz / 201g18.1 mm 6.0 mmHeelMid/forefoot...36.6 mm 39.0 mm28.5 mm 33.0 mmNormalWide1All seasons1#1 Top 1%#38 Top 11%NaNNaN
16AdidasAdizero Boston 1183\\n Good!$160TempoNeutral10.2 oz / 290g 9.6 oz / 272g09.8 mm 8.5 mmHeelMid/forefoot...39.1 mm 39.5 mm29.3 mm 31.0 mmNormalWide1All seasons1#480 Bottom 25%#579 Bottom 10%NaNNaN
17AdidasAdizero Boston 1288\\n Great!$160TempoNeutral9.2 oz / 261g 9.2 oz / 260g06.1 mm 6.5 mmMid/forefoot...34.5 mm 37.0 mm28.4 mm 30.5 mmNormalWide1SummerAll seasons1#216 Top 34%#338 Bottom 47%NaNNaN
18AdidasAdizero Boston 1390\\n Superb!$160CompetitionTempoNeutral9 oz / 254g 9 oz / 255g06.0 mm 6.0 mmMid/forefoot...34.3 mm 36.0 mm28.3 mm 30.0 mmNormalWide1All seasons1#38 Top 11%#206 Bottom 43%NaNNaN
19AdidasAdizero EVO SL93\\n Superb!$150Daily runningTempoNeutral7.9 oz / 223g 7.9 oz / 224g18.0 mm 6.5 mmHeelMid/forefoot...36.1 mm 38.5 mm28.1 mm 32.0 mmNormalWide1SummerAll seasons1#2 Top 1%#23 Top 7%NaNNaN
\n", "

20 rows × 33 columns

\n", "
" ], "text/plain": [ " Brand Name Audience score Price Pace \\\n", "0 Brooks Launch 9 87\\n Great! $110 Daily runningTempo \n", "1 Brooks Levitate 6 90\\n Superb! $150 Daily running \n", "2 Adidas 4DFWD 90\\n Superb! $200 Daily running \n", "3 Adidas 4DFWD 2 90\\n Superb! $200 Daily running \n", "4 Adidas 4DFWD 3 88\\n Great! $200 Daily running \n", "5 Brooks Addiction GTS 15 85\\n Good! $140 Daily running \n", "6 Adidas Adidas Adizero SL2 90\\n Superb! $130 Daily runningTempo \n", "7 Adidas Adistar 88\\n Great! $130 Daily running \n", "8 Adidas Adistar 2.0 83\\n Good! $130 Daily running \n", "9 Adidas Adistar 3 89\\n Great! $130 Daily running \n", "10 Adidas Adizero Adios 7 81\\n Good! $130 Tempo \n", "11 Adidas Adizero Adios 8 90\\n Superb! $130 Tempo \n", "12 Adidas Adizero Adios 9 92\\n Superb! $140 CompetitionTempo \n", "13 Adidas Adizero Adios Pro 2.0 91\\n Superb! $220 Competition \n", "14 Adidas Adizero Adios Pro 3 91\\n Superb! $250 Competition \n", "15 Adidas Adizero Adios Pro 4 93\\n Superb! $250 Competition \n", "16 Adidas Adizero Boston 11 83\\n Good! $160 Tempo \n", "17 Adidas Adizero Boston 12 88\\n Great! $160 Tempo \n", "18 Adidas Adizero Boston 13 90\\n Superb! $160 CompetitionTempo \n", "19 Adidas Adizero EVO SL 93\\n Superb! $150 Daily runningTempo \n", "\n", " Arch support Weight lab Weight brand Lightweight \\\n", "0 Neutral 7.9 oz / 225g 8.1 oz / 230g 1 \n", "1 Neutral 10.7 oz / 304g 10.9 oz / 309g 0 \n", "2 Neutral 11.9 oz / 336g 11.5 oz / 327g 0 \n", "3 Neutral 12.6 oz / 356g 12.4 oz / 352g 0 \n", "4 Neutral 12.3 oz / 348g 12.2 oz / 345g 0 \n", "5 Motion control 12.5 oz / 353g 12.2 oz / 346g 0 \n", "6 Neutral 8.6 oz / 245g 8.4 oz / 238g 1 \n", "7 Neutral 11.5 oz / 325g 11.2 oz / 318g 0 \n", "8 Neutral 11.6 oz / 328g 11.6 oz / 328g 0 \n", "9 Neutral 9.7 oz / 274g 9.5 oz / 270g 0 \n", "10 Neutral 7.5 oz / 212g 7.5 oz / 212g 1 \n", "11 Neutral 7.4 oz / 210g 7 oz / 198g 1 \n", "12 Neutral 6.2 oz / 176g 6.2 oz / 176g 1 \n", "13 Neutral 7.9 oz / 223g 7.6 oz / 215g 1 \n", "14 Neutral 7.7 oz / 218g 7.9 oz / 223g 1 \n", "15 Neutral 7.1 oz / 200g 7.1 oz / 201g 1 \n", "16 Neutral 10.2 oz / 290g 9.6 oz / 272g 0 \n", "17 Neutral 9.2 oz / 261g 9.2 oz / 260g 0 \n", "18 Neutral 9 oz / 254g 9 oz / 255g 0 \n", "19 Neutral 7.9 oz / 223g 7.9 oz / 224g 1 \n", "\n", " Drop lab Drop brand Strike pattern ... Heel lab Heel brand \\\n", "0 9.4 mm 10.0 mm HeelMid/forefoot ... 32.4 mm 36.0 mm \n", "1 7.7 mm 8.0 mm Mid/forefoot ... 34.3 mm 32.5 mm \n", "2 8.9 mm 10.0 mm HeelMid/forefoot ... 33.3 mm 32.5 mm \n", "3 10.6 mm 11.0 mm Heel ... 31.8 mm 32.0 mm \n", "4 9.9 mm 10.0 mm HeelMid/forefoot ... 32.6 mm 34.0 mm \n", "5 12.1 mm 12.0 mm Heel ... 36.5 mm 36.0 mm \n", "6 8.2 mm 9.0 mm HeelMid/forefoot ... 34.9 mm 35.0 mm \n", "7 9.6 mm 6.0 mm HeelMid/forefoot ... 34.4 mm 37.5 mm \n", "8 8.0 mm 6.0 mm HeelMid/forefoot ... 33.8 mm 33.0 mm \n", "9 10.5 mm 5.0 mm Heel ... 40.7 mm 40.0 mm \n", "10 8.7 mm 8.0 mm HeelMid/forefoot ... 31.6 mm 27.0 mm \n", "11 7.6 mm 8.0 mm Mid/forefoot ... 28.0 mm 28.0 mm \n", "12 6.2 mm 7.0 mm Mid/forefoot ... 25.0 mm 28.0 mm \n", "13 10.3 mm 10.0 mm Heel ... 40.0 mm 39.5 mm \n", "14 8.0 mm 6.5 mm HeelMid/forefoot ... 37.8 mm 39.5 mm \n", "15 8.1 mm 6.0 mm HeelMid/forefoot ... 36.6 mm 39.0 mm \n", "16 9.8 mm 8.5 mm HeelMid/forefoot ... 39.1 mm 39.5 mm \n", "17 6.1 mm 6.5 mm Mid/forefoot ... 34.5 mm 37.0 mm \n", "18 6.0 mm 6.0 mm Mid/forefoot ... 34.3 mm 36.0 mm \n", "19 8.0 mm 6.5 mm HeelMid/forefoot ... 36.1 mm 38.5 mm \n", "\n", " Forefoot lab Forefoot brand Widths available Orthotic friendly \\\n", "0 23.0 mm 26.0 mm NormalWide 1 \n", "1 26.6 mm 24.5 mm Normal 1 \n", "2 24.4 mm 22.5 mm Normal 1 \n", "3 21.2 mm 21.0 mm Normal 1 \n", "4 22.7 mm 24.0 mm Normal 1 \n", "5 24.4 mm 24.0 mm NarrowNormalWideX-Wide 1 \n", "6 26.7 mm 26.0 mm NormalWide 1 \n", "7 24.8 mm 31.5 mm Normal 1 \n", "8 25.8 mm 27.0 mm Normal 1 \n", "9 30.2 mm 35.0 mm NormalWide 1 \n", "10 22.9 mm 19.0 mm NormalWide 1 \n", "11 20.4 mm 20.0 mm Normal 1 \n", "12 18.8 mm 21.0 mm Normal 1 \n", "13 29.7 mm 29.5 mm Normal 0 \n", "14 29.8 mm 33.0 mm Normal 1 \n", "15 28.5 mm 33.0 mm NormalWide 1 \n", "16 29.3 mm 31.0 mm NormalWide 1 \n", "17 28.4 mm 30.5 mm NormalWide 1 \n", "18 28.3 mm 30.0 mm NormalWide 1 \n", "19 28.1 mm 32.0 mm NormalWide 1 \n", "\n", " Season Removable insole Ranking Popularity \\\n", "0 - 1 #301 Top 47% #352 Bottom 45% \n", "1 SummerAll seasons 1 #72 Top 20% #255 Bottom 30% \n", "2 All seasons 1 #104 Top 17% #368 Bottom 42% \n", "3 All seasons 1 #126 Top 20% #541 Bottom 16% \n", "4 All seasons 1 #116 Top 32% #339 Bottom 7% \n", "5 All seasons 1 #221 Bottom 39% #159 Top 44% \n", "6 SummerAll seasons 1 #44 Top 13% #166 Top 46% \n", "7 All seasons 1 #267 Top 42% #247 Top 39% \n", "8 SummerAll seasons 1 #506 Bottom 21% #643 Bottom 1% \n", "9 SummerAll seasons 1 #97 Top 27% #241 Bottom 33% \n", "10 SummerAll seasons 1 #535 Bottom 17% #614 Bottom 4% \n", "11 SummerAll seasons 1 #129 Top 20% #553 Bottom 14% \n", "12 All seasons 1 #7 Top 2% #245 Bottom 33% \n", "13 - 0 #32 Top 5% #569 Bottom 11% \n", "14 SummerAll seasons 1 #41 Top 7% #202 Top 32% \n", "15 All seasons 1 #1 Top 1% #38 Top 11% \n", "16 All seasons 1 #480 Bottom 25% #579 Bottom 10% \n", "17 SummerAll seasons 1 #216 Top 34% #338 Bottom 47% \n", "18 All seasons 1 #38 Top 11% #206 Bottom 43% \n", "19 SummerAll seasons 1 #2 Top 1% #23 Top 7% \n", "\n", " Gender Terrain \n", "0 NaN NaN \n", "1 NaN NaN \n", "2 NaN NaN \n", "3 NaN NaN \n", "4 NaN NaN \n", "5 NaN NaN \n", "6 NaN NaN \n", "7 NaN NaN \n", "8 NaN NaN \n", "9 NaN NaN \n", "10 NaN NaN \n", "11 NaN NaN \n", "12 NaN NaN \n", "13 NaN NaN \n", "14 NaN NaN \n", "15 NaN NaN \n", "16 NaN NaN \n", "17 NaN NaN \n", "18 NaN NaN \n", "19 NaN NaN \n", "\n", "[20 rows x 33 columns]" ] }, "execution_count": 99, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# sebelum hapus\n", "print(\"Before:\", len(df_ori))\n", "\n", "#hapus\n", "df_ori = df_ori.drop_duplicates(subset=[\"Brand\", \"Name\"], keep=\"first\").reset_index(drop=True)\n", "\n", "print(\"After :\", len(df_ori))\n", "df_ori.head(20)" ] }, { "cell_type": "code", "execution_count": 100, "id": "ba33ddcc", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 443 entries, 0 to 442\n", "Data columns (total 33 columns):\n", " # Column Non-Null Count Dtype\n", "--- ------ -------------- -----\n", " 0 Brand 443 non-null str \n", " 1 Name 443 non-null str \n", " 2 Audience score 441 non-null str \n", " 3 Price 443 non-null str \n", " 4 Pace 443 non-null str \n", " 5 Arch support 443 non-null str \n", " 6 Weight lab Weight brand 443 non-null str \n", " 7 Lightweight 443 non-null int64\n", " 8 Drop lab Drop brand 443 non-null str \n", " 9 Strike pattern 443 non-null str \n", " 10 Size 443 non-null str \n", " 11 Midsole softness 443 non-null str \n", " 12 Toebox durability 443 non-null str \n", " 13 Heel padding durability 443 non-null str \n", " 14 Outsole durability 443 non-null str \n", " 15 Breathability 443 non-null str \n", " 16 Width / fit 443 non-null str \n", " 17 Toebox width 443 non-null str \n", " 18 Stiffness 443 non-null str \n", " 19 Torsional rigidity 443 non-null str \n", " 20 Heel counter stiffness 443 non-null str \n", " 21 Plate 443 non-null str \n", " 22 Rocker 443 non-null int64\n", " 23 Heel lab Heel brand 443 non-null str \n", " 24 Forefoot lab Forefoot brand 443 non-null str \n", " 25 Widths available 443 non-null str \n", " 26 Orthotic friendly 443 non-null int64\n", " 27 Season 443 non-null str \n", " 28 Removable insole 443 non-null int64\n", " 29 Ranking 443 non-null str \n", " 30 Popularity 443 non-null str \n", " 31 Gender 4 non-null str \n", " 32 Terrain 9 non-null str \n", "dtypes: int64(4), str(29)\n", "memory usage: 114.3 KB\n" ] } ], "source": [ "df_ori.info()" ] }, { "cell_type": "markdown", "id": "48eb34c8", "metadata": {}, "source": [ "# Removing unused" ] }, { "cell_type": "code", "execution_count": 101, "id": "af4ea6fc", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
BrandNameAudience scorePricePaceArch supportWeight lab Weight brandLightweightDrop lab Drop brandStrike pattern...Heel lab Heel brandForefoot lab Forefoot brandWidths availableOrthotic friendlySeasonRemovable insoleRankingPopularityGenderTerrain
0BrooksLaunch 987\\n Great!$110Daily runningTempoNeutral7.9 oz / 225g 8.1 oz / 230g19.4 mm 10.0 mmHeelMid/forefoot...32.4 mm 36.0 mm23.0 mm 26.0 mmNormalWide1-1#301 Top 47%#352 Bottom 45%NaNNaN
1BrooksLevitate 690\\n Superb!$150Daily runningNeutral10.7 oz / 304g 10.9 oz / 309g07.7 mm 8.0 mmMid/forefoot...34.3 mm 32.5 mm26.6 mm 24.5 mmNormal1SummerAll seasons1#72 Top 20%#255 Bottom 30%NaNNaN
2Adidas4DFWD90\\n Superb!$200Daily runningNeutral11.9 oz / 336g 11.5 oz / 327g08.9 mm 10.0 mmHeelMid/forefoot...33.3 mm 32.5 mm24.4 mm 22.5 mmNormal1All seasons1#104 Top 17%#368 Bottom 42%NaNNaN
3Adidas4DFWD 290\\n Superb!$200Daily runningNeutral12.6 oz / 356g 12.4 oz / 352g010.6 mm 11.0 mmHeel...31.8 mm 32.0 mm21.2 mm 21.0 mmNormal1All seasons1#126 Top 20%#541 Bottom 16%NaNNaN
4Adidas4DFWD 388\\n Great!$200Daily runningNeutral12.3 oz / 348g 12.2 oz / 345g09.9 mm 10.0 mmHeelMid/forefoot...32.6 mm 34.0 mm22.7 mm 24.0 mmNormal1All seasons1#116 Top 32%#339 Bottom 7%NaNNaN
\n", "

5 rows × 33 columns

\n", "
" ], "text/plain": [ " Brand Name Audience score Price Pace Arch support \\\n", "0 Brooks Launch 9 87\\n Great! $110 Daily runningTempo Neutral \n", "1 Brooks Levitate 6 90\\n Superb! $150 Daily running Neutral \n", "2 Adidas 4DFWD 90\\n Superb! $200 Daily running Neutral \n", "3 Adidas 4DFWD 2 90\\n Superb! $200 Daily running Neutral \n", "4 Adidas 4DFWD 3 88\\n Great! $200 Daily running Neutral \n", "\n", " Weight lab Weight brand Lightweight Drop lab Drop brand \\\n", "0 7.9 oz / 225g 8.1 oz / 230g 1 9.4 mm 10.0 mm \n", "1 10.7 oz / 304g 10.9 oz / 309g 0 7.7 mm 8.0 mm \n", "2 11.9 oz / 336g 11.5 oz / 327g 0 8.9 mm 10.0 mm \n", "3 12.6 oz / 356g 12.4 oz / 352g 0 10.6 mm 11.0 mm \n", "4 12.3 oz / 348g 12.2 oz / 345g 0 9.9 mm 10.0 mm \n", "\n", " Strike pattern ... Heel lab Heel brand Forefoot lab Forefoot brand \\\n", "0 HeelMid/forefoot ... 32.4 mm 36.0 mm 23.0 mm 26.0 mm \n", "1 Mid/forefoot ... 34.3 mm 32.5 mm 26.6 mm 24.5 mm \n", "2 HeelMid/forefoot ... 33.3 mm 32.5 mm 24.4 mm 22.5 mm \n", "3 Heel ... 31.8 mm 32.0 mm 21.2 mm 21.0 mm \n", "4 HeelMid/forefoot ... 32.6 mm 34.0 mm 22.7 mm 24.0 mm \n", "\n", " Widths available Orthotic friendly Season Removable insole \\\n", "0 NormalWide 1 - 1 \n", "1 Normal 1 SummerAll seasons 1 \n", "2 Normal 1 All seasons 1 \n", "3 Normal 1 All seasons 1 \n", "4 Normal 1 All seasons 1 \n", "\n", " Ranking Popularity Gender Terrain \n", "0 #301 Top 47% #352 Bottom 45% NaN NaN \n", "1 #72 Top 20% #255 Bottom 30% NaN NaN \n", "2 #104 Top 17% #368 Bottom 42% NaN NaN \n", "3 #126 Top 20% #541 Bottom 16% NaN NaN \n", "4 #116 Top 32% #339 Bottom 7% NaN NaN \n", "\n", "[5 rows x 33 columns]" ] }, "execution_count": 101, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df = df_ori.copy()\n", "df.head()" ] }, { "cell_type": "code", "execution_count": 102, "id": "5babe62e", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
BrandNameAudience scorePricePaceArch supportWeight lab Weight brandLightweightDrop lab Drop brandStrike pattern...PlateRockerHeel lab Heel brandForefoot lab Forefoot brandWidths availableOrthotic friendlySeasonRemovable insoleRankingPopularity
0BrooksLaunch 987\\n Great!$110Daily runningTempoNeutral7.9 oz / 225g 8.1 oz / 230g19.4 mm 10.0 mmHeelMid/forefoot...0032.4 mm 36.0 mm23.0 mm 26.0 mmNormalWide1-1#301 Top 47%#352 Bottom 45%
1BrooksLevitate 690\\n Superb!$150Daily runningNeutral10.7 oz / 304g 10.9 oz / 309g07.7 mm 8.0 mmMid/forefoot...0034.3 mm 32.5 mm26.6 mm 24.5 mmNormal1SummerAll seasons1#72 Top 20%#255 Bottom 30%
2Adidas4DFWD90\\n Superb!$200Daily runningNeutral11.9 oz / 336g 11.5 oz / 327g08.9 mm 10.0 mmHeelMid/forefoot...0033.3 mm 32.5 mm24.4 mm 22.5 mmNormal1All seasons1#104 Top 17%#368 Bottom 42%
3Adidas4DFWD 290\\n Superb!$200Daily runningNeutral12.6 oz / 356g 12.4 oz / 352g010.6 mm 11.0 mmHeel...0031.8 mm 32.0 mm21.2 mm 21.0 mmNormal1All seasons1#126 Top 20%#541 Bottom 16%
4Adidas4DFWD 388\\n Great!$200Daily runningNeutral12.3 oz / 348g 12.2 oz / 345g09.9 mm 10.0 mmHeelMid/forefoot...0032.6 mm 34.0 mm22.7 mm 24.0 mmNormal1All seasons1#116 Top 32%#339 Bottom 7%
\n", "

5 rows × 31 columns

\n", "
" ], "text/plain": [ " Brand Name Audience score Price Pace Arch support \\\n", "0 Brooks Launch 9 87\\n Great! $110 Daily runningTempo Neutral \n", "1 Brooks Levitate 6 90\\n Superb! $150 Daily running Neutral \n", "2 Adidas 4DFWD 90\\n Superb! $200 Daily running Neutral \n", "3 Adidas 4DFWD 2 90\\n Superb! $200 Daily running Neutral \n", "4 Adidas 4DFWD 3 88\\n Great! $200 Daily running Neutral \n", "\n", " Weight lab Weight brand Lightweight Drop lab Drop brand \\\n", "0 7.9 oz / 225g 8.1 oz / 230g 1 9.4 mm 10.0 mm \n", "1 10.7 oz / 304g 10.9 oz / 309g 0 7.7 mm 8.0 mm \n", "2 11.9 oz / 336g 11.5 oz / 327g 0 8.9 mm 10.0 mm \n", "3 12.6 oz / 356g 12.4 oz / 352g 0 10.6 mm 11.0 mm \n", "4 12.3 oz / 348g 12.2 oz / 345g 0 9.9 mm 10.0 mm \n", "\n", " Strike pattern ... Plate Rocker Heel lab Heel brand \\\n", "0 HeelMid/forefoot ... 0 0 32.4 mm 36.0 mm \n", "1 Mid/forefoot ... 0 0 34.3 mm 32.5 mm \n", "2 HeelMid/forefoot ... 0 0 33.3 mm 32.5 mm \n", "3 Heel ... 0 0 31.8 mm 32.0 mm \n", "4 HeelMid/forefoot ... 0 0 32.6 mm 34.0 mm \n", "\n", " Forefoot lab Forefoot brand Widths available Orthotic friendly \\\n", "0 23.0 mm 26.0 mm NormalWide 1 \n", "1 26.6 mm 24.5 mm Normal 1 \n", "2 24.4 mm 22.5 mm Normal 1 \n", "3 21.2 mm 21.0 mm Normal 1 \n", "4 22.7 mm 24.0 mm Normal 1 \n", "\n", " Season Removable insole Ranking Popularity \n", "0 - 1 #301 Top 47% #352 Bottom 45% \n", "1 SummerAll seasons 1 #72 Top 20% #255 Bottom 30% \n", "2 All seasons 1 #104 Top 17% #368 Bottom 42% \n", "3 All seasons 1 #126 Top 20% #541 Bottom 16% \n", "4 All seasons 1 #116 Top 32% #339 Bottom 7% \n", "\n", "[5 rows x 31 columns]" ] }, "execution_count": 102, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df.drop(columns=[\"Gender\", \"Terrain\"], inplace=True)\n", "df.head()" ] }, { "cell_type": "code", "execution_count": 103, "id": "29c40bab", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 443 entries, 0 to 442\n", "Data columns (total 25 columns):\n", " # Column Non-Null Count Dtype\n", "--- ------ -------------- -----\n", " 0 Brand 443 non-null str \n", " 1 Name 443 non-null str \n", " 2 Pace 443 non-null str \n", " 3 Arch support 443 non-null str \n", " 4 Weight lab Weight brand 443 non-null str \n", " 5 Lightweight 443 non-null int64\n", " 6 Drop lab Drop brand 443 non-null str \n", " 7 Strike pattern 443 non-null str \n", " 8 Midsole softness 443 non-null str \n", " 9 Toebox durability 443 non-null str \n", " 10 Heel padding durability 443 non-null str \n", " 11 Outsole durability 443 non-null str \n", " 12 Breathability 443 non-null str \n", " 13 Width / fit 443 non-null str \n", " 14 Toebox width 443 non-null str \n", " 15 Stiffness 443 non-null str \n", " 16 Torsional rigidity 443 non-null str \n", " 17 Heel counter stiffness 443 non-null str \n", " 18 Plate 443 non-null str \n", " 19 Rocker 443 non-null int64\n", " 20 Heel lab Heel brand 443 non-null str \n", " 21 Forefoot lab Forefoot brand 443 non-null str \n", " 22 Orthotic friendly 443 non-null int64\n", " 23 Season 443 non-null str \n", " 24 Removable insole 443 non-null int64\n", "dtypes: int64(4), str(21)\n", "memory usage: 86.7 KB\n" ] } ], "source": [ "df.drop(columns=['Audience score', 'Price', 'Size', \n", " 'Widths available', 'Ranking', 'Popularity'], inplace=True)\n", "df.info()" ] }, { "cell_type": "markdown", "id": "8a0dd91b", "metadata": {}, "source": [ "# Pace" ] }, { "cell_type": "code", "execution_count": 104, "id": "f98cc9d7", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Pace\n", "Daily running 304\n", "Daily runningTempo 55\n", "Competition 32\n", "Tempo 31\n", "CompetitionTempo 21\n", "Name: count, dtype: int64\n" ] } ], "source": [ "print(df[\"Pace\"].value_counts())" ] }, { "cell_type": "code", "execution_count": 105, "id": "9ab7badd", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Rows: 443\n", "NULL Value: 0\n", "\n", "Sample Comparison:\n", " Pace pace_daily_running pace_tempo pace_competition\n", "0 daily runningtempo 1 1 0\n", "6 daily runningtempo 1 1 0\n", "12 competitiontempo 0 1 1\n", "18 competitiontempo 0 1 1\n", "19 daily runningtempo 1 1 0\n" ] } ], "source": [ "df['Pace'] = df['Pace'].astype(str).str.lower()\n", "base_pace = ['daily running', 'tempo', 'competition']\n", "\n", "for level in base_pace:\n", " column_name = f\"pace_{level.replace(' ', '_')}\"\n", " df[column_name] = df['Pace'].str.contains(level, na=False).astype(int)\n", "\n", "print(\"Rows:\", len(df))\n", "\n", "pace_cols = [f\"pace_{l.replace(' ', '_')}\" for l in base_pace]\n", "zero_vector_count = (df[pace_cols].sum(axis=1) == 0).sum()\n", "print(f\"NULL Value: {zero_vector_count}\")\n", "\n", "print(\"\\nSample Comparison:\")\n", "print(df[df[pace_cols].sum(axis=1) > 1][['Pace'] + pace_cols].head())" ] }, { "cell_type": "code", "execution_count": 106, "id": "dcc8c065", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "Value Counts Kolom Asli:\n", "Pace\n", "daily running 304\n", "daily runningtempo 55\n", "competition 32\n", "tempo 31\n", "competitiontempo 21\n", "Name: count, dtype: int64\n", "\n", "pace_daily_running sum: 359\n", "pace_tempo sum: 107\n", "pace_competition sum: 53\n", "\n", " Pace pace_daily_running pace_tempo pace_competition\n", "0 daily runningtempo 1 1 0\n", "1 daily running 1 0 0\n", "2 daily running 1 0 0\n", "3 daily running 1 0 0\n", "4 daily running 1 0 0\n" ] } ], "source": [ "print(\"\\nValue Counts Kolom Asli:\")\n", "print(df[\"Pace\"].value_counts())\n", "\n", "print()\n", "for col in pace_cols:\n", " print(f\"{col} sum:\", int(df[col].sum()))\n", "\n", "print()\n", "print(df[[\"Pace\"] + pace_cols].head())" ] }, { "cell_type": "code", "execution_count": 107, "id": "fd110dce", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 443 entries, 0 to 442\n", "Data columns (total 27 columns):\n", " # Column Non-Null Count Dtype\n", "--- ------ -------------- -----\n", " 0 Brand 443 non-null str \n", " 1 Name 443 non-null str \n", " 2 Arch support 443 non-null str \n", " 3 Weight lab Weight brand 443 non-null str \n", " 4 Lightweight 443 non-null int64\n", " 5 Drop lab Drop brand 443 non-null str \n", " 6 Strike pattern 443 non-null str \n", " 7 Midsole softness 443 non-null str \n", " 8 Toebox durability 443 non-null str \n", " 9 Heel padding durability 443 non-null str \n", " 10 Outsole durability 443 non-null str \n", " 11 Breathability 443 non-null str \n", " 12 Width / fit 443 non-null str \n", " 13 Toebox width 443 non-null str \n", " 14 Stiffness 443 non-null str \n", " 15 Torsional rigidity 443 non-null str \n", " 16 Heel counter stiffness 443 non-null str \n", " 17 Plate 443 non-null str \n", " 18 Rocker 443 non-null int64\n", " 19 Heel lab Heel brand 443 non-null str \n", " 20 Forefoot lab Forefoot brand 443 non-null str \n", " 21 Orthotic friendly 443 non-null int64\n", " 22 Season 443 non-null str \n", " 23 Removable insole 443 non-null int64\n", " 24 pace_daily_running 443 non-null int64\n", " 25 pace_tempo 443 non-null int64\n", " 26 pace_competition 443 non-null int64\n", "dtypes: int64(7), str(20)\n", "memory usage: 93.6 KB\n" ] } ], "source": [ "df.drop(columns=[\"Pace\"], inplace=True)\n", "df.info()" ] }, { "cell_type": "markdown", "id": "f49287c1", "metadata": {}, "source": [ "# Arch support" ] }, { "cell_type": "code", "execution_count": 108, "id": "cf46eaf4", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Arch support\n", "Neutral 378\n", "Stability 64\n", "Motion control 1\n", "Name: count, dtype: int64\n" ] } ], "source": [ "print(df[\"Arch support\"].value_counts())" ] }, { "cell_type": "code", "execution_count": 109, "id": "9dda2e21", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Rows: 443\n", "NULL Value: 0\n", "\n", "Sample Comparison:\n", " Arch support arch_neutral arch_stability\n", "0 neutral 1 0\n", "1 neutral 1 0\n", "2 neutral 1 0\n", "3 neutral 1 0\n", "4 neutral 1 0\n", "5 stability 0 1\n", "6 neutral 1 0\n", "7 neutral 1 0\n", "8 neutral 1 0\n", "9 neutral 1 0\n" ] } ], "source": [ "df['Arch support'] = df['Arch support'].astype(str).str.lower().str.replace('motion control', 'stability', regex=False)\n", "base_arch = ['neutral', 'stability']\n", "\n", "for level in base_arch:\n", " column_name = f\"arch_{level}\"\n", " df[column_name] = df['Arch support'].str.contains(level, na=False).astype(int)\n", "\n", "print(\"Rows:\", len(df))\n", "\n", "arch_cols = [f\"arch_{l}\" for l in base_arch]\n", "zero_vector_count = (df[arch_cols].sum(axis=1) == 0).sum()\n", "print(f\"NULL Value: {zero_vector_count}\")\n", "\n", "print(\"\\nSample Comparison:\")\n", "print(df[[\"Arch support\"] + arch_cols].head(10))" ] }, { "cell_type": "code", "execution_count": 110, "id": "c9d7789c", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Arch support\n", "neutral 378\n", "stability 65\n", "Name: count, dtype: int64\n", "\n", "arch_neutral sum: 378\n", "arch_stability sum: 65\n", "\n", " Arch support arch_neutral arch_stability\n", "0 neutral 1 0\n", "1 neutral 1 0\n", "2 neutral 1 0\n", "3 neutral 1 0\n", "4 neutral 1 0\n" ] } ], "source": [ "print(df[\"Arch support\"].value_counts())\n", "\n", "print()\n", "for level in base_arch:\n", " col = f\"arch_{level}\"\n", " print(f\"{col} sum:\", int(df[col].sum()))\n", "\n", "print()\n", "print(df[[\"Arch support\"] + arch_cols].head())" ] }, { "cell_type": "code", "execution_count": 111, "id": "9da19116", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 443 entries, 0 to 442\n", "Data columns (total 28 columns):\n", " # Column Non-Null Count Dtype\n", "--- ------ -------------- -----\n", " 0 Brand 443 non-null str \n", " 1 Name 443 non-null str \n", " 2 Weight lab Weight brand 443 non-null str \n", " 3 Lightweight 443 non-null int64\n", " 4 Drop lab Drop brand 443 non-null str \n", " 5 Strike pattern 443 non-null str \n", " 6 Midsole softness 443 non-null str \n", " 7 Toebox durability 443 non-null str \n", " 8 Heel padding durability 443 non-null str \n", " 9 Outsole durability 443 non-null str \n", " 10 Breathability 443 non-null str \n", " 11 Width / fit 443 non-null str \n", " 12 Toebox width 443 non-null str \n", " 13 Stiffness 443 non-null str \n", " 14 Torsional rigidity 443 non-null str \n", " 15 Heel counter stiffness 443 non-null str \n", " 16 Plate 443 non-null str \n", " 17 Rocker 443 non-null int64\n", " 18 Heel lab Heel brand 443 non-null str \n", " 19 Forefoot lab Forefoot brand 443 non-null str \n", " 20 Orthotic friendly 443 non-null int64\n", " 21 Season 443 non-null str \n", " 22 Removable insole 443 non-null int64\n", " 23 pace_daily_running 443 non-null int64\n", " 24 pace_tempo 443 non-null int64\n", " 25 pace_competition 443 non-null int64\n", " 26 arch_neutral 443 non-null int64\n", " 27 arch_stability 443 non-null int64\n", "dtypes: int64(9), str(19)\n", "memory usage: 97.0 KB\n" ] } ], "source": [ "df.drop(columns=[\"Arch support\"], inplace=True)\n", "df.info()" ] }, { "cell_type": "markdown", "id": "d60007d4", "metadata": {}, "source": [ "# Weight lab Weight brand" ] }, { "cell_type": "code", "execution_count": 112, "id": "b9c254fe", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "np.int64(0)" ] }, "execution_count": 112, "metadata": {}, "output_type": "execute_result" } ], "source": [ "mask_missing = (\n", " df[\"Weight lab Weight brand\"].isna() |\n", " (df[\"Weight lab Weight brand\"].astype(str).str.strip() == \"-\")\n", ")\n", "mask_missing.sum()" ] }, { "cell_type": "code", "execution_count": 113, "id": "9295f8c2", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " Weight lab Weight brand weight_lab_oz weight_lab_g \\\n", "0 7.9 oz / 225g 8.1 oz / 230g 7.9 225 \n", "1 10.7 oz / 304g 10.9 oz / 309g 10.7 304 \n", "2 11.9 oz / 336g 11.5 oz / 327g 11.9 336 \n", "3 12.6 oz / 356g 12.4 oz / 352g 12.6 356 \n", "4 12.3 oz / 348g 12.2 oz / 345g 12.3 348 \n", "\n", " weight_brand_oz weight_brand_g \n", "0 8.1 230.0 \n", "1 10.9 309.0 \n", "2 11.5 327.0 \n", "3 12.4 352.0 \n", "4 12.2 345.0 \n" ] } ], "source": [ "weight = df[\"Weight lab Weight brand\"].str.findall(r\"[\\d.]+\")\n", "df[[\"weight_lab_oz\", \"weight_lab_g\", \"weight_brand_oz\", \"weight_brand_g\"]] = (\n", " pd.DataFrame(weight.tolist(), index=df.index)\n", ")\n", "\n", "for col in [\"weight_lab_oz\", \"weight_lab_g\", \"weight_brand_oz\", \"weight_brand_g\"]:\n", " df[col] = pd.to_numeric(df[col], errors=\"coerce\")\n", "\n", "print(df[[\"Weight lab Weight brand\", \"weight_lab_oz\", \"weight_lab_g\", \"weight_brand_oz\", \"weight_brand_g\"]].head())" ] }, { "cell_type": "code", "execution_count": 114, "id": "1f6b3a9b", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 443 entries, 0 to 442\n", "Data columns (total 31 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 Brand 443 non-null str \n", " 1 Name 443 non-null str \n", " 2 Lightweight 443 non-null int64 \n", " 3 Drop lab Drop brand 443 non-null str \n", " 4 Strike pattern 443 non-null str \n", " 5 Midsole softness 443 non-null str \n", " 6 Toebox durability 443 non-null str \n", " 7 Heel padding durability 443 non-null str \n", " 8 Outsole durability 443 non-null str \n", " 9 Breathability 443 non-null str \n", " 10 Width / fit 443 non-null str \n", " 11 Toebox width 443 non-null str \n", " 12 Stiffness 443 non-null str \n", " 13 Torsional rigidity 443 non-null str \n", " 14 Heel counter stiffness 443 non-null str \n", " 15 Plate 443 non-null str \n", " 16 Rocker 443 non-null int64 \n", " 17 Heel lab Heel brand 443 non-null str \n", " 18 Forefoot lab Forefoot brand 443 non-null str \n", " 19 Orthotic friendly 443 non-null int64 \n", " 20 Season 443 non-null str \n", " 21 Removable insole 443 non-null int64 \n", " 22 pace_daily_running 443 non-null int64 \n", " 23 pace_tempo 443 non-null int64 \n", " 24 pace_competition 443 non-null int64 \n", " 25 arch_neutral 443 non-null int64 \n", " 26 arch_stability 443 non-null int64 \n", " 27 weight_lab_oz 443 non-null float64\n", " 28 weight_lab_g 443 non-null int64 \n", " 29 weight_brand_oz 436 non-null float64\n", " 30 weight_brand_g 436 non-null float64\n", "dtypes: float64(3), int64(10), str(18)\n", "memory usage: 107.4 KB\n" ] } ], "source": [ "df.drop(columns=[\"Weight lab Weight brand\",], inplace=True)\n", "df.info()" ] }, { "cell_type": "markdown", "id": "aef1ce17", "metadata": {}, "source": [ "# Drop lab Drop brand" ] }, { "cell_type": "code", "execution_count": 115, "id": "eb47f25d", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "np.int64(0)" ] }, "execution_count": 115, "metadata": {}, "output_type": "execute_result" } ], "source": [ "mask_missing = (\n", " df[\"Drop lab Drop brand\"].isna() |\n", " (df[\"Drop lab Drop brand\"].astype(str).str.strip() == \"-\")\n", ")\n", "mask_missing.sum()" ] }, { "cell_type": "code", "execution_count": 116, "id": "7349620c", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " Drop lab Drop brand drop_lab_mm drop_brand_mm\n", "0 9.4 mm 10.0 mm 9.4 10.0\n", "1 7.7 mm 8.0 mm 7.7 8.0\n", "2 8.9 mm 10.0 mm 8.9 10.0\n", "3 10.6 mm 11.0 mm 10.6 11.0\n", "4 9.9 mm 10.0 mm 9.9 10.0\n" ] } ], "source": [ "drop = df[\"Drop lab Drop brand\"].str.findall(r\"[\\d.]+\")\n", "\n", "df[[\"drop_lab_mm\", \"drop_brand_mm\"]] = (\n", " pd.DataFrame(drop.tolist(), index=df.index)\n", ")\n", "\n", "for col in [\"drop_lab_mm\", \"drop_brand_mm\"]:\n", " df[col] = pd.to_numeric(df[col], errors=\"coerce\")\n", "\n", "print(df[[\"Drop lab Drop brand\", \"drop_lab_mm\", \"drop_brand_mm\"]].head())" ] }, { "cell_type": "code", "execution_count": 117, "id": "15d7d64b", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 443 entries, 0 to 442\n", "Data columns (total 32 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 Brand 443 non-null str \n", " 1 Name 443 non-null str \n", " 2 Lightweight 443 non-null int64 \n", " 3 Strike pattern 443 non-null str \n", " 4 Midsole softness 443 non-null str \n", " 5 Toebox durability 443 non-null str \n", " 6 Heel padding durability 443 non-null str \n", " 7 Outsole durability 443 non-null str \n", " 8 Breathability 443 non-null str \n", " 9 Width / fit 443 non-null str \n", " 10 Toebox width 443 non-null str \n", " 11 Stiffness 443 non-null str \n", " 12 Torsional rigidity 443 non-null str \n", " 13 Heel counter stiffness 443 non-null str \n", " 14 Plate 443 non-null str \n", " 15 Rocker 443 non-null int64 \n", " 16 Heel lab Heel brand 443 non-null str \n", " 17 Forefoot lab Forefoot brand 443 non-null str \n", " 18 Orthotic friendly 443 non-null int64 \n", " 19 Season 443 non-null str \n", " 20 Removable insole 443 non-null int64 \n", " 21 pace_daily_running 443 non-null int64 \n", " 22 pace_tempo 443 non-null int64 \n", " 23 pace_competition 443 non-null int64 \n", " 24 arch_neutral 443 non-null int64 \n", " 25 arch_stability 443 non-null int64 \n", " 26 weight_lab_oz 443 non-null float64\n", " 27 weight_lab_g 443 non-null int64 \n", " 28 weight_brand_oz 436 non-null float64\n", " 29 weight_brand_g 436 non-null float64\n", " 30 drop_lab_mm 443 non-null float64\n", " 31 drop_brand_mm 427 non-null float64\n", "dtypes: float64(5), int64(10), str(17)\n", "memory usage: 110.9 KB\n" ] } ], "source": [ "df.drop(columns=[\"Drop lab Drop brand\"], inplace=True)\n", "df.info()" ] }, { "cell_type": "markdown", "id": "27e914f9", "metadata": {}, "source": [ "# Strike pattern" ] }, { "cell_type": "code", "execution_count": 118, "id": "9c7f0a53", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Strike pattern\n", "HeelMid/forefoot 170\n", "Mid/forefoot 145\n", "Heel 126\n", "- 1\n", "Heel Mid/forefoot 1\n", "Name: count, dtype: int64\n" ] } ], "source": [ "print(df[\"Strike pattern\"].value_counts())" ] }, { "cell_type": "code", "execution_count": 119, "id": "0cbe3f37", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Rows: 443\n", "\n", "Unique Values in original column:\n", "\n", "['heelmid/forefoot', 'mid/forefoot', 'heel', '-', 'heel mid/forefoot']\n", "Length: 5, dtype: str\n", "\n", "Sample Comparison (Multi-label Mapping):\n", " Strike pattern strike_heel strike_mid strike_forefoot\n", "0 heelmid/forefoot 1 1 1\n", "1 mid/forefoot 0 1 1\n", "2 heelmid/forefoot 1 1 1\n", "3 heel 1 0 0\n", "4 heelmid/forefoot 1 1 1\n", "5 heel 1 0 0\n", "6 heelmid/forefoot 1 1 1\n", "7 heelmid/forefoot 1 1 1\n", "8 heelmid/forefoot 1 1 1\n", "9 heel 1 0 0\n" ] } ], "source": [ "df['Strike pattern'] = df['Strike pattern'].astype(str).str.lower()\n", "base_strikes = ['heel', 'mid', 'forefoot']\n", "\n", "for strike in base_strikes:\n", " column_name = f\"strike_{strike}\"\n", " \n", " df[column_name] = df['Strike pattern'].str.contains(strike, na=False).astype(int)\n", "\n", "print(\"Rows:\", len(df))\n", "\n", "print(\"\\nUnique Values in original column:\")\n", "print(df[\"Strike pattern\"].unique())\n", "\n", "print(\"\\nSample Comparison (Multi-label Mapping):\")\n", "strike_cols = [f\"strike_{s}\" for s in base_strikes]\n", "print(df[[\"Strike pattern\"] + strike_cols].head(10))" ] }, { "cell_type": "code", "execution_count": 120, "id": "4d1f9abc", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Strike pattern\n", "heelmid/forefoot 170\n", "mid/forefoot 145\n", "heel 126\n", "- 1\n", "heel mid/forefoot 1\n", "Name: count, dtype: int64\n", "\n", "strike_heel sum: 297\n", "strike_mid sum: 316\n", "strike_forefoot sum: 316\n", "\n", " Strike pattern strike_heel strike_mid strike_forefoot\n", "0 heelmid/forefoot 1 1 1\n", "1 mid/forefoot 0 1 1\n", "2 heelmid/forefoot 1 1 1\n", "3 heel 1 0 0\n", "4 heelmid/forefoot 1 1 1\n" ] } ], "source": [ "print(df[\"Strike pattern\"].value_counts())\n", "\n", "print()\n", "for strike in base_strikes:\n", " col = f\"strike_{strike}\"\n", " print(f\"{col} sum:\", int(df[col].sum()))\n", "\n", "print()\n", "print(df[[\"Strike pattern\"] + strike_cols].head())" ] }, { "cell_type": "code", "execution_count": 121, "id": "23d3f758", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 443 entries, 0 to 442\n", "Data columns (total 34 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 Brand 443 non-null str \n", " 1 Name 443 non-null str \n", " 2 Lightweight 443 non-null int64 \n", " 3 Midsole softness 443 non-null str \n", " 4 Toebox durability 443 non-null str \n", " 5 Heel padding durability 443 non-null str \n", " 6 Outsole durability 443 non-null str \n", " 7 Breathability 443 non-null str \n", " 8 Width / fit 443 non-null str \n", " 9 Toebox width 443 non-null str \n", " 10 Stiffness 443 non-null str \n", " 11 Torsional rigidity 443 non-null str \n", " 12 Heel counter stiffness 443 non-null str \n", " 13 Plate 443 non-null str \n", " 14 Rocker 443 non-null int64 \n", " 15 Heel lab Heel brand 443 non-null str \n", " 16 Forefoot lab Forefoot brand 443 non-null str \n", " 17 Orthotic friendly 443 non-null int64 \n", " 18 Season 443 non-null str \n", " 19 Removable insole 443 non-null int64 \n", " 20 pace_daily_running 443 non-null int64 \n", " 21 pace_tempo 443 non-null int64 \n", " 22 pace_competition 443 non-null int64 \n", " 23 arch_neutral 443 non-null int64 \n", " 24 arch_stability 443 non-null int64 \n", " 25 weight_lab_oz 443 non-null float64\n", " 26 weight_lab_g 443 non-null int64 \n", " 27 weight_brand_oz 436 non-null float64\n", " 28 weight_brand_g 436 non-null float64\n", " 29 drop_lab_mm 443 non-null float64\n", " 30 drop_brand_mm 427 non-null float64\n", " 31 strike_heel 443 non-null int64 \n", " 32 strike_mid 443 non-null int64 \n", " 33 strike_forefoot 443 non-null int64 \n", "dtypes: float64(5), int64(13), str(16)\n", "memory usage: 117.8 KB\n" ] } ], "source": [ "df.drop(columns=['Strike pattern'], inplace=True)\n", "df.info()" ] }, { "cell_type": "markdown", "id": "9ecfcdc8", "metadata": {}, "source": [ "# Midsole softness" ] }, { "cell_type": "code", "execution_count": 122, "id": "4d7135ac", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Midsole softness\n", "Soft 186\n", "Balanced 178\n", "- 61\n", "Firm 18\n", "Name: count, dtype: int64\n" ] } ], "source": [ "print(df[\"Midsole softness\"].value_counts())" ] }, { "cell_type": "code", "execution_count": 123, "id": "ab6386cd", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Rows: 443\n", "Baris dengan semua OHE 0 (termasuk '-'): 61\n", "\n", "Sample Comparison:\n", " Midsole softness softness_soft softness_balanced softness_firm\n", "0 balanced 0 1 0\n", "1 soft 1 0 0\n", "2 firm 0 0 1\n", "3 firm 0 0 1\n", "4 firm 0 0 1\n", "5 firm 0 0 1\n", "6 balanced 0 1 0\n", "7 balanced 0 1 0\n", "8 balanced 0 1 0\n", "9 soft 1 0 0\n" ] } ], "source": [ "df['Midsole softness'] = df['Midsole softness'].astype(str).str.lower()\n", "base_softness = ['soft', 'balanced', 'firm']\n", "\n", "\n", "for level in base_softness:\n", " column_name = f\"softness_{level}\"\n", " df[column_name] = df['Midsole softness'].str.contains(level, na=False).astype(int)\n", "\n", "print(\"Rows:\", len(df))\n", "\n", "softness_cols = [f\"softness_{l}\" for l in base_softness]\n", "zero_vector_count = (df[softness_cols].sum(axis=1) == 0).sum()\n", "print(f\"Baris dengan semua OHE 0 (termasuk '-'): {zero_vector_count}\")\n", "\n", "print(\"\\nSample Comparison:\")\n", "print(df[[\"Midsole softness\"] + softness_cols].head(10))" ] }, { "cell_type": "code", "execution_count": 124, "id": "ff9581a8", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Midsole softness\n", "soft 186\n", "balanced 178\n", "- 61\n", "firm 18\n", "Name: count, dtype: int64\n", "\n", "softness_soft sum: 186\n", "softness_balanced sum: 178\n", "softness_firm sum: 18\n", "\n", " Midsole softness softness_soft softness_balanced softness_firm\n", "0 balanced 0 1 0\n", "1 soft 1 0 0\n", "2 firm 0 0 1\n", "3 firm 0 0 1\n", "4 firm 0 0 1\n" ] } ], "source": [ "print(df[\"Midsole softness\"].value_counts())\n", "\n", "print()\n", "for level in base_softness:\n", " col = f\"softness_{level}\"\n", " print(f\"{col} sum:\", int(df[col].sum()))\n", "\n", "print()\n", "print(df[[\"Midsole softness\"] + softness_cols].head())" ] }, { "cell_type": "code", "execution_count": 125, "id": "533e3bd4", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 443 entries, 0 to 442\n", "Data columns (total 36 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 Brand 443 non-null str \n", " 1 Name 443 non-null str \n", " 2 Lightweight 443 non-null int64 \n", " 3 Toebox durability 443 non-null str \n", " 4 Heel padding durability 443 non-null str \n", " 5 Outsole durability 443 non-null str \n", " 6 Breathability 443 non-null str \n", " 7 Width / fit 443 non-null str \n", " 8 Toebox width 443 non-null str \n", " 9 Stiffness 443 non-null str \n", " 10 Torsional rigidity 443 non-null str \n", " 11 Heel counter stiffness 443 non-null str \n", " 12 Plate 443 non-null str \n", " 13 Rocker 443 non-null int64 \n", " 14 Heel lab Heel brand 443 non-null str \n", " 15 Forefoot lab Forefoot brand 443 non-null str \n", " 16 Orthotic friendly 443 non-null int64 \n", " 17 Season 443 non-null str \n", " 18 Removable insole 443 non-null int64 \n", " 19 pace_daily_running 443 non-null int64 \n", " 20 pace_tempo 443 non-null int64 \n", " 21 pace_competition 443 non-null int64 \n", " 22 arch_neutral 443 non-null int64 \n", " 23 arch_stability 443 non-null int64 \n", " 24 weight_lab_oz 443 non-null float64\n", " 25 weight_lab_g 443 non-null int64 \n", " 26 weight_brand_oz 436 non-null float64\n", " 27 weight_brand_g 436 non-null float64\n", " 28 drop_lab_mm 443 non-null float64\n", " 29 drop_brand_mm 427 non-null float64\n", " 30 strike_heel 443 non-null int64 \n", " 31 strike_mid 443 non-null int64 \n", " 32 strike_forefoot 443 non-null int64 \n", " 33 softness_soft 443 non-null int64 \n", " 34 softness_balanced 443 non-null int64 \n", " 35 softness_firm 443 non-null int64 \n", "dtypes: float64(5), int64(16), str(15)\n", "memory usage: 124.7 KB\n" ] } ], "source": [ "df.drop(columns=[\"Midsole softness\"], inplace=True)\n", "df.info()" ] }, { "cell_type": "markdown", "id": "7c9c8eb5", "metadata": {}, "source": [ "# Toebox durability" ] }, { "cell_type": "code", "execution_count": 126, "id": "6ae9914b", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Toebox durability\n", "Decent 160\n", "- 117\n", "Bad 92\n", "Good 74\n", "Name: count, dtype: int64\n" ] } ], "source": [ "print(df['Toebox durability'].value_counts())" ] }, { "cell_type": "code", "execution_count": 127, "id": "33d497cf", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Rows: 443\n", "\n", "Unique Values mapping check:\n", "'-' di-encode menjadi 0 (Total: 117)\n", "'very bad' di-encode menjadi 1 (Total: 0)\n", "'bad' di-encode menjadi 2 (Total: 92)\n", "'decent' di-encode menjadi 3 (Total: 160)\n", "'good' di-encode menjadi 4 (Total: 74)\n", "'very good' di-encode menjadi 5 (Total: 0)\n", "\n", "Sample Data:\n", " Toebox durability toebox_durability\n", "0 - 0\n", "1 good 4\n", "2 - 0\n", "3 - 0\n", "4 good 4\n", "5 decent 3\n", "6 bad 2\n", "7 decent 3\n", "8 bad 2\n", "9 bad 2\n" ] } ], "source": [ "df['Toebox durability'] = df['Toebox durability'].astype(str).str.lower()\n", "\n", "durability_map = {\n", " \"-\": 0,\n", " \"very bad\": 1,\n", " \"bad\": 2,\n", " \"decent\": 3,\n", " \"good\": 4,\n", " \"very good\": 5\n", "}\n", "\n", "df['toebox_durability'] = df['Toebox durability'].map(durability_map)\n", "print(\"Rows:\", len(df))\n", "\n", "print(\"\\nUnique Values mapping check:\")\n", "for label, value in durability_map.items():\n", " count = (df['Toebox durability'] == label).sum()\n", " print(f\"'{label}' di-encode menjadi {value} (Total: {count})\")\n", "\n", "print(\"\\nSample Data:\")\n", "print(df[[\"Toebox durability\", \"toebox_durability\"]].head(10))" ] }, { "cell_type": "code", "execution_count": 128, "id": "5f3035fa", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 443 entries, 0 to 442\n", "Data columns (total 36 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 Brand 443 non-null str \n", " 1 Name 443 non-null str \n", " 2 Lightweight 443 non-null int64 \n", " 3 Heel padding durability 443 non-null str \n", " 4 Outsole durability 443 non-null str \n", " 5 Breathability 443 non-null str \n", " 6 Width / fit 443 non-null str \n", " 7 Toebox width 443 non-null str \n", " 8 Stiffness 443 non-null str \n", " 9 Torsional rigidity 443 non-null str \n", " 10 Heel counter stiffness 443 non-null str \n", " 11 Plate 443 non-null str \n", " 12 Rocker 443 non-null int64 \n", " 13 Heel lab Heel brand 443 non-null str \n", " 14 Forefoot lab Forefoot brand 443 non-null str \n", " 15 Orthotic friendly 443 non-null int64 \n", " 16 Season 443 non-null str \n", " 17 Removable insole 443 non-null int64 \n", " 18 pace_daily_running 443 non-null int64 \n", " 19 pace_tempo 443 non-null int64 \n", " 20 pace_competition 443 non-null int64 \n", " 21 arch_neutral 443 non-null int64 \n", " 22 arch_stability 443 non-null int64 \n", " 23 weight_lab_oz 443 non-null float64\n", " 24 weight_lab_g 443 non-null int64 \n", " 25 weight_brand_oz 436 non-null float64\n", " 26 weight_brand_g 436 non-null float64\n", " 27 drop_lab_mm 443 non-null float64\n", " 28 drop_brand_mm 427 non-null float64\n", " 29 strike_heel 443 non-null int64 \n", " 30 strike_mid 443 non-null int64 \n", " 31 strike_forefoot 443 non-null int64 \n", " 32 softness_soft 443 non-null int64 \n", " 33 softness_balanced 443 non-null int64 \n", " 34 softness_firm 443 non-null int64 \n", " 35 toebox_durability 443 non-null int64 \n", "dtypes: float64(5), int64(17), str(14)\n", "memory usage: 124.7 KB\n" ] } ], "source": [ "df.drop(columns=['Toebox durability'], inplace=True)\n", "df.info()" ] }, { "cell_type": "markdown", "id": "ee9f0f7f", "metadata": {}, "source": [ "# Heel padding durability" ] }, { "cell_type": "code", "execution_count": 129, "id": "d72aec13", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Heel padding durability\n", "Good 187\n", "- 122\n", "Decent 79\n", "Bad 55\n", "Name: count, dtype: int64\n" ] } ], "source": [ "print(df[\"Heel padding durability\"].value_counts())" ] }, { "cell_type": "code", "execution_count": 130, "id": "85e10770", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "--- Value Counts Kolom Asli ---\n", "Heel padding durability\n", "good 187\n", "- 122\n", "decent 79\n", "bad 55\n", "Name: count, dtype: int64\n", "\n", "--- Sebaran Nilai Hasil Ordinal (Scale 1-5) ---\n", "Index 0: 122 baris\n", "Index 1: 0 baris\n", "Index 2: 55 baris\n", "Index 3: 79 baris\n", "Index 4: 187 baris\n", "Index 5: 0 baris\n", "\n", "--- Perbandingan Data (Head) ---\n", " Heel padding durability heel_durability\n", "0 - 0\n", "1 good 4\n", "2 good 4\n", "3 - 0\n", "4 good 4\n" ] } ], "source": [ "df['Heel padding durability'] = df['Heel padding durability'].astype(str).str.lower()\n", "\n", "durability_scale_5 = {\n", " \"-\": 0,\n", " \"very bad\": 1,\n", " \"bad\": 2,\n", " \"decent\": 3,\n", " \"good\": 4,\n", " \"very good\": 5\n", "}\n", "\n", "\n", "df['heel_durability'] = df['Heel padding durability'].map(durability_scale_5)\n", "\n", "\n", "print(\"--- Value Counts Kolom Asli ---\")\n", "print(df[\"Heel padding durability\"].value_counts())\n", "\n", "print(\"\\n--- Sebaran Nilai Hasil Ordinal (Scale 1-5) ---\")\n", "counts = df[\"heel_durability\"].value_counts().sort_index()\n", "for i in range(6):\n", " print(f\"Index {i}: {counts.get(i, 0)} baris\")\n", "\n", "print(\"\\n--- Perbandingan Data (Head) ---\")\n", "print(df[[\"Heel padding durability\", \"heel_durability\"]].head())\n", "\n", "# rename \"heel_durability_index\" to \"heel_durability\"\n", "# df.rename(columns={'heel_durability_index': 'heel_durability'}, inplace=True)" ] }, { "cell_type": "code", "execution_count": 131, "id": "37aa1023", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 443 entries, 0 to 442\n", "Data columns (total 36 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 Brand 443 non-null str \n", " 1 Name 443 non-null str \n", " 2 Lightweight 443 non-null int64 \n", " 3 Outsole durability 443 non-null str \n", " 4 Breathability 443 non-null str \n", " 5 Width / fit 443 non-null str \n", " 6 Toebox width 443 non-null str \n", " 7 Stiffness 443 non-null str \n", " 8 Torsional rigidity 443 non-null str \n", " 9 Heel counter stiffness 443 non-null str \n", " 10 Plate 443 non-null str \n", " 11 Rocker 443 non-null int64 \n", " 12 Heel lab Heel brand 443 non-null str \n", " 13 Forefoot lab Forefoot brand 443 non-null str \n", " 14 Orthotic friendly 443 non-null int64 \n", " 15 Season 443 non-null str \n", " 16 Removable insole 443 non-null int64 \n", " 17 pace_daily_running 443 non-null int64 \n", " 18 pace_tempo 443 non-null int64 \n", " 19 pace_competition 443 non-null int64 \n", " 20 arch_neutral 443 non-null int64 \n", " 21 arch_stability 443 non-null int64 \n", " 22 weight_lab_oz 443 non-null float64\n", " 23 weight_lab_g 443 non-null int64 \n", " 24 weight_brand_oz 436 non-null float64\n", " 25 weight_brand_g 436 non-null float64\n", " 26 drop_lab_mm 443 non-null float64\n", " 27 drop_brand_mm 427 non-null float64\n", " 28 strike_heel 443 non-null int64 \n", " 29 strike_mid 443 non-null int64 \n", " 30 strike_forefoot 443 non-null int64 \n", " 31 softness_soft 443 non-null int64 \n", " 32 softness_balanced 443 non-null int64 \n", " 33 softness_firm 443 non-null int64 \n", " 34 toebox_durability 443 non-null int64 \n", " 35 heel_durability 443 non-null int64 \n", "dtypes: float64(5), int64(18), str(13)\n", "memory usage: 124.7 KB\n" ] } ], "source": [ "df.drop('Heel padding durability', axis=1, inplace=True)\n", "df.info()" ] }, { "cell_type": "markdown", "id": "31816ac8", "metadata": {}, "source": [ "# Outsole durability" ] }, { "cell_type": "code", "execution_count": 132, "id": "d5f018a9", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Outsole durability\n", "Good 216\n", "- 134\n", "Decent 71\n", "Bad 22\n", "Name: count, dtype: int64\n" ] } ], "source": [ "print(df[\"Outsole durability\"].value_counts())" ] }, { "cell_type": "code", "execution_count": 133, "id": "fc4e697f", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "--- Value Counts Kolom Asli ---\n", "Outsole durability\n", "good 216\n", "- 134\n", "decent 71\n", "bad 22\n", "Name: count, dtype: int64\n", "\n", "--- Sebaran Nilai Hasil Ordinal (Scale 1-5) ---\n", "Index 0: 134 baris\n", "Index 1: 0 baris\n", "Index 2: 22 baris\n", "Index 3: 71 baris\n", "Index 4: 216 baris\n", "Index 5: 0 baris\n", "\n", "--- Perbandingan Data (Head) ---\n", " Outsole durability outsole_durability\n", "0 - 0\n", "1 good 4\n", "2 - 0\n", "3 - 0\n", "4 good 4\n" ] } ], "source": [ "df['Outsole durability'] = df['Outsole durability'].astype(str).str.lower()\n", "\n", "durability_scale_5 = {\n", " \"-\": 0,\n", " \"very bad\": 1,\n", " \"bad\": 2,\n", " \"decent\": 3,\n", " \"good\": 4,\n", " \"very good\": 5\n", "}\n", "\n", "\n", "df['outsole_durability'] = df['Outsole durability'].map(durability_scale_5)\n", "print(\"--- Value Counts Kolom Asli ---\")\n", "print(df[\"Outsole durability\"].value_counts())\n", "\n", "print(\"\\n--- Sebaran Nilai Hasil Ordinal (Scale 1-5) ---\")\n", "counts = df[\"outsole_durability\"].value_counts().sort_index()\n", "for i in range(6):\n", " print(f\"Index {i}: {counts.get(i, 0)} baris\")\n", "\n", "print(\"\\n--- Perbandingan Data (Head) ---\")\n", "print(df[[\"Outsole durability\", \"outsole_durability\"]].head())" ] }, { "cell_type": "code", "execution_count": 134, "id": "8689107f", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 443 entries, 0 to 442\n", "Data columns (total 36 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 Brand 443 non-null str \n", " 1 Name 443 non-null str \n", " 2 Lightweight 443 non-null int64 \n", " 3 Breathability 443 non-null str \n", " 4 Width / fit 443 non-null str \n", " 5 Toebox width 443 non-null str \n", " 6 Stiffness 443 non-null str \n", " 7 Torsional rigidity 443 non-null str \n", " 8 Heel counter stiffness 443 non-null str \n", " 9 Plate 443 non-null str \n", " 10 Rocker 443 non-null int64 \n", " 11 Heel lab Heel brand 443 non-null str \n", " 12 Forefoot lab Forefoot brand 443 non-null str \n", " 13 Orthotic friendly 443 non-null int64 \n", " 14 Season 443 non-null str \n", " 15 Removable insole 443 non-null int64 \n", " 16 pace_daily_running 443 non-null int64 \n", " 17 pace_tempo 443 non-null int64 \n", " 18 pace_competition 443 non-null int64 \n", " 19 arch_neutral 443 non-null int64 \n", " 20 arch_stability 443 non-null int64 \n", " 21 weight_lab_oz 443 non-null float64\n", " 22 weight_lab_g 443 non-null int64 \n", " 23 weight_brand_oz 436 non-null float64\n", " 24 weight_brand_g 436 non-null float64\n", " 25 drop_lab_mm 443 non-null float64\n", " 26 drop_brand_mm 427 non-null float64\n", " 27 strike_heel 443 non-null int64 \n", " 28 strike_mid 443 non-null int64 \n", " 29 strike_forefoot 443 non-null int64 \n", " 30 softness_soft 443 non-null int64 \n", " 31 softness_balanced 443 non-null int64 \n", " 32 softness_firm 443 non-null int64 \n", " 33 toebox_durability 443 non-null int64 \n", " 34 heel_durability 443 non-null int64 \n", " 35 outsole_durability 443 non-null int64 \n", "dtypes: float64(5), int64(19), str(12)\n", "memory usage: 124.7 KB\n" ] } ], "source": [ "df.drop('Outsole durability', axis=1, inplace=True)\n", "df.info()" ] }, { "cell_type": "markdown", "id": "eff75f94", "metadata": {}, "source": [ "# Breathability" ] }, { "cell_type": "code", "execution_count": 135, "id": "8a3a5fcf", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Breathability\n", "Moderate 219\n", "Breathable 113\n", "- 58\n", "Warm 53\n", "Name: count, dtype: int64\n" ] } ], "source": [ "print(df[\"Breathability\"].value_counts())" ] }, { "cell_type": "code", "execution_count": 136, "id": "824952c8", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "--- Value Counts Kolom Asli ---\n", "Breathability\n", "moderate 219\n", "breathable 113\n", "- 58\n", "warm 53\n", "Name: count, dtype: int64\n", "\n", "--- Sebaran Nilai Hasil Ordinal (Scale 1-5) ---\n", "Index 0: 58 baris\n", "Index 1: 0 baris\n", "Index 2: 53 baris\n", "Index 3: 219 baris\n", "Index 4: 0 baris\n", "Index 5: 113 baris\n", "\n", "--- Perbandingan Data (Head) ---\n", " Breathability breathability\n", "0 - 0\n", "1 breathable 5\n", "2 warm 2\n", "3 warm 2\n", "4 warm 2\n" ] } ], "source": [ "df['Breathability'] = df['Breathability'].astype(str).str.lower()\n", "\n", "breathability_scale_5 = {\n", " \"-\": 0,\n", " \"suffocating\": 1,\n", " \"warm\": 2,\n", " \"moderate\": 3,\n", " \"good\": 4,\n", " \"breathable\": 5\n", "}\n", "\n", "df['breathability'] = df['Breathability'].map(breathability_scale_5)\n", "\n", "print(\"--- Value Counts Kolom Asli ---\")\n", "print(df[\"Breathability\"].value_counts())\n", "\n", "print(\"\\n--- Sebaran Nilai Hasil Ordinal (Scale 1-5) ---\")\n", "counts = df[\"breathability\"].value_counts().sort_index()\n", "for i in range(6):\n", " print(f\"Index {i}: {counts.get(i, 0)} baris\")\n", "\n", "print(\"\\n--- Perbandingan Data (Head) ---\")\n", "print(df[[\"Breathability\", \"breathability\"]].head())" ] }, { "cell_type": "code", "execution_count": 137, "id": "6cafeb1e", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 443 entries, 0 to 442\n", "Data columns (total 36 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 Brand 443 non-null str \n", " 1 Name 443 non-null str \n", " 2 Lightweight 443 non-null int64 \n", " 3 Width / fit 443 non-null str \n", " 4 Toebox width 443 non-null str \n", " 5 Stiffness 443 non-null str \n", " 6 Torsional rigidity 443 non-null str \n", " 7 Heel counter stiffness 443 non-null str \n", " 8 Plate 443 non-null str \n", " 9 Rocker 443 non-null int64 \n", " 10 Heel lab Heel brand 443 non-null str \n", " 11 Forefoot lab Forefoot brand 443 non-null str \n", " 12 Orthotic friendly 443 non-null int64 \n", " 13 Season 443 non-null str \n", " 14 Removable insole 443 non-null int64 \n", " 15 pace_daily_running 443 non-null int64 \n", " 16 pace_tempo 443 non-null int64 \n", " 17 pace_competition 443 non-null int64 \n", " 18 arch_neutral 443 non-null int64 \n", " 19 arch_stability 443 non-null int64 \n", " 20 weight_lab_oz 443 non-null float64\n", " 21 weight_lab_g 443 non-null int64 \n", " 22 weight_brand_oz 436 non-null float64\n", " 23 weight_brand_g 436 non-null float64\n", " 24 drop_lab_mm 443 non-null float64\n", " 25 drop_brand_mm 427 non-null float64\n", " 26 strike_heel 443 non-null int64 \n", " 27 strike_mid 443 non-null int64 \n", " 28 strike_forefoot 443 non-null int64 \n", " 29 softness_soft 443 non-null int64 \n", " 30 softness_balanced 443 non-null int64 \n", " 31 softness_firm 443 non-null int64 \n", " 32 toebox_durability 443 non-null int64 \n", " 33 heel_durability 443 non-null int64 \n", " 34 outsole_durability 443 non-null int64 \n", " 35 breathability 443 non-null int64 \n", "dtypes: float64(5), int64(20), str(11)\n", "memory usage: 124.7 KB\n" ] } ], "source": [ "df.drop('Breathability', axis=1, inplace=True)\n", "df.info()" ] }, { "cell_type": "markdown", "id": "f014a368", "metadata": {}, "source": [ "# Width / fit" ] }, { "cell_type": "code", "execution_count": 138, "id": "d5aa68e8", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Width / fit\n", "Medium 268\n", "Narrow 142\n", "Wide 33\n", "Name: count, dtype: int64\n" ] } ], "source": [ "print(df['Width / fit'].value_counts())" ] }, { "cell_type": "code", "execution_count": 139, "id": "f37f93b0", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Rows: 443\n", "NULL Value: 0\n", "\n", "Sample Comparison:\n", " Width / fit width_narrow width_medium width_wide\n", "0 narrow 1 0 0\n", "1 narrow 1 0 0\n", "2 narrow 1 0 0\n", "3 narrow 1 0 0\n", "4 narrow 1 0 0\n", "5 medium 0 1 0\n", "6 wide 0 0 1\n", "7 narrow 1 0 0\n", "8 narrow 1 0 0\n", "9 medium 0 1 0\n" ] } ], "source": [ "df['Width / fit'] = df['Width / fit'].astype(str).str.lower()\n", "base_widths = ['narrow', 'medium', 'wide']\n", "\n", "for level in base_widths:\n", " column_name = f\"width_{level}\"\n", " df[column_name] = df['Width / fit'].str.contains(level, na=False).astype(int)\n", "\n", "print(\"Rows:\", len(df))\n", "\n", "width_cols = [f\"width_{l}\" for l in base_widths]\n", "zero_vector_count = (df[width_cols].sum(axis=1) == 0).sum()\n", "print(f\"NULL Value: {zero_vector_count}\")\n", "\n", "print(\"\\nSample Comparison:\")\n", "print(df[[\"Width / fit\"] + width_cols].head(10))" ] }, { "cell_type": "code", "execution_count": 140, "id": "3a7e364b", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Width / fit\n", "medium 268\n", "narrow 142\n", "wide 33\n", "Name: count, dtype: int64\n", "\n", "width_narrow sum: 142\n", "width_medium sum: 268\n", "width_wide sum: 33\n", "\n", " Width / fit width_narrow width_medium width_wide\n", "0 narrow 1 0 0\n", "1 narrow 1 0 0\n", "2 narrow 1 0 0\n", "3 narrow 1 0 0\n", "4 narrow 1 0 0\n" ] } ], "source": [ "print(df[\"Width / fit\"].value_counts())\n", "\n", "print()\n", "for level in base_widths:\n", " col = f\"width_{level}\"\n", " print(f\"{col} sum:\", int(df[col].sum()))\n", "\n", "print()\n", "print(df[[\"Width / fit\"] + width_cols].head())" ] }, { "cell_type": "code", "execution_count": 141, "id": "71ab506a", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 443 entries, 0 to 442\n", "Data columns (total 38 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 Brand 443 non-null str \n", " 1 Name 443 non-null str \n", " 2 Lightweight 443 non-null int64 \n", " 3 Toebox width 443 non-null str \n", " 4 Stiffness 443 non-null str \n", " 5 Torsional rigidity 443 non-null str \n", " 6 Heel counter stiffness 443 non-null str \n", " 7 Plate 443 non-null str \n", " 8 Rocker 443 non-null int64 \n", " 9 Heel lab Heel brand 443 non-null str \n", " 10 Forefoot lab Forefoot brand 443 non-null str \n", " 11 Orthotic friendly 443 non-null int64 \n", " 12 Season 443 non-null str \n", " 13 Removable insole 443 non-null int64 \n", " 14 pace_daily_running 443 non-null int64 \n", " 15 pace_tempo 443 non-null int64 \n", " 16 pace_competition 443 non-null int64 \n", " 17 arch_neutral 443 non-null int64 \n", " 18 arch_stability 443 non-null int64 \n", " 19 weight_lab_oz 443 non-null float64\n", " 20 weight_lab_g 443 non-null int64 \n", " 21 weight_brand_oz 436 non-null float64\n", " 22 weight_brand_g 436 non-null float64\n", " 23 drop_lab_mm 443 non-null float64\n", " 24 drop_brand_mm 427 non-null float64\n", " 25 strike_heel 443 non-null int64 \n", " 26 strike_mid 443 non-null int64 \n", " 27 strike_forefoot 443 non-null int64 \n", " 28 softness_soft 443 non-null int64 \n", " 29 softness_balanced 443 non-null int64 \n", " 30 softness_firm 443 non-null int64 \n", " 31 toebox_durability 443 non-null int64 \n", " 32 heel_durability 443 non-null int64 \n", " 33 outsole_durability 443 non-null int64 \n", " 34 breathability 443 non-null int64 \n", " 35 width_narrow 443 non-null int64 \n", " 36 width_medium 443 non-null int64 \n", " 37 width_wide 443 non-null int64 \n", "dtypes: float64(5), int64(23), str(10)\n", "memory usage: 131.6 KB\n" ] } ], "source": [ "df.drop(columns=[\"Width / fit\"], inplace=True)\n", "df.info()" ] }, { "cell_type": "markdown", "id": "95a77d7e", "metadata": {}, "source": [ "# Toebox width" ] }, { "cell_type": "code", "execution_count": 142, "id": "d735ec32", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Toebox width\n", "Medium 215\n", "- 108\n", "Wide 63\n", "Narrow 57\n", "Name: count, dtype: int64\n" ] } ], "source": [ "print(df['Toebox width'].value_counts())" ] }, { "cell_type": "code", "execution_count": 143, "id": "e6261b61", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Rows: 443\n", "NULL Value: 108\n", "\n", "Sample Comparison:\n", " Toebox width toebox_narrow toebox_medium toebox_wide\n", "0 - 0 0 0\n", "1 medium 0 1 0\n", "2 - 0 0 0\n", "3 - 0 0 0\n", "4 medium 0 1 0\n", "5 medium 0 1 0\n", "6 medium 0 1 0\n", "7 medium 0 1 0\n", "8 wide 0 0 1\n", "9 medium 0 1 0\n" ] } ], "source": [ "df['Toebox width'] = df['Toebox width'].astype(str).str.lower()\n", "base_toebox = ['narrow', 'medium', 'wide']\n", "\n", "for level in base_toebox:\n", " column_name = f\"toebox_{level}\"\n", " df[column_name] = df['Toebox width'].str.contains(level, na=False).astype(int)\n", "\n", "print(\"Rows:\", len(df))\n", "\n", "toebox_cols = [f\"toebox_{l}\" for l in base_toebox]\n", "zero_vector_count = (df[toebox_cols].sum(axis=1) == 0).sum()\n", "print(f\"NULL Value: {zero_vector_count}\")\n", "\n", "print(\"\\nSample Comparison:\")\n", "print(df[[\"Toebox width\"] + toebox_cols].head(10))" ] }, { "cell_type": "code", "execution_count": 144, "id": "2efd1f7f", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Toebox width\n", "medium 215\n", "- 108\n", "wide 63\n", "narrow 57\n", "Name: count, dtype: int64\n", "\n", "toebox_narrow sum: 57\n", "toebox_medium sum: 215\n", "toebox_wide sum: 63\n", "\n", " Toebox width toebox_narrow toebox_medium toebox_wide\n", "0 - 0 0 0\n", "1 medium 0 1 0\n", "2 - 0 0 0\n", "3 - 0 0 0\n", "4 medium 0 1 0\n" ] } ], "source": [ "print(df[\"Toebox width\"].value_counts())\n", "\n", "print()\n", "for level in base_toebox:\n", " col = f\"toebox_{level}\"\n", " print(f\"{col} sum:\", int(df[col].sum()))\n", "\n", "print()\n", "print(df[[\"Toebox width\"] + toebox_cols].head())" ] }, { "cell_type": "code", "execution_count": 145, "id": "fa22730e", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 443 entries, 0 to 442\n", "Data columns (total 40 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 Brand 443 non-null str \n", " 1 Name 443 non-null str \n", " 2 Lightweight 443 non-null int64 \n", " 3 Stiffness 443 non-null str \n", " 4 Torsional rigidity 443 non-null str \n", " 5 Heel counter stiffness 443 non-null str \n", " 6 Plate 443 non-null str \n", " 7 Rocker 443 non-null int64 \n", " 8 Heel lab Heel brand 443 non-null str \n", " 9 Forefoot lab Forefoot brand 443 non-null str \n", " 10 Orthotic friendly 443 non-null int64 \n", " 11 Season 443 non-null str \n", " 12 Removable insole 443 non-null int64 \n", " 13 pace_daily_running 443 non-null int64 \n", " 14 pace_tempo 443 non-null int64 \n", " 15 pace_competition 443 non-null int64 \n", " 16 arch_neutral 443 non-null int64 \n", " 17 arch_stability 443 non-null int64 \n", " 18 weight_lab_oz 443 non-null float64\n", " 19 weight_lab_g 443 non-null int64 \n", " 20 weight_brand_oz 436 non-null float64\n", " 21 weight_brand_g 436 non-null float64\n", " 22 drop_lab_mm 443 non-null float64\n", " 23 drop_brand_mm 427 non-null float64\n", " 24 strike_heel 443 non-null int64 \n", " 25 strike_mid 443 non-null int64 \n", " 26 strike_forefoot 443 non-null int64 \n", " 27 softness_soft 443 non-null int64 \n", " 28 softness_balanced 443 non-null int64 \n", " 29 softness_firm 443 non-null int64 \n", " 30 toebox_durability 443 non-null int64 \n", " 31 heel_durability 443 non-null int64 \n", " 32 outsole_durability 443 non-null int64 \n", " 33 breathability 443 non-null int64 \n", " 34 width_narrow 443 non-null int64 \n", " 35 width_medium 443 non-null int64 \n", " 36 width_wide 443 non-null int64 \n", " 37 toebox_narrow 443 non-null int64 \n", " 38 toebox_medium 443 non-null int64 \n", " 39 toebox_wide 443 non-null int64 \n", "dtypes: float64(5), int64(26), str(9)\n", "memory usage: 138.6 KB\n" ] } ], "source": [ "df.drop(columns=[\"Toebox width\"], inplace=True)\n", "df.info()" ] }, { "cell_type": "markdown", "id": "5ed6c9ff", "metadata": {}, "source": [ "# Stiffness" ] }, { "cell_type": "code", "execution_count": 146, "id": "79a1bd79", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Stiffness\n", "Stiff 225\n", "Moderate 167\n", "Flexible 38\n", "- 13\n", "Name: count, dtype: int64\n" ] } ], "source": [ "print(df['Stiffness'].value_counts())" ] }, { "cell_type": "code", "execution_count": 147, "id": "6bf18813", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Rows: 443\n", "NULL Value: 13\n", "\n", "Sample Comparison:\n", " Stiffness stiffness_flexible stiffness_moderate stiffness_stiff\n", "0 stiff 0 0 1\n", "1 stiff 0 0 1\n", "2 stiff 0 0 1\n", "3 stiff 0 0 1\n", "4 moderate 0 1 0\n", "5 stiff 0 0 1\n", "6 moderate 0 1 0\n", "7 stiff 0 0 1\n", "8 stiff 0 0 1\n", "9 moderate 0 1 0\n" ] } ], "source": [ "df['Stiffness'] = df['Stiffness'].astype(str).str.lower()\n", "base_stiffness = ['flexible', 'moderate', 'stiff']\n", "\n", "for level in base_stiffness:\n", " column_name = f\"stiffness_{level}\"\n", " df[column_name] = df['Stiffness'].str.contains(level, na=False).astype(int)\n", "\n", "print(\"Rows:\", len(df))\n", "\n", "stiffness_cols = [f\"stiffness_{l}\" for l in base_stiffness]\n", "zero_vector_count = (df[stiffness_cols].sum(axis=1) == 0).sum()\n", "print(f\"NULL Value: {zero_vector_count}\")\n", "\n", "print(\"\\nSample Comparison:\")\n", "print(df[[\"Stiffness\"] + stiffness_cols].head(10))" ] }, { "cell_type": "code", "execution_count": 148, "id": "89248623", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Stiffness\n", "stiff 225\n", "moderate 167\n", "flexible 38\n", "- 13\n", "Name: count, dtype: int64\n", "\n", "stiffness_flexible sum: 38\n", "stiffness_moderate sum: 167\n", "stiffness_stiff sum: 225\n", "\n", " Stiffness stiffness_flexible stiffness_moderate stiffness_stiff\n", "0 stiff 0 0 1\n", "1 stiff 0 0 1\n", "2 stiff 0 0 1\n", "3 stiff 0 0 1\n", "4 moderate 0 1 0\n" ] } ], "source": [ "print(df[\"Stiffness\"].value_counts())\n", "\n", "print()\n", "for level in base_stiffness:\n", " col = f\"stiffness_{level}\"\n", " print(f\"{col} sum:\", int(df[col].sum()))\n", "\n", "print()\n", "print(df[[\"Stiffness\"] + stiffness_cols].head())" ] }, { "cell_type": "code", "execution_count": 149, "id": "c9dfcb1b", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 443 entries, 0 to 442\n", "Data columns (total 42 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 Brand 443 non-null str \n", " 1 Name 443 non-null str \n", " 2 Lightweight 443 non-null int64 \n", " 3 Torsional rigidity 443 non-null str \n", " 4 Heel counter stiffness 443 non-null str \n", " 5 Plate 443 non-null str \n", " 6 Rocker 443 non-null int64 \n", " 7 Heel lab Heel brand 443 non-null str \n", " 8 Forefoot lab Forefoot brand 443 non-null str \n", " 9 Orthotic friendly 443 non-null int64 \n", " 10 Season 443 non-null str \n", " 11 Removable insole 443 non-null int64 \n", " 12 pace_daily_running 443 non-null int64 \n", " 13 pace_tempo 443 non-null int64 \n", " 14 pace_competition 443 non-null int64 \n", " 15 arch_neutral 443 non-null int64 \n", " 16 arch_stability 443 non-null int64 \n", " 17 weight_lab_oz 443 non-null float64\n", " 18 weight_lab_g 443 non-null int64 \n", " 19 weight_brand_oz 436 non-null float64\n", " 20 weight_brand_g 436 non-null float64\n", " 21 drop_lab_mm 443 non-null float64\n", " 22 drop_brand_mm 427 non-null float64\n", " 23 strike_heel 443 non-null int64 \n", " 24 strike_mid 443 non-null int64 \n", " 25 strike_forefoot 443 non-null int64 \n", " 26 softness_soft 443 non-null int64 \n", " 27 softness_balanced 443 non-null int64 \n", " 28 softness_firm 443 non-null int64 \n", " 29 toebox_durability 443 non-null int64 \n", " 30 heel_durability 443 non-null int64 \n", " 31 outsole_durability 443 non-null int64 \n", " 32 breathability 443 non-null int64 \n", " 33 width_narrow 443 non-null int64 \n", " 34 width_medium 443 non-null int64 \n", " 35 width_wide 443 non-null int64 \n", " 36 toebox_narrow 443 non-null int64 \n", " 37 toebox_medium 443 non-null int64 \n", " 38 toebox_wide 443 non-null int64 \n", " 39 stiffness_flexible 443 non-null int64 \n", " 40 stiffness_moderate 443 non-null int64 \n", " 41 stiffness_stiff 443 non-null int64 \n", "dtypes: float64(5), int64(29), str(8)\n", "memory usage: 145.5 KB\n" ] } ], "source": [ "df.drop(columns=[\"Stiffness\"], inplace=True)\n", "df.info()" ] }, { "cell_type": "markdown", "id": "0cd9df86", "metadata": {}, "source": [ "# Torsional rigidity" ] }, { "cell_type": "code", "execution_count": 150, "id": "10686d53", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Torsional rigidity\n", "Stiff 221\n", "Moderate 127\n", "Flexible 77\n", "- 18\n", "Name: count, dtype: int64\n" ] } ], "source": [ "print(df['Torsional rigidity'].value_counts())" ] }, { "cell_type": "code", "execution_count": 151, "id": "3300eac2", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Rows: 443\n", "NULL Value: 18\n", "\n", "Sample Comparison:\n", " Torsional rigidity torsional_flexible torsional_moderate torsional_stiff\n", "0 stiff 0 0 1\n", "1 moderate 0 1 0\n", "2 flexible 1 0 0\n", "3 flexible 1 0 0\n", "4 flexible 1 0 0\n", "5 stiff 0 0 1\n", "6 moderate 0 1 0\n", "7 stiff 0 0 1\n", "8 stiff 0 0 1\n", "9 stiff 0 0 1\n" ] } ], "source": [ "df['Torsional rigidity'] = df['Torsional rigidity'].astype(str).str.lower()\n", "base_torsional = ['flexible', 'moderate', 'stiff']\n", "\n", "for level in base_torsional:\n", " column_name = f\"torsional_{level}\"\n", " df[column_name] = df['Torsional rigidity'].str.contains(level, na=False).astype(int)\n", "\n", "print(\"Rows:\", len(df))\n", "\n", "torsional_cols = [f\"torsional_{l}\" for l in base_torsional]\n", "zero_vector_count = (df[torsional_cols].sum(axis=1) == 0).sum()\n", "print(f\"NULL Value: {zero_vector_count}\")\n", "\n", "print(\"\\nSample Comparison:\")\n", "print(df[[\"Torsional rigidity\"] + torsional_cols].head(10))" ] }, { "cell_type": "code", "execution_count": 152, "id": "aa13792d", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Torsional rigidity\n", "stiff 221\n", "moderate 127\n", "flexible 77\n", "- 18\n", "Name: count, dtype: int64\n", "\n", "torsional_flexible sum: 77\n", "torsional_moderate sum: 127\n", "torsional_stiff sum: 221\n", "\n", " Torsional rigidity torsional_flexible torsional_moderate torsional_stiff\n", "0 stiff 0 0 1\n", "1 moderate 0 1 0\n", "2 flexible 1 0 0\n", "3 flexible 1 0 0\n", "4 flexible 1 0 0\n" ] } ], "source": [ "print(df[\"Torsional rigidity\"].value_counts())\n", "\n", "print()\n", "for level in base_torsional:\n", " col = f\"torsional_{level}\"\n", " print(f\"{col} sum:\", int(df[col].sum()))\n", "\n", "print()\n", "print(df[[\"Torsional rigidity\"] + torsional_cols].head())" ] }, { "cell_type": "code", "execution_count": 153, "id": "1f249cb5", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 443 entries, 0 to 442\n", "Data columns (total 44 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 Brand 443 non-null str \n", " 1 Name 443 non-null str \n", " 2 Lightweight 443 non-null int64 \n", " 3 Heel counter stiffness 443 non-null str \n", " 4 Plate 443 non-null str \n", " 5 Rocker 443 non-null int64 \n", " 6 Heel lab Heel brand 443 non-null str \n", " 7 Forefoot lab Forefoot brand 443 non-null str \n", " 8 Orthotic friendly 443 non-null int64 \n", " 9 Season 443 non-null str \n", " 10 Removable insole 443 non-null int64 \n", " 11 pace_daily_running 443 non-null int64 \n", " 12 pace_tempo 443 non-null int64 \n", " 13 pace_competition 443 non-null int64 \n", " 14 arch_neutral 443 non-null int64 \n", " 15 arch_stability 443 non-null int64 \n", " 16 weight_lab_oz 443 non-null float64\n", " 17 weight_lab_g 443 non-null int64 \n", " 18 weight_brand_oz 436 non-null float64\n", " 19 weight_brand_g 436 non-null float64\n", " 20 drop_lab_mm 443 non-null float64\n", " 21 drop_brand_mm 427 non-null float64\n", " 22 strike_heel 443 non-null int64 \n", " 23 strike_mid 443 non-null int64 \n", " 24 strike_forefoot 443 non-null int64 \n", " 25 softness_soft 443 non-null int64 \n", " 26 softness_balanced 443 non-null int64 \n", " 27 softness_firm 443 non-null int64 \n", " 28 toebox_durability 443 non-null int64 \n", " 29 heel_durability 443 non-null int64 \n", " 30 outsole_durability 443 non-null int64 \n", " 31 breathability 443 non-null int64 \n", " 32 width_narrow 443 non-null int64 \n", " 33 width_medium 443 non-null int64 \n", " 34 width_wide 443 non-null int64 \n", " 35 toebox_narrow 443 non-null int64 \n", " 36 toebox_medium 443 non-null int64 \n", " 37 toebox_wide 443 non-null int64 \n", " 38 stiffness_flexible 443 non-null int64 \n", " 39 stiffness_moderate 443 non-null int64 \n", " 40 stiffness_stiff 443 non-null int64 \n", " 41 torsional_flexible 443 non-null int64 \n", " 42 torsional_moderate 443 non-null int64 \n", " 43 torsional_stiff 443 non-null int64 \n", "dtypes: float64(5), int64(32), str(7)\n", "memory usage: 152.4 KB\n" ] } ], "source": [ "df.drop(columns=[\"Torsional rigidity\"], inplace=True)\n", "df.info()" ] }, { "cell_type": "markdown", "id": "200b1b5e", "metadata": {}, "source": [ "# Heel counter stiffness" ] }, { "cell_type": "code", "execution_count": 154, "id": "e783ea7c", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Heel counter stiffness\n", "Moderate 150\n", "Flexible 138\n", "Stiff 126\n", "- 29\n", "Name: count, dtype: int64\n" ] } ], "source": [ "print(df['Heel counter stiffness'].value_counts())" ] }, { "cell_type": "code", "execution_count": 155, "id": "755bbf13", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Rows: 443\n", "NULL Value: 29\n", "\n", "Sample Comparison:\n", " Heel counter stiffness heel_stiff_flexible heel_stiff_moderate \\\n", "0 flexible 1 0 \n", "1 moderate 0 1 \n", "2 flexible 1 0 \n", "3 moderate 0 1 \n", "4 flexible 1 0 \n", "5 moderate 0 1 \n", "6 flexible 1 0 \n", "7 flexible 1 0 \n", "8 stiff 0 0 \n", "9 stiff 0 0 \n", "\n", " heel_stiff_stiff \n", "0 0 \n", "1 0 \n", "2 0 \n", "3 0 \n", "4 0 \n", "5 0 \n", "6 0 \n", "7 0 \n", "8 1 \n", "9 1 \n" ] } ], "source": [ "df['Heel counter stiffness'] = df['Heel counter stiffness'].astype(str).str.lower()\n", "base_heel_stiff = ['flexible', 'moderate', 'stiff']\n", "\n", "for level in base_heel_stiff:\n", " column_name = f\"heel_stiff_{level}\"\n", " df[column_name] = df['Heel counter stiffness'].str.contains(level, na=False).astype(int)\n", "\n", "print(\"Rows:\", len(df))\n", "\n", "heel_stiff_cols = [f\"heel_stiff_{l}\" for l in base_heel_stiff]\n", "zero_vector_count = (df[heel_stiff_cols].sum(axis=1) == 0).sum()\n", "print(f\"NULL Value: {zero_vector_count}\")\n", "\n", "print(\"\\nSample Comparison:\")\n", "print(df[[\"Heel counter stiffness\"] + heel_stiff_cols].head(10))" ] }, { "cell_type": "code", "execution_count": 156, "id": "5e1b18b1", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Heel counter stiffness\n", "moderate 150\n", "flexible 138\n", "stiff 126\n", "- 29\n", "Name: count, dtype: int64\n", "\n", "heel_stiff_flexible sum: 138\n", "heel_stiff_moderate sum: 150\n", "heel_stiff_stiff sum: 126\n", "\n", " Heel counter stiffness heel_stiff_flexible heel_stiff_moderate \\\n", "0 flexible 1 0 \n", "1 moderate 0 1 \n", "2 flexible 1 0 \n", "3 moderate 0 1 \n", "4 flexible 1 0 \n", "\n", " heel_stiff_stiff \n", "0 0 \n", "1 0 \n", "2 0 \n", "3 0 \n", "4 0 \n" ] } ], "source": [ "print(df[\"Heel counter stiffness\"].value_counts())\n", "\n", "print()\n", "for level in base_heel_stiff:\n", " col = f\"heel_stiff_{level}\"\n", " print(f\"{col} sum:\", int(df[col].sum()))\n", "\n", "print()\n", "print(df[[\"Heel counter stiffness\"] + heel_stiff_cols].head())" ] }, { "cell_type": "code", "execution_count": 157, "id": "8a249daf", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 443 entries, 0 to 442\n", "Data columns (total 46 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 Brand 443 non-null str \n", " 1 Name 443 non-null str \n", " 2 Lightweight 443 non-null int64 \n", " 3 Plate 443 non-null str \n", " 4 Rocker 443 non-null int64 \n", " 5 Heel lab Heel brand 443 non-null str \n", " 6 Forefoot lab Forefoot brand 443 non-null str \n", " 7 Orthotic friendly 443 non-null int64 \n", " 8 Season 443 non-null str \n", " 9 Removable insole 443 non-null int64 \n", " 10 pace_daily_running 443 non-null int64 \n", " 11 pace_tempo 443 non-null int64 \n", " 12 pace_competition 443 non-null int64 \n", " 13 arch_neutral 443 non-null int64 \n", " 14 arch_stability 443 non-null int64 \n", " 15 weight_lab_oz 443 non-null float64\n", " 16 weight_lab_g 443 non-null int64 \n", " 17 weight_brand_oz 436 non-null float64\n", " 18 weight_brand_g 436 non-null float64\n", " 19 drop_lab_mm 443 non-null float64\n", " 20 drop_brand_mm 427 non-null float64\n", " 21 strike_heel 443 non-null int64 \n", " 22 strike_mid 443 non-null int64 \n", " 23 strike_forefoot 443 non-null int64 \n", " 24 softness_soft 443 non-null int64 \n", " 25 softness_balanced 443 non-null int64 \n", " 26 softness_firm 443 non-null int64 \n", " 27 toebox_durability 443 non-null int64 \n", " 28 heel_durability 443 non-null int64 \n", " 29 outsole_durability 443 non-null int64 \n", " 30 breathability 443 non-null int64 \n", " 31 width_narrow 443 non-null int64 \n", " 32 width_medium 443 non-null int64 \n", " 33 width_wide 443 non-null int64 \n", " 34 toebox_narrow 443 non-null int64 \n", " 35 toebox_medium 443 non-null int64 \n", " 36 toebox_wide 443 non-null int64 \n", " 37 stiffness_flexible 443 non-null int64 \n", " 38 stiffness_moderate 443 non-null int64 \n", " 39 stiffness_stiff 443 non-null int64 \n", " 40 torsional_flexible 443 non-null int64 \n", " 41 torsional_moderate 443 non-null int64 \n", " 42 torsional_stiff 443 non-null int64 \n", " 43 heel_stiff_flexible 443 non-null int64 \n", " 44 heel_stiff_moderate 443 non-null int64 \n", " 45 heel_stiff_stiff 443 non-null int64 \n", "dtypes: float64(5), int64(35), str(6)\n", "memory usage: 159.3 KB\n" ] } ], "source": [ "df.drop(columns=[\"Heel counter stiffness\"], inplace=True)\n", "df.info()" ] }, { "cell_type": "markdown", "id": "7b144b6c", "metadata": {}, "source": [ "# Plate" ] }, { "cell_type": "code", "execution_count": 158, "id": "dcc5dba9", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Plate\n", "0 381\n", "Carbon plate 61\n", "Carbon plateRock plate 1\n", "Name: count, dtype: int64\n" ] } ], "source": [ "print(df[\"Plate\"].value_counts())" ] }, { "cell_type": "code", "execution_count": 159, "id": "7486d183", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Rows: 443\n", "NULL Value: 0\n", "\n", "Sample Comparison:\n", " Plate plate_0 plate_rock_plate plate_carbon_plate\n", "0 0 1 0 0\n", "1 0 1 0 0\n", "2 0 1 0 0\n", "3 0 1 0 0\n", "4 0 1 0 0\n", "5 0 1 0 0\n", "6 0 1 0 0\n", "7 0 1 0 0\n", "8 0 1 0 0\n", "9 0 1 0 0\n" ] } ], "source": [ "df['Plate'] = df['Plate'].astype(str).str.lower()\n", "base_plate = ['0', 'rock plate', 'carbon plate']\n", "\n", "for level in base_plate:\n", " column_name = f\"plate_{level.replace(' ', '_')}\"\n", " if level == '0':\n", " df[column_name] = (df['Plate'] == '0').astype(int)\n", " else:\n", " df[column_name] = df['Plate'].str.contains(level, na=False).astype(int)\n", "\n", "print(\"Rows:\", len(df))\n", "\n", "plate_cols = [f\"plate_{l.replace(' ', '_')}\" for l in base_plate]\n", "zero_vector_count = (df[plate_cols].sum(axis=1) == 0).sum()\n", "print(f\"NULL Value: {zero_vector_count}\")\n", "\n", "print(\"\\nSample Comparison:\")\n", "print(df[[\"Plate\"] + plate_cols].head(10))" ] }, { "cell_type": "code", "execution_count": 160, "id": "1cb4e776", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Plate\n", "0 381\n", "carbon plate 61\n", "carbon platerock plate 1\n", "Name: count, dtype: int64\n", "\n", "plate_0 sum: 381\n", "plate_rock_plate sum: 1\n", "plate_carbon_plate sum: 62\n", "\n", " Plate plate_0 plate_rock_plate plate_carbon_plate\n", "0 0 1 0 0\n", "1 0 1 0 0\n", "2 0 1 0 0\n", "3 0 1 0 0\n", "4 0 1 0 0\n" ] } ], "source": [ "print(df[\"Plate\"].value_counts())\n", "\n", "print()\n", "for level in base_plate:\n", " col = f\"plate_{level.replace(' ', '_')}\"\n", " print(f\"{col} sum:\", int(df[col].sum()))\n", "\n", "print()\n", "print(df[[\"Plate\"] + plate_cols].head())" ] }, { "cell_type": "code", "execution_count": 161, "id": "2664b9dc", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 443 entries, 0 to 442\n", "Data columns (total 48 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 Brand 443 non-null str \n", " 1 Name 443 non-null str \n", " 2 Lightweight 443 non-null int64 \n", " 3 Rocker 443 non-null int64 \n", " 4 Heel lab Heel brand 443 non-null str \n", " 5 Forefoot lab Forefoot brand 443 non-null str \n", " 6 Orthotic friendly 443 non-null int64 \n", " 7 Season 443 non-null str \n", " 8 Removable insole 443 non-null int64 \n", " 9 pace_daily_running 443 non-null int64 \n", " 10 pace_tempo 443 non-null int64 \n", " 11 pace_competition 443 non-null int64 \n", " 12 arch_neutral 443 non-null int64 \n", " 13 arch_stability 443 non-null int64 \n", " 14 weight_lab_oz 443 non-null float64\n", " 15 weight_lab_g 443 non-null int64 \n", " 16 weight_brand_oz 436 non-null float64\n", " 17 weight_brand_g 436 non-null float64\n", " 18 drop_lab_mm 443 non-null float64\n", " 19 drop_brand_mm 427 non-null float64\n", " 20 strike_heel 443 non-null int64 \n", " 21 strike_mid 443 non-null int64 \n", " 22 strike_forefoot 443 non-null int64 \n", " 23 softness_soft 443 non-null int64 \n", " 24 softness_balanced 443 non-null int64 \n", " 25 softness_firm 443 non-null int64 \n", " 26 toebox_durability 443 non-null int64 \n", " 27 heel_durability 443 non-null int64 \n", " 28 outsole_durability 443 non-null int64 \n", " 29 breathability 443 non-null int64 \n", " 30 width_narrow 443 non-null int64 \n", " 31 width_medium 443 non-null int64 \n", " 32 width_wide 443 non-null int64 \n", " 33 toebox_narrow 443 non-null int64 \n", " 34 toebox_medium 443 non-null int64 \n", " 35 toebox_wide 443 non-null int64 \n", " 36 stiffness_flexible 443 non-null int64 \n", " 37 stiffness_moderate 443 non-null int64 \n", " 38 stiffness_stiff 443 non-null int64 \n", " 39 torsional_flexible 443 non-null int64 \n", " 40 torsional_moderate 443 non-null int64 \n", " 41 torsional_stiff 443 non-null int64 \n", " 42 heel_stiff_flexible 443 non-null int64 \n", " 43 heel_stiff_moderate 443 non-null int64 \n", " 44 heel_stiff_stiff 443 non-null int64 \n", " 45 plate_0 443 non-null int64 \n", " 46 plate_rock_plate 443 non-null int64 \n", " 47 plate_carbon_plate 443 non-null int64 \n", "dtypes: float64(5), int64(38), str(5)\n", "memory usage: 166.3 KB\n" ] } ], "source": [ "df.drop(columns=[\"Plate\"], inplace=True)\n", "df.info()" ] }, { "cell_type": "markdown", "id": "02a46d95", "metadata": {}, "source": [ "# Rocker" ] }, { "cell_type": "code", "execution_count": 162, "id": "28f4c008", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Rocker\n", "0 296\n", "1 147\n", "Name: count, dtype: int64\n" ] } ], "source": [ "print(df[\"Rocker\"].value_counts())" ] }, { "cell_type": "markdown", "id": "4e919551", "metadata": {}, "source": [ "# Heel lab Heel brand" ] }, { "cell_type": "code", "execution_count": 163, "id": "62e355de", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Heel lab Heel brand\n", "34.9 mm 35.0 mm 4\n", "39.9 mm 40.0 mm 4\n", "38.1 mm 40.0 mm 3\n", "35.3 mm 35.0 mm 3\n", "32.0 mm 3\n", " ..\n", "39.0 mm 35.0 mm 1\n", "34.1 mm 1\n", "36.9 mm 41.0 mm 1\n", "35.5 mm 37.0 mm 1\n", "38.6 mm 38.6 mm 1\n", "Name: count, Length: 380, dtype: int64\n" ] } ], "source": [ "print(df[\"Heel lab Heel brand\"].value_counts())" ] }, { "cell_type": "code", "execution_count": 164, "id": "857ec390", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "np.int64(0)" ] }, "execution_count": 164, "metadata": {}, "output_type": "execute_result" } ], "source": [ "mask_missing = (\n", " df[\"Heel lab Heel brand\"].isna() |\n", " (df[\"Heel lab Heel brand\"].astype(str).str.strip() == \"-\")\n", ")\n", "mask_missing.sum() " ] }, { "cell_type": "code", "execution_count": 165, "id": "bf4fc059", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " Heel lab Heel brand heel_lab_mm heel_brand_mm\n", "0 32.4 mm 36.0 mm 32.4 36.0\n", "1 34.3 mm 32.5 mm 34.3 32.5\n", "2 33.3 mm 32.5 mm 33.3 32.5\n", "3 31.8 mm 32.0 mm 31.8 32.0\n", "4 32.6 mm 34.0 mm 32.6 34.0\n" ] } ], "source": [ "Heel = df[\"Heel lab Heel brand\"].str.findall(r\"[\\d.]+\")\n", "\n", "df[[\"heel_lab_mm\", \"heel_brand_mm\"]] = (\n", " pd.DataFrame(Heel.tolist(), index=df.index)\n", ")\n", "\n", "for col in [\"heel_lab_mm\", \"heel_brand_mm\"]:\n", " df[col] = pd.to_numeric(df[col], errors=\"coerce\")\n", "\n", "print(df[[\"Heel lab Heel brand\", \"heel_lab_mm\", \"heel_brand_mm\"]].head())" ] }, { "cell_type": "code", "execution_count": 166, "id": "5b5e9be9", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 443 entries, 0 to 442\n", "Data columns (total 49 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 Brand 443 non-null str \n", " 1 Name 443 non-null str \n", " 2 Lightweight 443 non-null int64 \n", " 3 Rocker 443 non-null int64 \n", " 4 Forefoot lab Forefoot brand 443 non-null str \n", " 5 Orthotic friendly 443 non-null int64 \n", " 6 Season 443 non-null str \n", " 7 Removable insole 443 non-null int64 \n", " 8 pace_daily_running 443 non-null int64 \n", " 9 pace_tempo 443 non-null int64 \n", " 10 pace_competition 443 non-null int64 \n", " 11 arch_neutral 443 non-null int64 \n", " 12 arch_stability 443 non-null int64 \n", " 13 weight_lab_oz 443 non-null float64\n", " 14 weight_lab_g 443 non-null int64 \n", " 15 weight_brand_oz 436 non-null float64\n", " 16 weight_brand_g 436 non-null float64\n", " 17 drop_lab_mm 443 non-null float64\n", " 18 drop_brand_mm 427 non-null float64\n", " 19 strike_heel 443 non-null int64 \n", " 20 strike_mid 443 non-null int64 \n", " 21 strike_forefoot 443 non-null int64 \n", " 22 softness_soft 443 non-null int64 \n", " 23 softness_balanced 443 non-null int64 \n", " 24 softness_firm 443 non-null int64 \n", " 25 toebox_durability 443 non-null int64 \n", " 26 heel_durability 443 non-null int64 \n", " 27 outsole_durability 443 non-null int64 \n", " 28 breathability 443 non-null int64 \n", " 29 width_narrow 443 non-null int64 \n", " 30 width_medium 443 non-null int64 \n", " 31 width_wide 443 non-null int64 \n", " 32 toebox_narrow 443 non-null int64 \n", " 33 toebox_medium 443 non-null int64 \n", " 34 toebox_wide 443 non-null int64 \n", " 35 stiffness_flexible 443 non-null int64 \n", " 36 stiffness_moderate 443 non-null int64 \n", " 37 stiffness_stiff 443 non-null int64 \n", " 38 torsional_flexible 443 non-null int64 \n", " 39 torsional_moderate 443 non-null int64 \n", " 40 torsional_stiff 443 non-null int64 \n", " 41 heel_stiff_flexible 443 non-null int64 \n", " 42 heel_stiff_moderate 443 non-null int64 \n", " 43 heel_stiff_stiff 443 non-null int64 \n", " 44 plate_0 443 non-null int64 \n", " 45 plate_rock_plate 443 non-null int64 \n", " 46 plate_carbon_plate 443 non-null int64 \n", " 47 heel_lab_mm 443 non-null float64\n", " 48 heel_brand_mm 394 non-null float64\n", "dtypes: float64(7), int64(38), str(4)\n", "memory usage: 169.7 KB\n" ] } ], "source": [ "df.drop(columns=[\"Heel lab Heel brand\"], inplace=True)\n", "df.info()" ] }, { "cell_type": "markdown", "id": "f3bf442e", "metadata": {}, "source": [ "# Forefoot lab Forefoot brand" ] }, { "cell_type": "code", "execution_count": 167, "id": "83b3bb25", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "0 23.0 mm 26.0 mm\n", "1 26.6 mm 24.5 mm\n", "2 24.4 mm 22.5 mm\n", "3 21.2 mm 21.0 mm\n", "4 22.7 mm 24.0 mm\n", "Name: Forefoot lab Forefoot brand, dtype: str\n" ] } ], "source": [ "print(df['Forefoot lab Forefoot brand'].head())" ] }, { "cell_type": "code", "execution_count": 168, "id": "da1a83a6", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "np.int64(0)" ] }, "execution_count": 168, "metadata": {}, "output_type": "execute_result" } ], "source": [ "mask_missing = (\n", " df[\"Forefoot lab Forefoot brand\"].isna() |\n", " (df[\"Forefoot lab Forefoot brand\"].astype(str).str.strip() == \"-\")\n", ")\n", "mask_missing.sum()" ] }, { "cell_type": "code", "execution_count": 169, "id": "6a2bf00a", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " Forefoot lab Forefoot brand forefoot_lab_mm forefoot_brand_mm\n", "0 23.0 mm 26.0 mm 23.0 26.0\n", "1 26.6 mm 24.5 mm 26.6 24.5\n", "2 24.4 mm 22.5 mm 24.4 22.5\n", "3 21.2 mm 21.0 mm 21.2 21.0\n", "4 22.7 mm 24.0 mm 22.7 24.0\n" ] } ], "source": [ "forefoot = df[\"Forefoot lab Forefoot brand\"].str.findall(r\"[\\d.]+\")\n", "\n", "df[[\"forefoot_lab_mm\", \"forefoot_brand_mm\"]] = (\n", " pd.DataFrame(forefoot.tolist(), index=df.index)\n", ")\n", "\n", "for col in [\"forefoot_lab_mm\", \"forefoot_brand_mm\"]:\n", " df[col] = pd.to_numeric(df[col], errors=\"coerce\")\n", "\n", "print(df[[\"Forefoot lab Forefoot brand\", \"forefoot_lab_mm\", \"forefoot_brand_mm\"]].head())" ] }, { "cell_type": "code", "execution_count": 170, "id": "8eba2eae", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 443 entries, 0 to 442\n", "Data columns (total 50 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 Brand 443 non-null str \n", " 1 Name 443 non-null str \n", " 2 Lightweight 443 non-null int64 \n", " 3 Rocker 443 non-null int64 \n", " 4 Orthotic friendly 443 non-null int64 \n", " 5 Season 443 non-null str \n", " 6 Removable insole 443 non-null int64 \n", " 7 pace_daily_running 443 non-null int64 \n", " 8 pace_tempo 443 non-null int64 \n", " 9 pace_competition 443 non-null int64 \n", " 10 arch_neutral 443 non-null int64 \n", " 11 arch_stability 443 non-null int64 \n", " 12 weight_lab_oz 443 non-null float64\n", " 13 weight_lab_g 443 non-null int64 \n", " 14 weight_brand_oz 436 non-null float64\n", " 15 weight_brand_g 436 non-null float64\n", " 16 drop_lab_mm 443 non-null float64\n", " 17 drop_brand_mm 427 non-null float64\n", " 18 strike_heel 443 non-null int64 \n", " 19 strike_mid 443 non-null int64 \n", " 20 strike_forefoot 443 non-null int64 \n", " 21 softness_soft 443 non-null int64 \n", " 22 softness_balanced 443 non-null int64 \n", " 23 softness_firm 443 non-null int64 \n", " 24 toebox_durability 443 non-null int64 \n", " 25 heel_durability 443 non-null int64 \n", " 26 outsole_durability 443 non-null int64 \n", " 27 breathability 443 non-null int64 \n", " 28 width_narrow 443 non-null int64 \n", " 29 width_medium 443 non-null int64 \n", " 30 width_wide 443 non-null int64 \n", " 31 toebox_narrow 443 non-null int64 \n", " 32 toebox_medium 443 non-null int64 \n", " 33 toebox_wide 443 non-null int64 \n", " 34 stiffness_flexible 443 non-null int64 \n", " 35 stiffness_moderate 443 non-null int64 \n", " 36 stiffness_stiff 443 non-null int64 \n", " 37 torsional_flexible 443 non-null int64 \n", " 38 torsional_moderate 443 non-null int64 \n", " 39 torsional_stiff 443 non-null int64 \n", " 40 heel_stiff_flexible 443 non-null int64 \n", " 41 heel_stiff_moderate 443 non-null int64 \n", " 42 heel_stiff_stiff 443 non-null int64 \n", " 43 plate_0 443 non-null int64 \n", " 44 plate_rock_plate 443 non-null int64 \n", " 45 plate_carbon_plate 443 non-null int64 \n", " 46 heel_lab_mm 443 non-null float64\n", " 47 heel_brand_mm 394 non-null float64\n", " 48 forefoot_lab_mm 443 non-null float64\n", " 49 forefoot_brand_mm 393 non-null float64\n", "dtypes: float64(9), int64(38), str(3)\n", "memory usage: 173.2 KB\n" ] } ], "source": [ "df.drop(columns=[\"Forefoot lab Forefoot brand\"], inplace=True)\n", "df.info()" ] }, { "cell_type": "markdown", "id": "a3bc78a8", "metadata": {}, "source": [ "# Season" ] }, { "cell_type": "code", "execution_count": 171, "id": "af808af0", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Season\n", "All seasons 260\n", "SummerAll seasons 113\n", "- 58\n", "Winter 12\n", "Name: count, dtype: int64\n" ] } ], "source": [ "print(df[\"Season\"].value_counts())" ] }, { "cell_type": "code", "execution_count": 172, "id": "1c74b369", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Jumlah baris dengan '-' atau '0': 58\n", "\n", "--- Detail Baris (Season = '-' atau '0') ---\n", " Brand Name Season\n", "0 Brooks Launch 9 -\n", "13 Adidas Adizero Adios Pro 2.0 -\n", "25 Brooks Adrenaline GTS 22 -\n", "34 Nike Air Zoom Pegasus 38 FlyEase -\n", "47 Saucony Axon -\n", "85 Nike Downshifter 11 -\n", "89 Adidas Duramo 10 -\n", "97 Saucony Endorphin Pro 3 -\n", "101 Saucony Endorphin Shift 2 -\n", "115 Nike Flex Experience Run 10 -\n", "118 Nike Flex Run 2021 -\n", "119 Reebok Floatride Energy 3 -\n", "125 Nike Free Run 5.0 -\n", "126 Saucony Freedom 4 -\n", "127 New Balance Fresh Foam 1080 v11 -\n", "129 New Balance Fresh Foam 860 v11 -\n", "130 New Balance Fresh Foam 860 v12 -\n", "134 New Balance Fresh Foam X 1080 v12 -\n", "167 ASICS Gel Contend 7 -\n", "171 ASICS Gel Cumulus 24 -\n", "175 ASICS Gel Excite 8 -\n", "176 ASICS Gel Kayano 28 -\n", "180 ASICS Gel Kayano Lite 2 -\n", "183 ASICS Gel Nimbus 24 -\n", "187 ASICS Gel Nimbus Lite 3 -\n", "188 ASICS Gel Pulse 11 -\n", "201 Brooks Glycerin 19 -\n", "213 Skechers GOrun Razor Excess -\n", "214 ASICS GT 1000 10 -\n", "215 ASICS GT 1000 11 -\n", "219 ASICS GT 1000 9 -\n", "220 ASICS GT 2000 10 -\n", "225 Saucony Guide 14 -\n", "226 Saucony Guide 15 -\n", "252 Saucony Kinvara 12 -\n", "253 Saucony Kinvara 13 -\n", "259 Brooks Launch 8 -\n", "262 Brooks Levitate 5 -\n", "267 Hoka Mach 4 -\n", "277 Skechers Max Cushioning Elite -\n", "280 ASICS Metaspeed Edge -\n", "296 ASICS Novablast 2 -\n", "314 Altra Provision 6 -\n", "319 Nike Quest 4 -\n", "324 Jordan React Havoc -\n", "326 Nike React Miler 3 -\n", "327 Nike Renew Ride 2 -\n", "332 Nike Revolution 6 -\n", "336 Brooks Ricochet 3 -\n", "338 Saucony Ride 15 -\n", "343 Altra Rivera 2 -\n", "367 APL Streamline -\n", "378 Adidas Supernova+ -\n", "397 Adidas Ultraboost 21 -\n", "398 Adidas Ultraboost 22 -\n", "415 Mizuno Wave Horizon 6 -\n", "424 Mizuno Wave Rider 25 -\n", "437 Nike Zoom Fly 4 -\n", "\n", "Frekuensi spesifik:\n", "Season\n", "- 58\n", "Name: count, dtype: int64\n" ] } ], "source": [ "# Check weird values\n", "filter_condition = df['Season'].astype(str).isin(['-', '0'])\n", "rows_to_check = df[filter_condition]\n", "\n", "print(f\"Jumlah baris dengan '-' atau '0': {len(rows_to_check)}\")\n", "print(\"\\n--- Detail Baris (Season = '-' atau '0') ---\")\n", "print(rows_to_check[['Brand', 'Name', 'Season']])\n", "\n", "\n", "print(\"\\nFrekuensi spesifik:\")\n", "print(df[df['Season'].astype(str).isin(['-', '0'])]['Season'].value_counts())" ] }, { "cell_type": "code", "execution_count": 173, "id": "d92d1ad4", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Rows: 443\n", "NULL/Unknown Value (0 dan -): 58\n", "\n", "Sample Comparison (Multi-label):\n", " Season season_summer season_winter season_all\n", "1 summerall seasons 1 0 1\n", "6 summerall seasons 1 0 1\n", "8 summerall seasons 1 0 1\n", "9 summerall seasons 1 0 1\n", "10 summerall seasons 1 0 1\n" ] } ], "source": [ "df['Season'] = df['Season'].astype(str).str.lower()\n", "base_seasons = ['summer', 'winter', 'all seasons']\n", "\n", "for level in base_seasons:\n", " clean_name = level.replace(' seasons', '').replace(' ', '_')\n", " column_name = f\"season_{clean_name}\"\n", " df[column_name] = df['Season'].str.contains(level, na=False).astype(int)\n", "\n", "print(\"Rows:\", len(df))\n", "\n", "season_cols = [col for col in df.columns if col.startswith('season_')]\n", "zero_vector_count = (df[season_cols].sum(axis=1) == 0).sum()\n", "print(f\"NULL/Unknown Value (0 dan -): {zero_vector_count}\")\n", "\n", "print(\"\\nSample Comparison (Multi-label):\")\n", "print(df[df[season_cols].sum(axis=1) > 1][['Season'] + season_cols].head())" ] }, { "cell_type": "code", "execution_count": 174, "id": "da655e5b", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Season\n", "all seasons 260\n", "summerall seasons 113\n", "- 58\n", "winter 12\n", "Name: count, dtype: int64\n", "\n", "season_summer sum: 113\n", "season_winter sum: 12\n", "season_all sum: 373\n", "\n", " Season season_summer season_winter season_all\n", "0 - 0 0 0\n", "1 summerall seasons 1 0 1\n", "2 all seasons 0 0 1\n", "3 all seasons 0 0 1\n", "4 all seasons 0 0 1\n" ] } ], "source": [ "print(df[\"Season\"].value_counts())\n", "\n", "print()\n", "for col in season_cols:\n", " print(f\"{col} sum:\", int(df[col].sum()))\n", "\n", "print()\n", "print(df[[\"Season\"] + season_cols].head())" ] }, { "cell_type": "code", "execution_count": 175, "id": "7097e6a5", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 443 entries, 0 to 442\n", "Data columns (total 52 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 Brand 443 non-null str \n", " 1 Name 443 non-null str \n", " 2 Lightweight 443 non-null int64 \n", " 3 Rocker 443 non-null int64 \n", " 4 Orthotic friendly 443 non-null int64 \n", " 5 Removable insole 443 non-null int64 \n", " 6 pace_daily_running 443 non-null int64 \n", " 7 pace_tempo 443 non-null int64 \n", " 8 pace_competition 443 non-null int64 \n", " 9 arch_neutral 443 non-null int64 \n", " 10 arch_stability 443 non-null int64 \n", " 11 weight_lab_oz 443 non-null float64\n", " 12 weight_lab_g 443 non-null int64 \n", " 13 weight_brand_oz 436 non-null float64\n", " 14 weight_brand_g 436 non-null float64\n", " 15 drop_lab_mm 443 non-null float64\n", " 16 drop_brand_mm 427 non-null float64\n", " 17 strike_heel 443 non-null int64 \n", " 18 strike_mid 443 non-null int64 \n", " 19 strike_forefoot 443 non-null int64 \n", " 20 softness_soft 443 non-null int64 \n", " 21 softness_balanced 443 non-null int64 \n", " 22 softness_firm 443 non-null int64 \n", " 23 toebox_durability 443 non-null int64 \n", " 24 heel_durability 443 non-null int64 \n", " 25 outsole_durability 443 non-null int64 \n", " 26 breathability 443 non-null int64 \n", " 27 width_narrow 443 non-null int64 \n", " 28 width_medium 443 non-null int64 \n", " 29 width_wide 443 non-null int64 \n", " 30 toebox_narrow 443 non-null int64 \n", " 31 toebox_medium 443 non-null int64 \n", " 32 toebox_wide 443 non-null int64 \n", " 33 stiffness_flexible 443 non-null int64 \n", " 34 stiffness_moderate 443 non-null int64 \n", " 35 stiffness_stiff 443 non-null int64 \n", " 36 torsional_flexible 443 non-null int64 \n", " 37 torsional_moderate 443 non-null int64 \n", " 38 torsional_stiff 443 non-null int64 \n", " 39 heel_stiff_flexible 443 non-null int64 \n", " 40 heel_stiff_moderate 443 non-null int64 \n", " 41 heel_stiff_stiff 443 non-null int64 \n", " 42 plate_0 443 non-null int64 \n", " 43 plate_rock_plate 443 non-null int64 \n", " 44 plate_carbon_plate 443 non-null int64 \n", " 45 heel_lab_mm 443 non-null float64\n", " 46 heel_brand_mm 394 non-null float64\n", " 47 forefoot_lab_mm 443 non-null float64\n", " 48 forefoot_brand_mm 393 non-null float64\n", " 49 season_summer 443 non-null int64 \n", " 50 season_winter 443 non-null int64 \n", " 51 season_all 443 non-null int64 \n", "dtypes: float64(9), int64(41), str(2)\n", "memory usage: 180.1 KB\n" ] } ], "source": [ "df.drop(columns=[\"Season\"], inplace=True)\n", "df.info()" ] }, { "cell_type": "code", "execution_count": 176, "id": "202a9d4c", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " Brand Name Removable insole Orthotic friendly\n", "0 Brooks Launch 9 1 1\n", "1 Brooks Levitate 6 1 1\n", "2 Adidas 4DFWD 1 1\n", "3 Adidas 4DFWD 2 1 1\n", "4 Adidas 4DFWD 3 1 1\n" ] } ], "source": [ "print(df[[\"Brand\", \"Name\", \"Removable insole\", \"Orthotic friendly\"]].head())" ] }, { "cell_type": "markdown", "id": "f95804af", "metadata": {}, "source": [ "# Finishing" ] }, { "cell_type": "code", "execution_count": 177, "id": "b64898ce", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 443 entries, 0 to 442\n", "Data columns (total 49 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 Brand 443 non-null str \n", " 1 Name 443 non-null str \n", " 2 Lightweight 443 non-null int64 \n", " 3 Rocker 443 non-null int64 \n", " 4 Orthotic friendly 443 non-null int64 \n", " 5 Removable insole 443 non-null int64 \n", " 6 pace_daily_running 443 non-null int64 \n", " 7 pace_tempo 443 non-null int64 \n", " 8 pace_competition 443 non-null int64 \n", " 9 arch_neutral 443 non-null int64 \n", " 10 arch_stability 443 non-null int64 \n", " 11 weight_lab_oz 443 non-null float64\n", " 12 drop_lab_mm 443 non-null float64\n", " 13 drop_brand_mm 427 non-null float64\n", " 14 strike_heel 443 non-null int64 \n", " 15 strike_mid 443 non-null int64 \n", " 16 strike_forefoot 443 non-null int64 \n", " 17 softness_soft 443 non-null int64 \n", " 18 softness_balanced 443 non-null int64 \n", " 19 softness_firm 443 non-null int64 \n", " 20 toebox_durability 443 non-null int64 \n", " 21 heel_durability 443 non-null int64 \n", " 22 outsole_durability 443 non-null int64 \n", " 23 breathability 443 non-null int64 \n", " 24 width_narrow 443 non-null int64 \n", " 25 width_medium 443 non-null int64 \n", " 26 width_wide 443 non-null int64 \n", " 27 toebox_narrow 443 non-null int64 \n", " 28 toebox_medium 443 non-null int64 \n", " 29 toebox_wide 443 non-null int64 \n", " 30 stiffness_flexible 443 non-null int64 \n", " 31 stiffness_moderate 443 non-null int64 \n", " 32 stiffness_stiff 443 non-null int64 \n", " 33 torsional_flexible 443 non-null int64 \n", " 34 torsional_moderate 443 non-null int64 \n", " 35 torsional_stiff 443 non-null int64 \n", " 36 heel_stiff_flexible 443 non-null int64 \n", " 37 heel_stiff_moderate 443 non-null int64 \n", " 38 heel_stiff_stiff 443 non-null int64 \n", " 39 plate_0 443 non-null int64 \n", " 40 plate_rock_plate 443 non-null int64 \n", " 41 plate_carbon_plate 443 non-null int64 \n", " 42 heel_lab_mm 443 non-null float64\n", " 43 heel_brand_mm 394 non-null float64\n", " 44 forefoot_lab_mm 443 non-null float64\n", " 45 forefoot_brand_mm 393 non-null float64\n", " 46 season_summer 443 non-null int64 \n", " 47 season_winter 443 non-null int64 \n", " 48 season_all 443 non-null int64 \n", "dtypes: float64(7), int64(40), str(2)\n", "memory usage: 169.7 KB\n" ] } ], "source": [ "# Weight cuma pakai yg lab_oz\n", "df.drop(columns=['weight_brand_oz', 'weight_lab_g', 'weight_brand_g'], inplace=True)\n", "df.info()" ] }, { "cell_type": "code", "execution_count": 178, "id": "42ad805f", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 443 entries, 0 to 442\n", "Data columns (total 48 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 Brand 443 non-null str \n", " 1 Name 443 non-null str \n", " 2 Lightweight 443 non-null int64 \n", " 3 Rocker 443 non-null int64 \n", " 4 Orthotic friendly 443 non-null int64 \n", " 5 Removable insole 443 non-null int64 \n", " 6 pace_daily_running 443 non-null int64 \n", " 7 pace_tempo 443 non-null int64 \n", " 8 pace_competition 443 non-null int64 \n", " 9 arch_neutral 443 non-null int64 \n", " 10 arch_stability 443 non-null int64 \n", " 11 weight_lab_oz 443 non-null float64\n", " 12 drop_lab_mm 443 non-null float64\n", " 13 strike_heel 443 non-null int64 \n", " 14 strike_mid 443 non-null int64 \n", " 15 strike_forefoot 443 non-null int64 \n", " 16 softness_soft 443 non-null int64 \n", " 17 softness_balanced 443 non-null int64 \n", " 18 softness_firm 443 non-null int64 \n", " 19 toebox_durability 443 non-null int64 \n", " 20 heel_durability 443 non-null int64 \n", " 21 outsole_durability 443 non-null int64 \n", " 22 breathability 443 non-null int64 \n", " 23 width_narrow 443 non-null int64 \n", " 24 width_medium 443 non-null int64 \n", " 25 width_wide 443 non-null int64 \n", " 26 toebox_narrow 443 non-null int64 \n", " 27 toebox_medium 443 non-null int64 \n", " 28 toebox_wide 443 non-null int64 \n", " 29 stiffness_flexible 443 non-null int64 \n", " 30 stiffness_moderate 443 non-null int64 \n", " 31 stiffness_stiff 443 non-null int64 \n", " 32 torsional_flexible 443 non-null int64 \n", " 33 torsional_moderate 443 non-null int64 \n", " 34 torsional_stiff 443 non-null int64 \n", " 35 heel_stiff_flexible 443 non-null int64 \n", " 36 heel_stiff_moderate 443 non-null int64 \n", " 37 heel_stiff_stiff 443 non-null int64 \n", " 38 plate_0 443 non-null int64 \n", " 39 plate_rock_plate 443 non-null int64 \n", " 40 plate_carbon_plate 443 non-null int64 \n", " 41 heel_lab_mm 443 non-null float64\n", " 42 heel_brand_mm 394 non-null float64\n", " 43 forefoot_lab_mm 443 non-null float64\n", " 44 forefoot_brand_mm 393 non-null float64\n", " 45 season_summer 443 non-null int64 \n", " 46 season_winter 443 non-null int64 \n", " 47 season_all 443 non-null int64 \n", "dtypes: float64(6), int64(40), str(2)\n", "memory usage: 166.3 KB\n" ] } ], "source": [ "# drop cuma pakai yg lab_mm\n", "df.drop(columns=['drop_brand_mm'], inplace=True)\n", "df.info()" ] }, { "cell_type": "code", "execution_count": 179, "id": "ecb61466", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 443 entries, 0 to 442\n", "Data columns (total 47 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 Brand 443 non-null str \n", " 1 Name 443 non-null str \n", " 2 Lightweight 443 non-null int64 \n", " 3 Rocker 443 non-null int64 \n", " 4 Orthotic friendly 443 non-null int64 \n", " 5 Removable insole 443 non-null int64 \n", " 6 pace_daily_running 443 non-null int64 \n", " 7 pace_tempo 443 non-null int64 \n", " 8 pace_competition 443 non-null int64 \n", " 9 arch_neutral 443 non-null int64 \n", " 10 arch_stability 443 non-null int64 \n", " 11 weight_lab_oz 443 non-null float64\n", " 12 drop_lab_mm 443 non-null float64\n", " 13 strike_heel 443 non-null int64 \n", " 14 strike_mid 443 non-null int64 \n", " 15 strike_forefoot 443 non-null int64 \n", " 16 softness_soft 443 non-null int64 \n", " 17 softness_balanced 443 non-null int64 \n", " 18 softness_firm 443 non-null int64 \n", " 19 toebox_durability 443 non-null int64 \n", " 20 heel_durability 443 non-null int64 \n", " 21 outsole_durability 443 non-null int64 \n", " 22 breathability 443 non-null int64 \n", " 23 width_narrow 443 non-null int64 \n", " 24 width_medium 443 non-null int64 \n", " 25 width_wide 443 non-null int64 \n", " 26 toebox_narrow 443 non-null int64 \n", " 27 toebox_medium 443 non-null int64 \n", " 28 toebox_wide 443 non-null int64 \n", " 29 stiffness_flexible 443 non-null int64 \n", " 30 stiffness_moderate 443 non-null int64 \n", " 31 stiffness_stiff 443 non-null int64 \n", " 32 torsional_flexible 443 non-null int64 \n", " 33 torsional_moderate 443 non-null int64 \n", " 34 torsional_stiff 443 non-null int64 \n", " 35 heel_stiff_flexible 443 non-null int64 \n", " 36 heel_stiff_moderate 443 non-null int64 \n", " 37 heel_stiff_stiff 443 non-null int64 \n", " 38 plate_0 443 non-null int64 \n", " 39 plate_rock_plate 443 non-null int64 \n", " 40 plate_carbon_plate 443 non-null int64 \n", " 41 heel_lab_mm 443 non-null float64\n", " 42 forefoot_lab_mm 443 non-null float64\n", " 43 forefoot_brand_mm 393 non-null float64\n", " 44 season_summer 443 non-null int64 \n", " 45 season_winter 443 non-null int64 \n", " 46 season_all 443 non-null int64 \n", "dtypes: float64(5), int64(40), str(2)\n", "memory usage: 162.8 KB\n" ] } ], "source": [ "# heel pakai yang heel_lab_mm\n", "df.drop(columns=['heel_brand_mm'], inplace=True)\n", "df.info()" ] }, { "cell_type": "code", "execution_count": 180, "id": "ff10d872", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 443 entries, 0 to 442\n", "Data columns (total 46 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 Brand 443 non-null str \n", " 1 Name 443 non-null str \n", " 2 Lightweight 443 non-null int64 \n", " 3 Rocker 443 non-null int64 \n", " 4 Orthotic friendly 443 non-null int64 \n", " 5 Removable insole 443 non-null int64 \n", " 6 pace_daily_running 443 non-null int64 \n", " 7 pace_tempo 443 non-null int64 \n", " 8 pace_competition 443 non-null int64 \n", " 9 arch_neutral 443 non-null int64 \n", " 10 arch_stability 443 non-null int64 \n", " 11 weight_lab_oz 443 non-null float64\n", " 12 drop_lab_mm 443 non-null float64\n", " 13 strike_heel 443 non-null int64 \n", " 14 strike_mid 443 non-null int64 \n", " 15 strike_forefoot 443 non-null int64 \n", " 16 softness_soft 443 non-null int64 \n", " 17 softness_balanced 443 non-null int64 \n", " 18 softness_firm 443 non-null int64 \n", " 19 toebox_durability 443 non-null int64 \n", " 20 heel_durability 443 non-null int64 \n", " 21 outsole_durability 443 non-null int64 \n", " 22 breathability 443 non-null int64 \n", " 23 width_narrow 443 non-null int64 \n", " 24 width_medium 443 non-null int64 \n", " 25 width_wide 443 non-null int64 \n", " 26 toebox_narrow 443 non-null int64 \n", " 27 toebox_medium 443 non-null int64 \n", " 28 toebox_wide 443 non-null int64 \n", " 29 stiffness_flexible 443 non-null int64 \n", " 30 stiffness_moderate 443 non-null int64 \n", " 31 stiffness_stiff 443 non-null int64 \n", " 32 torsional_flexible 443 non-null int64 \n", " 33 torsional_moderate 443 non-null int64 \n", " 34 torsional_stiff 443 non-null int64 \n", " 35 heel_stiff_flexible 443 non-null int64 \n", " 36 heel_stiff_moderate 443 non-null int64 \n", " 37 heel_stiff_stiff 443 non-null int64 \n", " 38 plate_0 443 non-null int64 \n", " 39 plate_rock_plate 443 non-null int64 \n", " 40 plate_carbon_plate 443 non-null int64 \n", " 41 heel_lab_mm 443 non-null float64\n", " 42 forefoot_lab_mm 443 non-null float64\n", " 43 season_summer 443 non-null int64 \n", " 44 season_winter 443 non-null int64 \n", " 45 season_all 443 non-null int64 \n", "dtypes: float64(4), int64(40), str(2)\n", "memory usage: 159.3 KB\n" ] } ], "source": [ "# Forefoot pakai yang forefoot_lab_mm\n", "df.drop(columns=['forefoot_brand_mm'], inplace=True)\n", "df.info()" ] }, { "cell_type": "code", "execution_count": 181, "id": "1b4897cb", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "C:\\Users\\caxyl\\AppData\\Local\\Temp\\ipykernel_15940\\522114045.py:2: Pandas4Warning: For backward compatibility, 'str' dtypes are included by select_dtypes when 'object' dtype is specified. This behavior is deprecated and will be removed in a future version. Explicitly pass 'str' to `include` to select them, or to `exclude` to remove them and silence this warning.\n", "See https://pandas.pydata.org/docs/user_guide/migration-3-strings.html#string-migration-select-dtypes for details on how to write code that works with pandas 2 and 3.\n", " for col in df.select_dtypes(include=['object']).columns:\n" ] }, { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
BrandNameLightweightRockerOrthotic friendlyRemovable insolepace_daily_runningpace_tempopace_competitionarch_neutral...heel_stiff_moderateheel_stiff_stiffplate_0plate_rock_plateplate_carbon_plateheel_lab_mmforefoot_lab_mmseason_summerseason_winterseason_all
0brookslaunch 910111101...0010032.423.0000
1brookslevitate 600111001...1010034.326.6101
2adidas4dfwd00111001...0010033.324.4001
3adidas4dfwd 200111001...1010031.821.2001
4adidas4dfwd 300111001...0010032.622.7001
\n", "

5 rows × 46 columns

\n", "
" ], "text/plain": [ " Brand Name Lightweight Rocker Orthotic friendly \\\n", "0 brooks launch 9 1 0 1 \n", "1 brooks levitate 6 0 0 1 \n", "2 adidas 4dfwd 0 0 1 \n", "3 adidas 4dfwd 2 0 0 1 \n", "4 adidas 4dfwd 3 0 0 1 \n", "\n", " Removable insole pace_daily_running pace_tempo pace_competition \\\n", "0 1 1 1 0 \n", "1 1 1 0 0 \n", "2 1 1 0 0 \n", "3 1 1 0 0 \n", "4 1 1 0 0 \n", "\n", " arch_neutral ... heel_stiff_moderate heel_stiff_stiff plate_0 \\\n", "0 1 ... 0 0 1 \n", "1 1 ... 1 0 1 \n", "2 1 ... 0 0 1 \n", "3 1 ... 1 0 1 \n", "4 1 ... 0 0 1 \n", "\n", " plate_rock_plate plate_carbon_plate heel_lab_mm forefoot_lab_mm \\\n", "0 0 0 32.4 23.0 \n", "1 0 0 34.3 26.6 \n", "2 0 0 33.3 24.4 \n", "3 0 0 31.8 21.2 \n", "4 0 0 32.6 22.7 \n", "\n", " season_summer season_winter season_all \n", "0 0 0 0 \n", "1 1 0 1 \n", "2 0 0 1 \n", "3 0 0 1 \n", "4 0 0 1 \n", "\n", "[5 rows x 46 columns]" ] }, "execution_count": 181, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Making all dataset lowercase\n", "for col in df.select_dtypes(include=['object']).columns:\n", " df[col] = df[col].str.lower()\n", "\n", "df.head()" ] }, { "cell_type": "code", "execution_count": 182, "id": "5315d530", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 443 entries, 0 to 442\n", "Data columns (total 46 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 Brand 443 non-null str \n", " 1 Name 443 non-null str \n", " 2 Lightweight 443 non-null int64 \n", " 3 Rocker 443 non-null int64 \n", " 4 Orthotic friendly 443 non-null int64 \n", " 5 Removable insole 443 non-null int64 \n", " 6 pace_daily_running 443 non-null int64 \n", " 7 pace_tempo 443 non-null int64 \n", " 8 pace_competition 443 non-null int64 \n", " 9 arch_neutral 443 non-null int64 \n", " 10 arch_stability 443 non-null int64 \n", " 11 weight_lab_oz 443 non-null float64\n", " 12 drop_lab_mm 443 non-null float64\n", " 13 strike_heel 443 non-null int64 \n", " 14 strike_mid 443 non-null int64 \n", " 15 strike_forefoot 443 non-null int64 \n", " 16 softness_soft 443 non-null int64 \n", " 17 softness_balanced 443 non-null int64 \n", " 18 softness_firm 443 non-null int64 \n", " 19 toebox_durability 443 non-null int64 \n", " 20 heel_durability 443 non-null int64 \n", " 21 outsole_durability 443 non-null int64 \n", " 22 breathability 443 non-null int64 \n", " 23 width_narrow 443 non-null int64 \n", " 24 width_medium 443 non-null int64 \n", " 25 width_wide 443 non-null int64 \n", " 26 toebox_narrow 443 non-null int64 \n", " 27 toebox_medium 443 non-null int64 \n", " 28 toebox_wide 443 non-null int64 \n", " 29 stiffness_flexible 443 non-null int64 \n", " 30 stiffness_moderate 443 non-null int64 \n", " 31 stiffness_stiff 443 non-null int64 \n", " 32 torsional_flexible 443 non-null int64 \n", " 33 torsional_moderate 443 non-null int64 \n", " 34 torsional_stiff 443 non-null int64 \n", " 35 heel_stiff_flexible 443 non-null int64 \n", " 36 heel_stiff_moderate 443 non-null int64 \n", " 37 heel_stiff_stiff 443 non-null int64 \n", " 38 plate_0 443 non-null int64 \n", " 39 plate_rock_plate 443 non-null int64 \n", " 40 plate_carbon_plate 443 non-null int64 \n", " 41 heel_lab_mm 443 non-null float64\n", " 42 forefoot_lab_mm 443 non-null float64\n", " 43 season_summer 443 non-null int64 \n", " 44 season_winter 443 non-null int64 \n", " 45 season_all 443 non-null int64 \n", "dtypes: float64(4), int64(40), str(2)\n", "memory usage: 159.3 KB\n" ] } ], "source": [ "df.info()" ] }, { "cell_type": "code", "execution_count": 183, "id": "b5bb5f00", "metadata": {}, "outputs": [], "source": [ "df.rename(columns={\n", " 'Brand': 'brand',\n", " 'Name': 'name',\n", " 'plate_rock_plate': 'plate_rock',\n", " 'plate_carbon_plate': 'plate_carbon'}, inplace=True)" ] }, { "cell_type": "code", "execution_count": 184, "id": "a88f5ca3", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " plate_0 plate_rock plate_carbon\n", "0 1 0 0\n", "1 1 0 0\n", "2 1 0 0\n", "3 1 0 0\n", "4 1 0 0\n", ".. ... ... ...\n", "95 0 0 1\n", "96 0 0 1\n", "97 0 0 1\n", "98 0 0 1\n", "99 0 0 1\n", "\n", "[100 rows x 3 columns]\n" ] } ], "source": [ "print(df[[\"plate_0\", \"plate_rock\", \"plate_carbon\"]].head(100))" ] }, { "cell_type": "code", "execution_count": 185, "id": "5561d3b5", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 443 entries, 0 to 442\n", "Data columns (total 45 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 brand 443 non-null str \n", " 1 name 443 non-null str \n", " 2 Lightweight 443 non-null int64 \n", " 3 Rocker 443 non-null int64 \n", " 4 Orthotic friendly 443 non-null int64 \n", " 5 Removable insole 443 non-null int64 \n", " 6 pace_daily_running 443 non-null int64 \n", " 7 pace_tempo 443 non-null int64 \n", " 8 pace_competition 443 non-null int64 \n", " 9 arch_neutral 443 non-null int64 \n", " 10 arch_stability 443 non-null int64 \n", " 11 weight_lab_oz 443 non-null float64\n", " 12 drop_lab_mm 443 non-null float64\n", " 13 strike_heel 443 non-null int64 \n", " 14 strike_mid 443 non-null int64 \n", " 15 strike_forefoot 443 non-null int64 \n", " 16 softness_soft 443 non-null int64 \n", " 17 softness_balanced 443 non-null int64 \n", " 18 softness_firm 443 non-null int64 \n", " 19 toebox_durability 443 non-null int64 \n", " 20 heel_durability 443 non-null int64 \n", " 21 outsole_durability 443 non-null int64 \n", " 22 breathability 443 non-null int64 \n", " 23 width_narrow 443 non-null int64 \n", " 24 width_medium 443 non-null int64 \n", " 25 width_wide 443 non-null int64 \n", " 26 toebox_narrow 443 non-null int64 \n", " 27 toebox_medium 443 non-null int64 \n", " 28 toebox_wide 443 non-null int64 \n", " 29 stiffness_flexible 443 non-null int64 \n", " 30 stiffness_moderate 443 non-null int64 \n", " 31 stiffness_stiff 443 non-null int64 \n", " 32 torsional_flexible 443 non-null int64 \n", " 33 torsional_moderate 443 non-null int64 \n", " 34 torsional_stiff 443 non-null int64 \n", " 35 heel_stiff_flexible 443 non-null int64 \n", " 36 heel_stiff_moderate 443 non-null int64 \n", " 37 heel_stiff_stiff 443 non-null int64 \n", " 38 plate_rock 443 non-null int64 \n", " 39 plate_carbon 443 non-null int64 \n", " 40 heel_lab_mm 443 non-null float64\n", " 41 forefoot_lab_mm 443 non-null float64\n", " 42 season_summer 443 non-null int64 \n", " 43 season_winter 443 non-null int64 \n", " 44 season_all 443 non-null int64 \n", "dtypes: float64(4), int64(39), str(2)\n", "memory usage: 155.9 KB\n" ] } ], "source": [ "df.drop(columns=['plate_0'], inplace=True)\n", "df.info()" ] }, { "cell_type": "code", "execution_count": 186, "id": "11eb637c", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 443 entries, 0 to 442\n", "Data columns (total 45 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 brand 443 non-null str \n", " 1 name 443 non-null str \n", " 2 lightweight 443 non-null int64 \n", " 3 rocker 443 non-null int64 \n", " 4 orthotic_friendly 443 non-null int64 \n", " 5 removable_insole 443 non-null int64 \n", " 6 pace_daily_running 443 non-null int64 \n", " 7 pace_tempo 443 non-null int64 \n", " 8 pace_competition 443 non-null int64 \n", " 9 arch_neutral 443 non-null int64 \n", " 10 arch_stability 443 non-null int64 \n", " 11 weight_lab_oz 443 non-null float64\n", " 12 drop_lab_mm 443 non-null float64\n", " 13 strike_heel 443 non-null int64 \n", " 14 strike_mid 443 non-null int64 \n", " 15 strike_forefoot 443 non-null int64 \n", " 16 softness_soft 443 non-null int64 \n", " 17 softness_balanced 443 non-null int64 \n", " 18 softness_firm 443 non-null int64 \n", " 19 toebox_durability 443 non-null int64 \n", " 20 heel_durability 443 non-null int64 \n", " 21 outsole_durability 443 non-null int64 \n", " 22 breathability 443 non-null int64 \n", " 23 width_narrow 443 non-null int64 \n", " 24 width_medium 443 non-null int64 \n", " 25 width_wide 443 non-null int64 \n", " 26 toebox_narrow 443 non-null int64 \n", " 27 toebox_medium 443 non-null int64 \n", " 28 toebox_wide 443 non-null int64 \n", " 29 stiffness_flexible 443 non-null int64 \n", " 30 stiffness_moderate 443 non-null int64 \n", " 31 stiffness_stiff 443 non-null int64 \n", " 32 torsional_flexible 443 non-null int64 \n", " 33 torsional_moderate 443 non-null int64 \n", " 34 torsional_stiff 443 non-null int64 \n", " 35 heel_stiff_flexible 443 non-null int64 \n", " 36 heel_stiff_moderate 443 non-null int64 \n", " 37 heel_stiff_stiff 443 non-null int64 \n", " 38 plate_rock 443 non-null int64 \n", " 39 plate_carbon 443 non-null int64 \n", " 40 heel_lab_mm 443 non-null float64\n", " 41 forefoot_lab_mm 443 non-null float64\n", " 42 season_summer 443 non-null int64 \n", " 43 season_winter 443 non-null int64 \n", " 44 season_all 443 non-null int64 \n", "dtypes: float64(4), int64(39), str(2)\n", "memory usage: 155.9 KB\n" ] } ], "source": [ "df.rename(columns={\n", " 'Lightweight': 'lightweight',\n", " 'Removable insole': 'removable_insole',\n", " 'Orthotic friendly': 'orthotic_friendly',\n", " 'Rocker': 'rocker'}, inplace=True)\n", "df.info()" ] }, { "cell_type": "code", "execution_count": 187, "id": "decafa32", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
brandnamelightweightrockerorthotic_friendlyremovable_insolepace_daily_runningpace_tempopace_competitionarch_neutral...heel_stiff_flexibleheel_stiff_moderateheel_stiff_stiffplate_rockplate_carbonheel_lab_mmforefoot_lab_mmseason_summerseason_winterseason_all
0brookslaunch 910111101...1000032.423.0000
1brookslevitate 600111001...0100034.326.6101
2adidas4dfwd00111001...1000033.324.4001
3adidas4dfwd 200111001...0100031.821.2001
4adidas4dfwd 300111001...1000032.622.7001
\n", "

5 rows × 45 columns

\n", "
" ], "text/plain": [ " brand name lightweight rocker orthotic_friendly \\\n", "0 brooks launch 9 1 0 1 \n", "1 brooks levitate 6 0 0 1 \n", "2 adidas 4dfwd 0 0 1 \n", "3 adidas 4dfwd 2 0 0 1 \n", "4 adidas 4dfwd 3 0 0 1 \n", "\n", " removable_insole pace_daily_running pace_tempo pace_competition \\\n", "0 1 1 1 0 \n", "1 1 1 0 0 \n", "2 1 1 0 0 \n", "3 1 1 0 0 \n", "4 1 1 0 0 \n", "\n", " arch_neutral ... heel_stiff_flexible heel_stiff_moderate \\\n", "0 1 ... 1 0 \n", "1 1 ... 0 1 \n", "2 1 ... 1 0 \n", "3 1 ... 0 1 \n", "4 1 ... 1 0 \n", "\n", " heel_stiff_stiff plate_rock plate_carbon heel_lab_mm forefoot_lab_mm \\\n", "0 0 0 0 32.4 23.0 \n", "1 0 0 0 34.3 26.6 \n", "2 0 0 0 33.3 24.4 \n", "3 0 0 0 31.8 21.2 \n", "4 0 0 0 32.6 22.7 \n", "\n", " season_summer season_winter season_all \n", "0 0 0 0 \n", "1 1 0 1 \n", "2 0 0 1 \n", "3 0 0 1 \n", "4 0 0 1 \n", "\n", "[5 rows x 45 columns]" ] }, "execution_count": 187, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df.head()" ] }, { "cell_type": "code", "execution_count": 189, "id": "091429a9", "metadata": {}, "outputs": [], "source": [ "df.to_csv('../../data/road_dataset.csv', index=False)" ] } ], "metadata": { "kernelspec": { "display_name": "env", "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.13.11" } }, "nbformat": 4, "nbformat_minor": 5 }