{ "cells": [ { "cell_type": "code", "execution_count": 2, "id": "f5cc0f6b", "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", "
Brand-NameAudience scorePriceTrail terrainShock absorptionEnergy returnTractionArch supportWeight lab Weight brandLightweight...Heel stack lab Heel stack brandForefoot lab Forefoot brandWidths availableFor heavy runnersSeasonRemovable insoleOrthotic friendlyWaterproofingRankingPopularity
0Adidas Terrex Agravic Speed Ultra90 Great!$220LightModerateHigh-Neutral9.1 oz / 259g 9.5 oz / 270g0.0...30.6 mm 38.0 mm30.3 mm 30.0 mmNormal0.0All seasons11-#76 Top 21%#177 Top 47%
1Adidas Terrex Speed Ultra90 Great!3559500 RpLight---Neutral9.1 oz / 258g 9 oz / 255g0.0...32.8 mm 26.0 mm24.6 mm 18.0 mmNormal0.0-11-#49 Top 13%#298 Bottom 21%
2Altra Experience Wild88 Great!2966250 RpLight ModerateModerateLow-Neutral10.1 oz / 285g 9.6 oz / 273g0.0...34.5 mm 34.0 mm30.2 mm 30.0 mmNormal0.0All seasons11-#263 Top 40%#326 Top 49%
3Altra Experience Wild 284 Good!2966250 RpLightModerateLowHighNeutral9.4 oz / 266g 10.3 oz / 293g0.0...32.3 mm 32.0 mm26.2 mm 28.0 mmNormal0.0All seasons11-#245 Bottom 35%#154 Top 41%
4Altra Lone Peak 5.091 Superb!$130Light Moderate---Neutral10.7 oz / 302g 10.6 oz / 301g0.0...24.5 mm 25.0 mm24.3 mm 25.0 mmNormal0.0-11-#68 Top 11%#55 Top 9%
\n", "

5 rows × 36 columns

\n", "
" ], "text/plain": [ " Brand-Name Audience score Price \\\n", "0 Adidas Terrex Agravic Speed Ultra 90 Great! $220 \n", "1 Adidas Terrex Speed Ultra 90 Great! 3559500 Rp \n", "2 Altra Experience Wild 88 Great! 2966250 Rp \n", "3 Altra Experience Wild 2 84 Good! 2966250 Rp \n", "4 Altra Lone Peak 5.0 91 Superb! $130 \n", "\n", " Trail terrain Shock absorption Energy return Traction Arch support \\\n", "0 Light Moderate High - Neutral \n", "1 Light - - - Neutral \n", "2 Light Moderate Moderate Low - Neutral \n", "3 Light Moderate Low High Neutral \n", "4 Light Moderate - - - Neutral \n", "\n", " Weight lab Weight brand Lightweight ... \\\n", "0 9.1 oz / 259g 9.5 oz / 270g 0.0 ... \n", "1 9.1 oz / 258g 9 oz / 255g 0.0 ... \n", "2 10.1 oz / 285g 9.6 oz / 273g 0.0 ... \n", "3 9.4 oz / 266g 10.3 oz / 293g 0.0 ... \n", "4 10.7 oz / 302g 10.6 oz / 301g 0.0 ... \n", "\n", " Heel stack lab Heel stack brand Forefoot lab Forefoot brand \\\n", "0 30.6 mm 38.0 mm 30.3 mm 30.0 mm \n", "1 32.8 mm 26.0 mm 24.6 mm 18.0 mm \n", "2 34.5 mm 34.0 mm 30.2 mm 30.0 mm \n", "3 32.3 mm 32.0 mm 26.2 mm 28.0 mm \n", "4 24.5 mm 25.0 mm 24.3 mm 25.0 mm \n", "\n", " Widths available For heavy runners Season Removable insole \\\n", "0 Normal 0.0 All seasons 1 \n", "1 Normal 0.0 - 1 \n", "2 Normal 0.0 All seasons 1 \n", "3 Normal 0.0 All seasons 1 \n", "4 Normal 0.0 - 1 \n", "\n", " Orthotic friendly Waterproofing Ranking Popularity \n", "0 1 - #76 Top 21% #177 Top 47% \n", "1 1 - #49 Top 13% #298 Bottom 21% \n", "2 1 - #263 Top 40% #326 Top 49% \n", "3 1 - #245 Bottom 35% #154 Top 41% \n", "4 1 - #68 Top 11% #55 Top 9% \n", "\n", "[5 rows x 36 columns]" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import pandas as pd\n", "\n", "df_ori = pd.read_csv('../../data/SONIX utilities - Trail.csv')\n", "df_ori.head()" ] }, { "cell_type": "code", "execution_count": 3, "id": "eda2f776", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 183 entries, 0 to 182\n", "Data columns (total 36 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 Brand-Name 183 non-null str \n", " 1 Audience score 181 non-null str \n", " 2 Price 183 non-null str \n", " 3 Trail terrain 183 non-null str \n", " 4 Shock absorption 183 non-null str \n", " 5 Energy return 183 non-null str \n", " 6 Traction 178 non-null str \n", " 7 Arch support 183 non-null str \n", " 8 Weight lab Weight brand 183 non-null str \n", " 9 Lightweight 176 non-null float64\n", " 10 Drop lab Drop brand 183 non-null str \n", " 11 Strike pattern 183 non-null str \n", " 12 Size 183 non-null str \n", " 13 Midsole softness 183 non-null str \n", " 14 Difference in midsole softness in cold 183 non-null str \n", " 15 Plate 183 non-null str \n", " 16 Toebox durability 183 non-null str \n", " 17 Heel padding durability 183 non-null str \n", " 18 Outsole durability 183 non-null str \n", " 19 Breathability 183 non-null str \n", " 20 Width / fit 183 non-null str \n", " 21 Toebox width 183 non-null str \n", " 22 Stiffness 183 non-null str \n", " 23 Torsional rigidity 183 non-null str \n", " 24 Heel counter stiffness 183 non-null str \n", " 25 Lug depth 183 non-null str \n", " 26 Heel stack lab Heel stack brand 183 non-null str \n", " 27 Forefoot lab Forefoot brand 183 non-null str \n", " 28 Widths available 183 non-null str \n", " 29 For heavy runners 179 non-null float64\n", " 30 Season 183 non-null str \n", " 31 Removable insole 183 non-null int64 \n", " 32 Orthotic friendly 183 non-null int64 \n", " 33 Waterproofing 175 non-null str \n", " 34 Ranking 183 non-null str \n", " 35 Popularity 183 non-null str \n", "dtypes: float64(2), int64(2), str(32)\n", "memory usage: 51.6 KB\n" ] } ], "source": [ "df_ori.info()" ] }, { "cell_type": "markdown", "id": "3e53b33d", "metadata": {}, "source": [ "# Pre-EDA" ] }, { "cell_type": "code", "execution_count": 4, "id": "6791d8a5", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 183 entries, 0 to 182\n", "Data columns (total 28 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 Brand-Name 183 non-null str \n", " 1 Trail terrain 183 non-null str \n", " 2 Shock absorption 183 non-null str \n", " 3 Energy return 183 non-null str \n", " 4 Traction 178 non-null str \n", " 5 Arch support 183 non-null str \n", " 6 Weight lab Weight brand 183 non-null str \n", " 7 Lightweight 176 non-null float64\n", " 8 Drop lab Drop brand 183 non-null str \n", " 9 Strike pattern 183 non-null str \n", " 10 Midsole softness 183 non-null str \n", " 11 Plate 183 non-null str \n", " 12 Toebox durability 183 non-null str \n", " 13 Heel padding durability 183 non-null str \n", " 14 Outsole durability 183 non-null str \n", " 15 Breathability 183 non-null str \n", " 16 Width / fit 183 non-null str \n", " 17 Toebox width 183 non-null str \n", " 18 Stiffness 183 non-null str \n", " 19 Torsional rigidity 183 non-null str \n", " 20 Heel counter stiffness 183 non-null str \n", " 21 Lug depth 183 non-null str \n", " 22 Heel stack lab Heel stack brand 183 non-null str \n", " 23 Forefoot lab Forefoot brand 183 non-null str \n", " 24 Season 183 non-null str \n", " 25 Removable insole 183 non-null int64 \n", " 26 Orthotic friendly 183 non-null int64 \n", " 27 Waterproofing 175 non-null str \n", "dtypes: float64(1), int64(2), str(25)\n", "memory usage: 40.2 KB\n" ] } ], "source": [ "df_ori.drop(columns=['Audience score', 'Size', 'Price', 'Widths available', 'Difference in midsole softness in cold', 'For heavy runners', 'Ranking', 'Popularity'], inplace=True)\n", "df_ori.info()" ] }, { "cell_type": "code", "execution_count": 5, "id": "a240381d", "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", "
brand-nametrail terrainshock absorptionenergy returntractionarch supportweight lab weight brandlightweightdrop lab drop brandstrike pattern...stiffnesstorsional rigidityheel counter stiffnesslug depthheel stack lab heel stack brandforefoot lab forefoot brandseasonremovable insoleorthotic friendlywaterproofing
0adidas terrex agravic speed ultralightmoderatehigh-neutral9.1 oz / 259g 9.5 oz / 270g0.00.3 mm 8.0 mmmid/forefoot...moderatestiffflexible2.5 mm30.6 mm 38.0 mm30.3 mm 30.0 mmall seasons11-
1adidas terrex speed ultralight---neutral9.1 oz / 258g 9 oz / 255g0.08.2 mm 8.0 mmheel mid/forefoot...stiffflexibleflexible2.6 mm32.8 mm 26.0 mm24.6 mm 18.0 mm-11-
2altra experience wildlight moderatemoderatelow-neutral10.1 oz / 285g 9.6 oz / 273g0.04.3 mm 4.0 mmmid/forefoot...moderatestiffmoderate3.6 mm34.5 mm 34.0 mm30.2 mm 30.0 mmall seasons11-
3altra experience wild 2lightmoderatelowhighneutral9.4 oz / 266g 10.3 oz / 293g0.06.1 mm 4.0 mmmid/forefoot...moderatemoderateflexible3.5 mm32.3 mm 32.0 mm26.2 mm 28.0 mmall seasons11-
4altra lone peak 5.0light moderate---neutral10.7 oz / 302g 10.6 oz / 301g0.00.2 mm 0.0 mmmid/forefoot...stiffflexible-3.7 mm24.5 mm 25.0 mm24.3 mm 25.0 mm-11-
\n", "

5 rows × 28 columns

\n", "
" ], "text/plain": [ " brand-name trail terrain shock absorption \\\n", "0 adidas terrex agravic speed ultra light moderate \n", "1 adidas terrex speed ultra light - \n", "2 altra experience wild light moderate moderate \n", "3 altra experience wild 2 light moderate \n", "4 altra lone peak 5.0 light moderate - \n", "\n", " energy return traction arch support weight lab weight brand \\\n", "0 high - neutral 9.1 oz / 259g 9.5 oz / 270g \n", "1 - - neutral 9.1 oz / 258g 9 oz / 255g \n", "2 low - neutral 10.1 oz / 285g 9.6 oz / 273g \n", "3 low high neutral 9.4 oz / 266g 10.3 oz / 293g \n", "4 - - neutral 10.7 oz / 302g 10.6 oz / 301g \n", "\n", " lightweight drop lab drop brand strike pattern ... stiffness \\\n", "0 0.0 0.3 mm 8.0 mm mid/forefoot ... moderate \n", "1 0.0 8.2 mm 8.0 mm heel mid/forefoot ... stiff \n", "2 0.0 4.3 mm 4.0 mm mid/forefoot ... moderate \n", "3 0.0 6.1 mm 4.0 mm mid/forefoot ... moderate \n", "4 0.0 0.2 mm 0.0 mm mid/forefoot ... stiff \n", "\n", " torsional rigidity heel counter stiffness lug depth \\\n", "0 stiff flexible 2.5 mm \n", "1 flexible flexible 2.6 mm \n", "2 stiff moderate 3.6 mm \n", "3 moderate flexible 3.5 mm \n", "4 flexible - 3.7 mm \n", "\n", " heel stack lab heel stack brand forefoot lab forefoot brand season \\\n", "0 30.6 mm 38.0 mm 30.3 mm 30.0 mm all seasons \n", "1 32.8 mm 26.0 mm 24.6 mm 18.0 mm - \n", "2 34.5 mm 34.0 mm 30.2 mm 30.0 mm all seasons \n", "3 32.3 mm 32.0 mm 26.2 mm 28.0 mm all seasons \n", "4 24.5 mm 25.0 mm 24.3 mm 25.0 mm - \n", "\n", " removable insole orthotic friendly waterproofing \n", "0 1 1 - \n", "1 1 1 - \n", "2 1 1 - \n", "3 1 1 - \n", "4 1 1 - \n", "\n", "[5 rows x 28 columns]" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# convert all to lowercase\n", "\n", "df_ori.columns = df_ori.columns.str.strip().str.lower()\n", "df_ori = df_ori.map(lambda x: x.strip().lower() if isinstance(x, str) else x)\n", "\n", "df_ori.head()" ] }, { "cell_type": "markdown", "id": "ccddc8ad", "metadata": {}, "source": [ "## Separate Brand-Name" ] }, { "cell_type": "code", "execution_count": 6, "id": "0bebd201", "metadata": {}, "outputs": [], "source": [ "''' \n", "Running shoes for trail brand in our dataset include:\n", " Adidas\n", " Altra\n", " ASICS\n", " Brooks\n", " HOKA\n", " Icebug\n", " Inov8\n", " Kailas\n", " KEEN\n", " La Sportiva\n", " Merrell\n", " New Balance\n", " Nike\n", " NNormal\n", " On\n", " Salomon\n", " Saucony\n", " Topo\n", " Xero\n", " Scarpa\n", " The North Face\n", "'''\n", "\n", "brands_list = [\n", " \"Adidas\", \"Altra\", \"ASICS\", \"Brooks\", \"HOKA\", \"Icebug\", \"Inov8\", \n", " \"Kailas\", \"KEEN\", \"La Sportiva\", \"Merrell\", \"New Balance\", \"Nike\", \n", " \"NNormal\", \"On\", \"Salomon\", \"Saucony\", \"Topo\", \"Xero\", \"Scarpa\", \n", " \"The North Face\"\n", "]\n", "brands = [b.lower() for b in brands_list]\n", "brands.sort(key=len, reverse=True)" ] }, { "cell_type": "code", "execution_count": 7, "id": "3a304c3d", "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", "
brandnametrail terrainshock absorptionenergy returntractionarch supportweight lab weight brandlightweightdrop lab drop brand...stiffnesstorsional rigidityheel counter stiffnesslug depthheel stack lab heel stack brandforefoot lab forefoot brandseasonremovable insoleorthotic friendlywaterproofing
0adidasterrex agravic speed ultralightmoderatehigh-neutral9.1 oz / 259g 9.5 oz / 270g0.00.3 mm 8.0 mm...moderatestiffflexible2.5 mm30.6 mm 38.0 mm30.3 mm 30.0 mmall seasons11-
1adidasterrex speed ultralight---neutral9.1 oz / 258g 9 oz / 255g0.08.2 mm 8.0 mm...stiffflexibleflexible2.6 mm32.8 mm 26.0 mm24.6 mm 18.0 mm-11-
2altraexperience wildlight moderatemoderatelow-neutral10.1 oz / 285g 9.6 oz / 273g0.04.3 mm 4.0 mm...moderatestiffmoderate3.6 mm34.5 mm 34.0 mm30.2 mm 30.0 mmall seasons11-
3altraexperience wild 2lightmoderatelowhighneutral9.4 oz / 266g 10.3 oz / 293g0.06.1 mm 4.0 mm...moderatemoderateflexible3.5 mm32.3 mm 32.0 mm26.2 mm 28.0 mmall seasons11-
4altralone peak 5.0light moderate---neutral10.7 oz / 302g 10.6 oz / 301g0.00.2 mm 0.0 mm...stiffflexible-3.7 mm24.5 mm 25.0 mm24.3 mm 25.0 mm-11-
\n", "

5 rows × 29 columns

\n", "
" ], "text/plain": [ " brand name trail terrain shock absorption \\\n", "0 adidas terrex agravic speed ultra light moderate \n", "1 adidas terrex speed ultra light - \n", "2 altra experience wild light moderate moderate \n", "3 altra experience wild 2 light moderate \n", "4 altra lone peak 5.0 light moderate - \n", "\n", " energy return traction arch support weight lab weight brand \\\n", "0 high - neutral 9.1 oz / 259g 9.5 oz / 270g \n", "1 - - neutral 9.1 oz / 258g 9 oz / 255g \n", "2 low - neutral 10.1 oz / 285g 9.6 oz / 273g \n", "3 low high neutral 9.4 oz / 266g 10.3 oz / 293g \n", "4 - - neutral 10.7 oz / 302g 10.6 oz / 301g \n", "\n", " lightweight drop lab drop brand ... stiffness torsional rigidity \\\n", "0 0.0 0.3 mm 8.0 mm ... moderate stiff \n", "1 0.0 8.2 mm 8.0 mm ... stiff flexible \n", "2 0.0 4.3 mm 4.0 mm ... moderate stiff \n", "3 0.0 6.1 mm 4.0 mm ... moderate moderate \n", "4 0.0 0.2 mm 0.0 mm ... stiff flexible \n", "\n", " heel counter stiffness lug depth heel stack lab heel stack brand \\\n", "0 flexible 2.5 mm 30.6 mm 38.0 mm \n", "1 flexible 2.6 mm 32.8 mm 26.0 mm \n", "2 moderate 3.6 mm 34.5 mm 34.0 mm \n", "3 flexible 3.5 mm 32.3 mm 32.0 mm \n", "4 - 3.7 mm 24.5 mm 25.0 mm \n", "\n", " forefoot lab forefoot brand season removable insole orthotic friendly \\\n", "0 30.3 mm 30.0 mm all seasons 1 1 \n", "1 24.6 mm 18.0 mm - 1 1 \n", "2 30.2 mm 30.0 mm all seasons 1 1 \n", "3 26.2 mm 28.0 mm all seasons 1 1 \n", "4 24.3 mm 25.0 mm - 1 1 \n", "\n", " waterproofing \n", "0 - \n", "1 - \n", "2 - \n", "3 - \n", "4 - \n", "\n", "[5 rows x 29 columns]" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "def split_brand_name(full_text):\n", " for brand in brands:\n", " if full_text.startswith(brand):\n", " # Sisa dari brand dijadiin name semua\n", " name = full_text[len(brand):].strip()\n", " return brand, name\n", " return \"Unknown\", full_text \n", "\n", "\n", "df_ori[['brand', 'name']] = df_ori['brand-name'].apply(lambda x: pd.Series(split_brand_name(x)))\n", "\n", "# Atur urutan kolom agar brand dan name tetap ada di depan\n", "cols = ['brand', 'name'] + [c for c in df_ori.columns if c not in ['brand', 'name', 'brand-name']]\n", "df_ori = df_ori[cols]\n", "\n", "df_ori.head()" ] }, { "cell_type": "code", "execution_count": 8, "id": "d7d61ef1", "metadata": {}, "outputs": [], "source": [ "# df_ori.head(40)" ] }, { "cell_type": "markdown", "id": "209d339d", "metadata": {}, "source": [ "## Remove Duplicates" ] }, { "cell_type": "code", "execution_count": 9, "id": "498021b3", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "183\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", "
brandname
52hokamafate x
66inov8trailfly
83la sportivaprodigio
84la sportivaprodigio
124niketerra kiger 9
137oncloudsurfer trail 2
141oncloudvista 2
180topoultraventure 4
\n", "
" ], "text/plain": [ " brand name\n", "52 hoka mafate x\n", "66 inov8 trailfly\n", "83 la sportiva prodigio\n", "84 la sportiva prodigio\n", "124 nike terra kiger 9\n", "137 on cloudsurfer trail 2\n", "141 on cloudvista 2\n", "180 topo ultraventure 4" ] }, "execution_count": 9, "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": 10, "id": "0f107030", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Before: 183\n", "After : 175\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", "
brandnametrail terrainshock absorptionenergy returntractionarch supportweight lab weight brandlightweightdrop lab drop brand...stiffnesstorsional rigidityheel counter stiffnesslug depthheel stack lab heel stack brandforefoot lab forefoot brandseasonremovable insoleorthotic friendlywaterproofing
0adidasterrex agravic speed ultralightmoderatehigh-neutral9.1 oz / 259g 9.5 oz / 270g0.00.3 mm 8.0 mm...moderatestiffflexible2.5 mm30.6 mm 38.0 mm30.3 mm 30.0 mmall seasons11-
1adidasterrex speed ultralight---neutral9.1 oz / 258g 9 oz / 255g0.08.2 mm 8.0 mm...stiffflexibleflexible2.6 mm32.8 mm 26.0 mm24.6 mm 18.0 mm-11-
2altraexperience wildlight moderatemoderatelow-neutral10.1 oz / 285g 9.6 oz / 273g0.04.3 mm 4.0 mm...moderatestiffmoderate3.6 mm34.5 mm 34.0 mm30.2 mm 30.0 mmall seasons11-
3altraexperience wild 2lightmoderatelowhighneutral9.4 oz / 266g 10.3 oz / 293g0.06.1 mm 4.0 mm...moderatemoderateflexible3.5 mm32.3 mm 32.0 mm26.2 mm 28.0 mmall seasons11-
4altralone peak 5.0light moderate---neutral10.7 oz / 302g 10.6 oz / 301g0.00.2 mm 0.0 mm...stiffflexible-3.7 mm24.5 mm 25.0 mm24.3 mm 25.0 mm-11-
\n", "

5 rows × 29 columns

\n", "
" ], "text/plain": [ " brand name trail terrain shock absorption \\\n", "0 adidas terrex agravic speed ultra light moderate \n", "1 adidas terrex speed ultra light - \n", "2 altra experience wild light moderate moderate \n", "3 altra experience wild 2 light moderate \n", "4 altra lone peak 5.0 light moderate - \n", "\n", " energy return traction arch support weight lab weight brand \\\n", "0 high - neutral 9.1 oz / 259g 9.5 oz / 270g \n", "1 - - neutral 9.1 oz / 258g 9 oz / 255g \n", "2 low - neutral 10.1 oz / 285g 9.6 oz / 273g \n", "3 low high neutral 9.4 oz / 266g 10.3 oz / 293g \n", "4 - - neutral 10.7 oz / 302g 10.6 oz / 301g \n", "\n", " lightweight drop lab drop brand ... stiffness torsional rigidity \\\n", "0 0.0 0.3 mm 8.0 mm ... moderate stiff \n", "1 0.0 8.2 mm 8.0 mm ... stiff flexible \n", "2 0.0 4.3 mm 4.0 mm ... moderate stiff \n", "3 0.0 6.1 mm 4.0 mm ... moderate moderate \n", "4 0.0 0.2 mm 0.0 mm ... stiff flexible \n", "\n", " heel counter stiffness lug depth heel stack lab heel stack brand \\\n", "0 flexible 2.5 mm 30.6 mm 38.0 mm \n", "1 flexible 2.6 mm 32.8 mm 26.0 mm \n", "2 moderate 3.6 mm 34.5 mm 34.0 mm \n", "3 flexible 3.5 mm 32.3 mm 32.0 mm \n", "4 - 3.7 mm 24.5 mm 25.0 mm \n", "\n", " forefoot lab forefoot brand season removable insole orthotic friendly \\\n", "0 30.3 mm 30.0 mm all seasons 1 1 \n", "1 24.6 mm 18.0 mm - 1 1 \n", "2 30.2 mm 30.0 mm all seasons 1 1 \n", "3 26.2 mm 28.0 mm all seasons 1 1 \n", "4 24.3 mm 25.0 mm - 1 1 \n", "\n", " waterproofing \n", "0 - \n", "1 - \n", "2 - \n", "3 - \n", "4 - \n", "\n", "[5 rows x 29 columns]" ] }, "execution_count": 10, "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()" ] }, { "cell_type": "code", "execution_count": 11, "id": "3e3d8e69", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Ditemukan 0 baris yang memiliki spesifikasi identik.\n", "\n", "Empty DataFrame\n", "Columns: [brand, name, trail terrain, shock absorption, energy return]\n", "Index: []\n" ] } ], "source": [ "# Searching for duplicate technical specifications\n", "tech_columns = df_ori.columns[2:].tolist()\n", "duplicates = df_ori[df_ori.duplicated(subset=tech_columns, keep=False)]\n", "\n", "duplicates_sorted = duplicates.sort_values(by=tech_columns[:3])\n", "\n", "print(f\"Ditemukan {len(duplicates_sorted)} baris yang memiliki spesifikasi identik.\\n\")\n", "print(duplicates_sorted[['brand', 'name'] + tech_columns[:3]].head(30))" ] }, { "cell_type": "code", "execution_count": 12, "id": "8ec3d162", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Before: 175\n", "After : 175\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", "
brandnametrail terrainshock absorptionenergy returntractionarch supportweight lab weight brandlightweightdrop lab drop brand...stiffnesstorsional rigidityheel counter stiffnesslug depthheel stack lab heel stack brandforefoot lab forefoot brandseasonremovable insoleorthotic friendlywaterproofing
0adidasterrex agravic speed ultralightmoderatehigh-neutral9.1 oz / 259g 9.5 oz / 270g0.00.3 mm 8.0 mm...moderatestiffflexible2.5 mm30.6 mm 38.0 mm30.3 mm 30.0 mmall seasons11-
1adidasterrex speed ultralight---neutral9.1 oz / 258g 9 oz / 255g0.08.2 mm 8.0 mm...stiffflexibleflexible2.6 mm32.8 mm 26.0 mm24.6 mm 18.0 mm-11-
2altraexperience wildlight moderatemoderatelow-neutral10.1 oz / 285g 9.6 oz / 273g0.04.3 mm 4.0 mm...moderatestiffmoderate3.6 mm34.5 mm 34.0 mm30.2 mm 30.0 mmall seasons11-
3altraexperience wild 2lightmoderatelowhighneutral9.4 oz / 266g 10.3 oz / 293g0.06.1 mm 4.0 mm...moderatemoderateflexible3.5 mm32.3 mm 32.0 mm26.2 mm 28.0 mmall seasons11-
4altralone peak 5.0light moderate---neutral10.7 oz / 302g 10.6 oz / 301g0.00.2 mm 0.0 mm...stiffflexible-3.7 mm24.5 mm 25.0 mm24.3 mm 25.0 mm-11-
\n", "

5 rows × 29 columns

\n", "
" ], "text/plain": [ " brand name trail terrain shock absorption \\\n", "0 adidas terrex agravic speed ultra light moderate \n", "1 adidas terrex speed ultra light - \n", "2 altra experience wild light moderate moderate \n", "3 altra experience wild 2 light moderate \n", "4 altra lone peak 5.0 light moderate - \n", "\n", " energy return traction arch support weight lab weight brand \\\n", "0 high - neutral 9.1 oz / 259g 9.5 oz / 270g \n", "1 - - neutral 9.1 oz / 258g 9 oz / 255g \n", "2 low - neutral 10.1 oz / 285g 9.6 oz / 273g \n", "3 low high neutral 9.4 oz / 266g 10.3 oz / 293g \n", "4 - - neutral 10.7 oz / 302g 10.6 oz / 301g \n", "\n", " lightweight drop lab drop brand ... stiffness torsional rigidity \\\n", "0 0.0 0.3 mm 8.0 mm ... moderate stiff \n", "1 0.0 8.2 mm 8.0 mm ... stiff flexible \n", "2 0.0 4.3 mm 4.0 mm ... moderate stiff \n", "3 0.0 6.1 mm 4.0 mm ... moderate moderate \n", "4 0.0 0.2 mm 0.0 mm ... stiff flexible \n", "\n", " heel counter stiffness lug depth heel stack lab heel stack brand \\\n", "0 flexible 2.5 mm 30.6 mm 38.0 mm \n", "1 flexible 2.6 mm 32.8 mm 26.0 mm \n", "2 moderate 3.6 mm 34.5 mm 34.0 mm \n", "3 flexible 3.5 mm 32.3 mm 32.0 mm \n", "4 - 3.7 mm 24.5 mm 25.0 mm \n", "\n", " forefoot lab forefoot brand season removable insole orthotic friendly \\\n", "0 30.3 mm 30.0 mm all seasons 1 1 \n", "1 24.6 mm 18.0 mm - 1 1 \n", "2 30.2 mm 30.0 mm all seasons 1 1 \n", "3 26.2 mm 28.0 mm all seasons 1 1 \n", "4 24.3 mm 25.0 mm - 1 1 \n", "\n", " waterproofing \n", "0 - \n", "1 - \n", "2 - \n", "3 - \n", "4 - \n", "\n", "[5 rows x 29 columns]" ] }, "execution_count": 12, "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=tech_columns, keep='first').copy()\n", "\n", "print(\"After :\", len(df_ori))\n", "df_ori.head()" ] }, { "cell_type": "code", "execution_count": 13, "id": "8f770d4b", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 175 entries, 0 to 174\n", "Data columns (total 29 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 brand 175 non-null str \n", " 1 name 175 non-null str \n", " 2 trail terrain 175 non-null str \n", " 3 shock absorption 175 non-null str \n", " 4 energy return 175 non-null str \n", " 5 traction 170 non-null str \n", " 6 arch support 175 non-null str \n", " 7 weight lab weight brand 175 non-null str \n", " 8 lightweight 168 non-null float64\n", " 9 drop lab drop brand 175 non-null str \n", " 10 strike pattern 175 non-null str \n", " 11 midsole softness 175 non-null str \n", " 12 plate 175 non-null str \n", " 13 toebox durability 175 non-null str \n", " 14 heel padding durability 175 non-null str \n", " 15 outsole durability 175 non-null str \n", " 16 breathability 175 non-null str \n", " 17 width / fit 175 non-null str \n", " 18 toebox width 175 non-null str \n", " 19 stiffness 175 non-null str \n", " 20 torsional rigidity 175 non-null str \n", " 21 heel counter stiffness 175 non-null str \n", " 22 lug depth 175 non-null str \n", " 23 heel stack lab heel stack brand 175 non-null str \n", " 24 forefoot lab forefoot brand 175 non-null str \n", " 25 season 175 non-null str \n", " 26 removable insole 175 non-null int64 \n", " 27 orthotic friendly 175 non-null int64 \n", " 28 waterproofing 169 non-null str \n", "dtypes: float64(1), int64(2), str(26)\n", "memory usage: 39.8 KB\n" ] } ], "source": [ "df_ori.info()" ] }, { "cell_type": "markdown", "id": "983f5eed", "metadata": {}, "source": [ "# EDA" ] }, { "cell_type": "code", "execution_count": null, "id": "1023bc2a", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "id": "bd2cfc21", "metadata": {}, "source": [ "# Preprocessing\n", "\n", "In this stage we will encode, scale, and bin the data." ] }, { "cell_type": "code", "execution_count": 14, "id": "9f966e10", "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", "
brandnametrail terrainshock absorptionenergy returntractionarch supportweight lab weight brandlightweightdrop lab drop brand...stiffnesstorsional rigidityheel counter stiffnesslug depthheel stack lab heel stack brandforefoot lab forefoot brandseasonremovable insoleorthotic friendlywaterproofing
0adidasterrex agravic speed ultralightmoderatehigh-neutral9.1 oz / 259g 9.5 oz / 270g0.00.3 mm 8.0 mm...moderatestiffflexible2.5 mm30.6 mm 38.0 mm30.3 mm 30.0 mmall seasons11-
1adidasterrex speed ultralight---neutral9.1 oz / 258g 9 oz / 255g0.08.2 mm 8.0 mm...stiffflexibleflexible2.6 mm32.8 mm 26.0 mm24.6 mm 18.0 mm-11-
2altraexperience wildlight moderatemoderatelow-neutral10.1 oz / 285g 9.6 oz / 273g0.04.3 mm 4.0 mm...moderatestiffmoderate3.6 mm34.5 mm 34.0 mm30.2 mm 30.0 mmall seasons11-
3altraexperience wild 2lightmoderatelowhighneutral9.4 oz / 266g 10.3 oz / 293g0.06.1 mm 4.0 mm...moderatemoderateflexible3.5 mm32.3 mm 32.0 mm26.2 mm 28.0 mmall seasons11-
4altralone peak 5.0light moderate---neutral10.7 oz / 302g 10.6 oz / 301g0.00.2 mm 0.0 mm...stiffflexible-3.7 mm24.5 mm 25.0 mm24.3 mm 25.0 mm-11-
\n", "

5 rows × 29 columns

\n", "
" ], "text/plain": [ " brand name trail terrain shock absorption \\\n", "0 adidas terrex agravic speed ultra light moderate \n", "1 adidas terrex speed ultra light - \n", "2 altra experience wild light moderate moderate \n", "3 altra experience wild 2 light moderate \n", "4 altra lone peak 5.0 light moderate - \n", "\n", " energy return traction arch support weight lab weight brand \\\n", "0 high - neutral 9.1 oz / 259g 9.5 oz / 270g \n", "1 - - neutral 9.1 oz / 258g 9 oz / 255g \n", "2 low - neutral 10.1 oz / 285g 9.6 oz / 273g \n", "3 low high neutral 9.4 oz / 266g 10.3 oz / 293g \n", "4 - - neutral 10.7 oz / 302g 10.6 oz / 301g \n", "\n", " lightweight drop lab drop brand ... stiffness torsional rigidity \\\n", "0 0.0 0.3 mm 8.0 mm ... moderate stiff \n", "1 0.0 8.2 mm 8.0 mm ... stiff flexible \n", "2 0.0 4.3 mm 4.0 mm ... moderate stiff \n", "3 0.0 6.1 mm 4.0 mm ... moderate moderate \n", "4 0.0 0.2 mm 0.0 mm ... stiff flexible \n", "\n", " heel counter stiffness lug depth heel stack lab heel stack brand \\\n", "0 flexible 2.5 mm 30.6 mm 38.0 mm \n", "1 flexible 2.6 mm 32.8 mm 26.0 mm \n", "2 moderate 3.6 mm 34.5 mm 34.0 mm \n", "3 flexible 3.5 mm 32.3 mm 32.0 mm \n", "4 - 3.7 mm 24.5 mm 25.0 mm \n", "\n", " forefoot lab forefoot brand season removable insole orthotic friendly \\\n", "0 30.3 mm 30.0 mm all seasons 1 1 \n", "1 24.6 mm 18.0 mm - 1 1 \n", "2 30.2 mm 30.0 mm all seasons 1 1 \n", "3 26.2 mm 28.0 mm all seasons 1 1 \n", "4 24.3 mm 25.0 mm - 1 1 \n", "\n", " waterproofing \n", "0 - \n", "1 - \n", "2 - \n", "3 - \n", "4 - \n", "\n", "[5 rows x 29 columns]" ] }, "execution_count": 14, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df = df_ori.copy()\n", "df.head()" ] }, { "cell_type": "markdown", "id": "c5729690", "metadata": {}, "source": [ "## Trail terrain" ] }, { "cell_type": "code", "execution_count": 15, "id": "351d019a", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "trail terrain\n", "light moderate 54\n", "light 48\n", "moderate technical 21\n", "moderate 19\n", "- 17\n", "technical 11\n", "lightmoderate 3\n", "moderatetechnical 2\n", "Name: count, dtype: int64\n" ] } ], "source": [ "print(df['trail terrain'].value_counts())" ] }, { "cell_type": "code", "execution_count": 16, "id": "1370c40c", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "trail terrain\n", "light moderate 54\n", "light 48\n", "moderate technical 21\n", "moderate 19\n", "technical 11\n", "lightmoderate 3\n", "moderatetechnical 2\n", "Name: count, dtype: int64\n" ] } ], "source": [ "df = df[df['trail terrain'] != \"-\"].reset_index(drop=True)\n", "print(df['trail terrain'].value_counts())" ] }, { "cell_type": "code", "execution_count": 17, "id": "d67f4175", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Rows after cleaning: 158\n", "\n", "Unique Values in original column (before drop):\n", "\n", "[ 'light', 'light moderate', 'moderate technical',\n", " 'moderate', 'moderatetechnical', 'technical',\n", " 'lightmoderate']\n", "Length: 7, dtype: str\n", "\n", "Sample Comparison (Multi-value Mapping):\n", " trail terrain terrain_light terrain_moderate terrain_technical\n", "0 light 1 0 0\n", "1 light 1 0 0\n", "2 light moderate 1 1 0\n", "3 light 1 0 0\n", "4 light moderate 1 1 0\n", "5 moderate technical 0 1 1\n", "6 moderate 0 1 0\n", "7 light moderate 1 1 0\n", "8 light moderate 1 1 0\n", "9 light moderate 1 1 0\n" ] } ], "source": [ "# Naming convention: all lowercase\n", "df['trail terrain'] = df['trail terrain'].astype(str).str.lower()\n", "base_terrains = ['light', 'moderate', 'technical']\n", "\n", "for terrain in base_terrains:\n", " column_name = f\"terrain_{terrain}\"\n", " df[column_name] = df['trail terrain'].str.contains(terrain).astype(int)\n", "\n", "print(\"Rows after cleaning:\", len(df))\n", "\n", "print(\"\\nUnique Values in original column (before drop):\")\n", "print(df[\"trail terrain\"].unique())\n", "\n", "print(\"\\nSample Comparison (Multi-value Mapping):\")\n", "check_cols = [\"trail terrain\"] + [f\"terrain_{t}\" for t in base_terrains]\n", "print(df[check_cols].head(10))" ] }, { "cell_type": "code", "execution_count": 18, "id": "66775876", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "trail terrain\n", "light moderate 54\n", "light 48\n", "moderate technical 21\n", "moderate 19\n", "technical 11\n", "lightmoderate 3\n", "moderatetechnical 2\n", "Name: count, dtype: int64\n", "\n", "Sum of each terrain type:\n", "terrain_light sum: 105\n", "terrain_moderate sum: 99\n", "terrain_technical sum: 34\n", "\n", " trail terrain terrain_light terrain_moderate terrain_technical\n", "0 light 1 0 0\n", "1 light 1 0 0\n", "2 light moderate 1 1 0\n", "3 light 1 0 0\n", "4 light moderate 1 1 0\n" ] } ], "source": [ "print(df['trail terrain'].value_counts())\n", "\n", "print(\"\\nSum of each terrain type:\")\n", "for terrain in base_terrains:\n", " col = f\"terrain_{terrain}\"\n", " print(f\"{col} sum:\", int(df[col].sum()))\n", "\n", "print()\n", "print(df[['trail terrain', 'terrain_light', 'terrain_moderate', 'terrain_technical']].head())" ] }, { "cell_type": "code", "execution_count": 19, "id": "8b78d616", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 158 entries, 0 to 157\n", "Data columns (total 31 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 brand 158 non-null str \n", " 1 name 158 non-null str \n", " 2 shock absorption 158 non-null str \n", " 3 energy return 158 non-null str \n", " 4 traction 153 non-null str \n", " 5 arch support 158 non-null str \n", " 6 weight lab weight brand 158 non-null str \n", " 7 lightweight 152 non-null float64\n", " 8 drop lab drop brand 158 non-null str \n", " 9 strike pattern 158 non-null str \n", " 10 midsole softness 158 non-null str \n", " 11 plate 158 non-null str \n", " 12 toebox durability 158 non-null str \n", " 13 heel padding durability 158 non-null str \n", " 14 outsole durability 158 non-null str \n", " 15 breathability 158 non-null str \n", " 16 width / fit 158 non-null str \n", " 17 toebox width 158 non-null str \n", " 18 stiffness 158 non-null str \n", " 19 torsional rigidity 158 non-null str \n", " 20 heel counter stiffness 158 non-null str \n", " 21 lug depth 158 non-null str \n", " 22 heel stack lab heel stack brand 158 non-null str \n", " 23 forefoot lab forefoot brand 158 non-null str \n", " 24 season 158 non-null str \n", " 25 removable insole 158 non-null int64 \n", " 26 orthotic friendly 158 non-null int64 \n", " 27 waterproofing 156 non-null str \n", " 28 terrain_light 158 non-null int64 \n", " 29 terrain_moderate 158 non-null int64 \n", " 30 terrain_technical 158 non-null int64 \n", "dtypes: float64(1), int64(5), str(25)\n", "memory usage: 38.4 KB\n" ] } ], "source": [ "df.drop('trail terrain', axis=1, inplace=True)\n", "df.info()" ] }, { "cell_type": "markdown", "id": "ee89a11f", "metadata": {}, "source": [ "## Shock absorption" ] }, { "cell_type": "code", "execution_count": 20, "id": "abd73756", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "shock absorption\n", "- 81\n", "moderate 45\n", "high 20\n", "low 12\n", "Name: count, dtype: int64\n" ] } ], "source": [ "# Checking null values first\n", "print(df['shock absorption'].value_counts())" ] }, { "cell_type": "code", "execution_count": 21, "id": "8ec1e95b", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "--- Value Counts Kolom Asli ---\n", "shock absorption\n", "- 81\n", "moderate 45\n", "high 20\n", "low 12\n", "Name: count, dtype: int64\n", "\n", "--- Ordinal encoding ---\n", "Index 0: 81 baris\n", "Index 1: 12 baris\n", "Index 2: 0 baris\n", "Index 3: 45 baris\n", "Index 4: 0 baris\n", "Index 5: 20 baris\n", "\n", "--- Perbandingan Data (Head) ---\n", " shock absorption shock_absorption\n", "0 moderate 3\n", "1 - 0\n", "2 moderate 3\n", "3 moderate 3\n", "4 - 0\n" ] } ], "source": [ "shock_scaled = {\n", " \"-\": 0,\n", " \"low\": 1,\n", " \"moderate\": 3,\n", " \"high\": 5\n", "}\n", "\n", "df['shock_absorption'] = df['shock absorption'].map(shock_scaled)\n", "\n", "print(\"--- Value Counts Kolom Asli ---\")\n", "print(df[\"shock absorption\"].value_counts())\n", "\n", "print(\"\\n--- Ordinal encoding ---\")\n", "counts = df[\"shock_absorption\"].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[[\"shock absorption\", \"shock_absorption\"]].head())" ] }, { "cell_type": "code", "execution_count": 22, "id": "857a652d", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 158 entries, 0 to 157\n", "Data columns (total 31 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 brand 158 non-null str \n", " 1 name 158 non-null str \n", " 2 energy return 158 non-null str \n", " 3 traction 153 non-null str \n", " 4 arch support 158 non-null str \n", " 5 weight lab weight brand 158 non-null str \n", " 6 lightweight 152 non-null float64\n", " 7 drop lab drop brand 158 non-null str \n", " 8 strike pattern 158 non-null str \n", " 9 midsole softness 158 non-null str \n", " 10 plate 158 non-null str \n", " 11 toebox durability 158 non-null str \n", " 12 heel padding durability 158 non-null str \n", " 13 outsole durability 158 non-null str \n", " 14 breathability 158 non-null str \n", " 15 width / fit 158 non-null str \n", " 16 toebox width 158 non-null str \n", " 17 stiffness 158 non-null str \n", " 18 torsional rigidity 158 non-null str \n", " 19 heel counter stiffness 158 non-null str \n", " 20 lug depth 158 non-null str \n", " 21 heel stack lab heel stack brand 158 non-null str \n", " 22 forefoot lab forefoot brand 158 non-null str \n", " 23 season 158 non-null str \n", " 24 removable insole 158 non-null int64 \n", " 25 orthotic friendly 158 non-null int64 \n", " 26 waterproofing 156 non-null str \n", " 27 terrain_light 158 non-null int64 \n", " 28 terrain_moderate 158 non-null int64 \n", " 29 terrain_technical 158 non-null int64 \n", " 30 shock_absorption 158 non-null int64 \n", "dtypes: float64(1), int64(6), str(24)\n", "memory usage: 38.4 KB\n" ] } ], "source": [ "df.drop('shock absorption', axis=1, inplace=True)\n", "df.info()" ] }, { "cell_type": "markdown", "id": "0dfe6ab4", "metadata": {}, "source": [ "## Energy return" ] }, { "cell_type": "code", "execution_count": 23, "id": "e1583547", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "energy return\n", "- 81\n", "low 36\n", "moderate 36\n", "high 5\n", "Name: count, dtype: int64\n" ] } ], "source": [ "print(df[\"energy return\"].value_counts())" ] }, { "cell_type": "code", "execution_count": 24, "id": "74393e16", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "--- Value Counts Kolom Asli ---\n", "energy return\n", "- 81\n", "low 36\n", "moderate 36\n", "high 5\n", "Name: count, dtype: int64\n", "\n", "--- Sebaran Nilai Hasil Ordinal (Scale 1-5) ---\n", "Index 0: 81 baris\n", "Index 1: 36 baris\n", "Index 2: 0 baris\n", "Index 3: 36 baris\n", "Index 4: 0 baris\n", "Index 5: 5 baris\n", "\n", "--- Perbandingan Data (Head) ---\n", " energy return energy_return\n", "0 high 5\n", "1 - 0\n", "2 low 1\n", "3 low 1\n", "4 - 0\n" ] } ], "source": [ "energy_scaled = {\n", " \"-\": 0,\n", " \"low\": 1,\n", " \"moderate\": 3,\n", " \"high\": 5\n", "}\n", "\n", "df['energy_return'] = df['energy return'].map(energy_scaled)\n", "\n", "print(\"--- Value Counts Kolom Asli ---\")\n", "print(df[\"energy return\"].value_counts())\n", "\n", "print(\"\\n--- Sebaran Nilai Hasil Ordinal (Scale 1-5) ---\")\n", "counts = df[\"energy_return\"].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[[\"energy return\", \"energy_return\"]].head())\n" ] }, { "cell_type": "code", "execution_count": 25, "id": "8b60e596", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 158 entries, 0 to 157\n", "Data columns (total 31 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 brand 158 non-null str \n", " 1 name 158 non-null str \n", " 2 traction 153 non-null str \n", " 3 arch support 158 non-null str \n", " 4 weight lab weight brand 158 non-null str \n", " 5 lightweight 152 non-null float64\n", " 6 drop lab drop brand 158 non-null str \n", " 7 strike pattern 158 non-null str \n", " 8 midsole softness 158 non-null str \n", " 9 plate 158 non-null str \n", " 10 toebox durability 158 non-null str \n", " 11 heel padding durability 158 non-null str \n", " 12 outsole durability 158 non-null str \n", " 13 breathability 158 non-null str \n", " 14 width / fit 158 non-null str \n", " 15 toebox width 158 non-null str \n", " 16 stiffness 158 non-null str \n", " 17 torsional rigidity 158 non-null str \n", " 18 heel counter stiffness 158 non-null str \n", " 19 lug depth 158 non-null str \n", " 20 heel stack lab heel stack brand 158 non-null str \n", " 21 forefoot lab forefoot brand 158 non-null str \n", " 22 season 158 non-null str \n", " 23 removable insole 158 non-null int64 \n", " 24 orthotic friendly 158 non-null int64 \n", " 25 waterproofing 156 non-null str \n", " 26 terrain_light 158 non-null int64 \n", " 27 terrain_moderate 158 non-null int64 \n", " 28 terrain_technical 158 non-null int64 \n", " 29 shock_absorption 158 non-null int64 \n", " 30 energy_return 158 non-null int64 \n", "dtypes: float64(1), int64(7), str(23)\n", "memory usage: 38.4 KB\n" ] } ], "source": [ "df.drop('energy return', axis=1, inplace=True)\n", "df.info()" ] }, { "cell_type": "markdown", "id": "050f4527", "metadata": {}, "source": [ "## Traction" ] }, { "cell_type": "code", "execution_count": 26, "id": "6a938fe9", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "traction\n", "- 127\n", "high 25\n", "moderate 1\n", "Name: count, dtype: int64\n" ] } ], "source": [ "print(df[\"traction\"].value_counts())" ] }, { "cell_type": "code", "execution_count": 27, "id": "7fd8d46f", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "--- Value Counts Kolom Asli ---\n", "traction\n", "- 127\n", "high 25\n", "moderate 1\n", "Name: count, dtype: int64\n", "\n", "--- Sebaran Nilai Hasil Ordinal ---\n", "Index 0: 132 baris\n", "Index 1: 0 baris\n", "Index 2: 0 baris\n", "Index 3: 1 baris\n", "Index 4: 0 baris\n", "Index 5: 25 baris\n", "\n", "--- Perbandingan Data (Head) ---\n", " traction traction_scaled\n", "0 - 0\n", "1 - 0\n", "2 - 0\n", "3 high 5\n", "4 - 0\n" ] } ], "source": [ "traction_scaled = {\n", " \"-\": 0,\n", " \"low\": 1,\n", " \"moderate\": 3,\n", " \"high\": 5\n", "}\n", "\n", "df['traction_scaled'] = df['traction'].map(traction_scaled).fillna(0).astype(int)\n", "\n", "print(\"--- Value Counts Kolom Asli ---\")\n", "print(df[\"traction\"].value_counts())\n", "\n", "print(\"\\n--- Sebaran Nilai Hasil Ordinal ---\")\n", "counts = df[\"traction_scaled\"].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[[\"traction\", \"traction_scaled\"]].head())" ] }, { "cell_type": "code", "execution_count": 28, "id": "3a83c57d", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 158 entries, 0 to 157\n", "Data columns (total 31 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 brand 158 non-null str \n", " 1 name 158 non-null str \n", " 2 arch support 158 non-null str \n", " 3 weight lab weight brand 158 non-null str \n", " 4 lightweight 152 non-null float64\n", " 5 drop lab drop brand 158 non-null str \n", " 6 strike pattern 158 non-null str \n", " 7 midsole softness 158 non-null str \n", " 8 plate 158 non-null str \n", " 9 toebox durability 158 non-null str \n", " 10 heel padding durability 158 non-null str \n", " 11 outsole durability 158 non-null str \n", " 12 breathability 158 non-null str \n", " 13 width / fit 158 non-null str \n", " 14 toebox width 158 non-null str \n", " 15 stiffness 158 non-null str \n", " 16 torsional rigidity 158 non-null str \n", " 17 heel counter stiffness 158 non-null str \n", " 18 lug depth 158 non-null str \n", " 19 heel stack lab heel stack brand 158 non-null str \n", " 20 forefoot lab forefoot brand 158 non-null str \n", " 21 season 158 non-null str \n", " 22 removable insole 158 non-null int64 \n", " 23 orthotic friendly 158 non-null int64 \n", " 24 waterproofing 156 non-null str \n", " 25 terrain_light 158 non-null int64 \n", " 26 terrain_moderate 158 non-null int64 \n", " 27 terrain_technical 158 non-null int64 \n", " 28 shock_absorption 158 non-null int64 \n", " 29 energy_return 158 non-null int64 \n", " 30 traction_scaled 158 non-null int64 \n", "dtypes: float64(1), int64(8), str(22)\n", "memory usage: 38.4 KB\n" ] } ], "source": [ "df.drop('traction', axis=1, inplace=True)\n", "df.info()" ] }, { "cell_type": "markdown", "id": "d283f13a", "metadata": {}, "source": [ "## Arch support" ] }, { "cell_type": "code", "execution_count": 29, "id": "1d055a43", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "arch support\n", "neutral 154\n", "stability 4\n", "Name: count, dtype: int64\n" ] } ], "source": [ "print(df[\"arch support\"].value_counts())" ] }, { "cell_type": "code", "execution_count": 30, "id": "8ee15f86", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Rows: 158\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 neutral 1 0\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()\n", "base_arch = ['neutral', 'stability']\n", "\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", "\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": 31, "id": "bddc5889", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "arch support\n", "neutral 154\n", "stability 4\n", "Name: count, dtype: int64\n", "\n", "arch_neutral sum: 154\n", "arch_stability sum: 4\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": 32, "id": "d8b2e073", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 158 entries, 0 to 157\n", "Data columns (total 32 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 brand 158 non-null str \n", " 1 name 158 non-null str \n", " 2 weight lab weight brand 158 non-null str \n", " 3 lightweight 152 non-null float64\n", " 4 drop lab drop brand 158 non-null str \n", " 5 strike pattern 158 non-null str \n", " 6 midsole softness 158 non-null str \n", " 7 plate 158 non-null str \n", " 8 toebox durability 158 non-null str \n", " 9 heel padding durability 158 non-null str \n", " 10 outsole durability 158 non-null str \n", " 11 breathability 158 non-null str \n", " 12 width / fit 158 non-null str \n", " 13 toebox width 158 non-null str \n", " 14 stiffness 158 non-null str \n", " 15 torsional rigidity 158 non-null str \n", " 16 heel counter stiffness 158 non-null str \n", " 17 lug depth 158 non-null str \n", " 18 heel stack lab heel stack brand 158 non-null str \n", " 19 forefoot lab forefoot brand 158 non-null str \n", " 20 season 158 non-null str \n", " 21 removable insole 158 non-null int64 \n", " 22 orthotic friendly 158 non-null int64 \n", " 23 waterproofing 156 non-null str \n", " 24 terrain_light 158 non-null int64 \n", " 25 terrain_moderate 158 non-null int64 \n", " 26 terrain_technical 158 non-null int64 \n", " 27 shock_absorption 158 non-null int64 \n", " 28 energy_return 158 non-null int64 \n", " 29 traction_scaled 158 non-null int64 \n", " 30 arch_neutral 158 non-null int64 \n", " 31 arch_stability 158 non-null int64 \n", "dtypes: float64(1), int64(10), str(21)\n", "memory usage: 39.6 KB\n" ] } ], "source": [ "df.drop(columns=['arch support'], inplace=True)\n", "df.info()" ] }, { "cell_type": "markdown", "id": "eba72c42", "metadata": {}, "source": [ "## Split Weight lab Weight brand" ] }, { "cell_type": "code", "execution_count": 33, "id": "4027e6f8", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "np.int64(0)" ] }, "execution_count": 33, "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": 34, "id": "dd34c04a", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " weight lab weight brand weight_lab_oz weight_lab_g \\\n", "0 9.1 oz / 259g 9.5 oz / 270g 9.1 259 \n", "1 9.1 oz / 258g 9 oz / 255g 9.1 258 \n", "2 10.1 oz / 285g 9.6 oz / 273g 10.1 285 \n", "3 9.4 oz / 266g 10.3 oz / 293g 9.4 266 \n", "4 10.7 oz / 302g 10.6 oz / 301g 10.7 302 \n", "\n", " weight_brand_oz weight_brand_g \n", "0 9.5 270.0 \n", "1 9.0 255.0 \n", "2 9.6 273.0 \n", "3 10.3 293.0 \n", "4 10.6 301.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": 35, "id": "4ad81586", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 158 entries, 0 to 157\n", "Data columns (total 35 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 brand 158 non-null str \n", " 1 name 158 non-null str \n", " 2 lightweight 152 non-null float64\n", " 3 drop lab drop brand 158 non-null str \n", " 4 strike pattern 158 non-null str \n", " 5 midsole softness 158 non-null str \n", " 6 plate 158 non-null str \n", " 7 toebox durability 158 non-null str \n", " 8 heel padding durability 158 non-null str \n", " 9 outsole durability 158 non-null str \n", " 10 breathability 158 non-null str \n", " 11 width / fit 158 non-null str \n", " 12 toebox width 158 non-null str \n", " 13 stiffness 158 non-null str \n", " 14 torsional rigidity 158 non-null str \n", " 15 heel counter stiffness 158 non-null str \n", " 16 lug depth 158 non-null str \n", " 17 heel stack lab heel stack brand 158 non-null str \n", " 18 forefoot lab forefoot brand 158 non-null str \n", " 19 season 158 non-null str \n", " 20 removable insole 158 non-null int64 \n", " 21 orthotic friendly 158 non-null int64 \n", " 22 waterproofing 156 non-null str \n", " 23 terrain_light 158 non-null int64 \n", " 24 terrain_moderate 158 non-null int64 \n", " 25 terrain_technical 158 non-null int64 \n", " 26 shock_absorption 158 non-null int64 \n", " 27 energy_return 158 non-null int64 \n", " 28 traction_scaled 158 non-null int64 \n", " 29 arch_neutral 158 non-null int64 \n", " 30 arch_stability 158 non-null int64 \n", " 31 weight_lab_oz 158 non-null float64\n", " 32 weight_lab_g 158 non-null int64 \n", " 33 weight_brand_oz 155 non-null float64\n", " 34 weight_brand_g 155 non-null float64\n", "dtypes: float64(4), int64(11), str(20)\n", "memory usage: 43.3 KB\n" ] } ], "source": [ "df.drop(columns=[\"weight lab weight brand\",], inplace=True)\n", "df.info()" ] }, { "cell_type": "markdown", "id": "7f8f3114", "metadata": {}, "source": [ "## Split Drop lab Drop brand" ] }, { "cell_type": "code", "execution_count": 36, "id": "d96d69ca", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "np.int64(0)" ] }, "execution_count": 36, "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": 37, "id": "33f141ae", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " drop lab drop brand drop_lab_mm drop_brand_mm\n", "0 0.3 mm 8.0 mm 0.3 8.0\n", "1 8.2 mm 8.0 mm 8.2 8.0\n", "2 4.3 mm 4.0 mm 4.3 4.0\n", "3 6.1 mm 4.0 mm 6.1 4.0\n", "4 0.2 mm 0.0 mm 0.2 0.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": 38, "id": "1d1c4eac", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 158 entries, 0 to 157\n", "Data columns (total 36 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 brand 158 non-null str \n", " 1 name 158 non-null str \n", " 2 lightweight 152 non-null float64\n", " 3 strike pattern 158 non-null str \n", " 4 midsole softness 158 non-null str \n", " 5 plate 158 non-null str \n", " 6 toebox durability 158 non-null str \n", " 7 heel padding durability 158 non-null str \n", " 8 outsole durability 158 non-null str \n", " 9 breathability 158 non-null str \n", " 10 width / fit 158 non-null str \n", " 11 toebox width 158 non-null str \n", " 12 stiffness 158 non-null str \n", " 13 torsional rigidity 158 non-null str \n", " 14 heel counter stiffness 158 non-null str \n", " 15 lug depth 158 non-null str \n", " 16 heel stack lab heel stack brand 158 non-null str \n", " 17 forefoot lab forefoot brand 158 non-null str \n", " 18 season 158 non-null str \n", " 19 removable insole 158 non-null int64 \n", " 20 orthotic friendly 158 non-null int64 \n", " 21 waterproofing 156 non-null str \n", " 22 terrain_light 158 non-null int64 \n", " 23 terrain_moderate 158 non-null int64 \n", " 24 terrain_technical 158 non-null int64 \n", " 25 shock_absorption 158 non-null int64 \n", " 26 energy_return 158 non-null int64 \n", " 27 traction_scaled 158 non-null int64 \n", " 28 arch_neutral 158 non-null int64 \n", " 29 arch_stability 158 non-null int64 \n", " 30 weight_lab_oz 158 non-null float64\n", " 31 weight_lab_g 158 non-null int64 \n", " 32 weight_brand_oz 155 non-null float64\n", " 33 weight_brand_g 155 non-null float64\n", " 34 drop_lab_mm 158 non-null float64\n", " 35 drop_brand_mm 152 non-null float64\n", "dtypes: float64(6), int64(11), str(19)\n", "memory usage: 44.6 KB\n" ] } ], "source": [ "df.drop(columns=[\"drop lab drop brand\"], inplace=True)\n", "df.info()" ] }, { "cell_type": "markdown", "id": "a60c8a59", "metadata": {}, "source": [ "## Strike pattern" ] }, { "cell_type": "code", "execution_count": 39, "id": "53e91a22", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "strike pattern\n", "mid/forefoot 83\n", "heel 48\n", "heel mid/forefoot 25\n", "heelmid/forefoot 2\n", "Name: count, dtype: int64\n" ] } ], "source": [ "print(df[\"strike pattern\"].value_counts())" ] }, { "cell_type": "code", "execution_count": 40, "id": "8f141a55", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Rows: 158\n", "\n", "Unique Values in original column:\n", "\n", "['mid/forefoot', 'heel mid/forefoot', 'heel', 'heelmid/forefoot']\n", "Length: 4, dtype: str\n", "\n", "Sample Comparison (Multi-label Mapping):\n", " strike pattern strike_heel strike_mid strike_forefoot\n", "0 mid/forefoot 0 1 1\n", "1 heel mid/forefoot 1 1 1\n", "2 mid/forefoot 0 1 1\n", "3 mid/forefoot 0 1 1\n", "4 mid/forefoot 0 1 1\n", "5 mid/forefoot 0 1 1\n", "6 mid/forefoot 0 1 1\n", "7 mid/forefoot 0 1 1\n", "8 mid/forefoot 0 1 1\n", "9 mid/forefoot 0 1 1\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", " 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": 41, "id": "1b1de021", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "strike pattern\n", "mid/forefoot 83\n", "heel 48\n", "heel mid/forefoot 25\n", "heelmid/forefoot 2\n", "Name: count, dtype: int64\n", "\n", "strike_heel sum: 75\n", "strike_mid sum: 110\n", "strike_forefoot sum: 110\n", "\n", " strike pattern strike_heel strike_mid strike_forefoot\n", "0 mid/forefoot 0 1 1\n", "1 heel mid/forefoot 1 1 1\n", "2 mid/forefoot 0 1 1\n", "3 mid/forefoot 0 1 1\n", "4 mid/forefoot 0 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": 42, "id": "767fe00e", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 158 entries, 0 to 157\n", "Data columns (total 38 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 brand 158 non-null str \n", " 1 name 158 non-null str \n", " 2 lightweight 152 non-null float64\n", " 3 midsole softness 158 non-null str \n", " 4 plate 158 non-null str \n", " 5 toebox durability 158 non-null str \n", " 6 heel padding durability 158 non-null str \n", " 7 outsole durability 158 non-null str \n", " 8 breathability 158 non-null str \n", " 9 width / fit 158 non-null str \n", " 10 toebox width 158 non-null str \n", " 11 stiffness 158 non-null str \n", " 12 torsional rigidity 158 non-null str \n", " 13 heel counter stiffness 158 non-null str \n", " 14 lug depth 158 non-null str \n", " 15 heel stack lab heel stack brand 158 non-null str \n", " 16 forefoot lab forefoot brand 158 non-null str \n", " 17 season 158 non-null str \n", " 18 removable insole 158 non-null int64 \n", " 19 orthotic friendly 158 non-null int64 \n", " 20 waterproofing 156 non-null str \n", " 21 terrain_light 158 non-null int64 \n", " 22 terrain_moderate 158 non-null int64 \n", " 23 terrain_technical 158 non-null int64 \n", " 24 shock_absorption 158 non-null int64 \n", " 25 energy_return 158 non-null int64 \n", " 26 traction_scaled 158 non-null int64 \n", " 27 arch_neutral 158 non-null int64 \n", " 28 arch_stability 158 non-null int64 \n", " 29 weight_lab_oz 158 non-null float64\n", " 30 weight_lab_g 158 non-null int64 \n", " 31 weight_brand_oz 155 non-null float64\n", " 32 weight_brand_g 155 non-null float64\n", " 33 drop_lab_mm 158 non-null float64\n", " 34 drop_brand_mm 152 non-null float64\n", " 35 strike_heel 158 non-null int64 \n", " 36 strike_mid 158 non-null int64 \n", " 37 strike_forefoot 158 non-null int64 \n", "dtypes: float64(6), int64(14), str(18)\n", "memory usage: 47.0 KB\n" ] } ], "source": [ "df.drop(columns=['strike pattern'], inplace=True)\n", "df.info()" ] }, { "cell_type": "markdown", "id": "d9e9ece2", "metadata": {}, "source": [ "## Midsole softness" ] }, { "cell_type": "code", "execution_count": 43, "id": "b524c2a4", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "midsole softness\n", "balanced 72\n", "soft 54\n", "- 19\n", "firm 13\n", "Name: count, dtype: int64\n" ] } ], "source": [ "print(df[\"midsole softness\"].value_counts())" ] }, { "cell_type": "code", "execution_count": 44, "id": "f61696ae", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "--- Value Counts Kolom Asli ---\n", "midsole softness\n", "balanced 72\n", "soft 54\n", "- 19\n", "firm 13\n", "Name: count, dtype: int64\n", "\n", "--- Sebaran Nilai Hasil Ordinal (Scale 1-5) ---\n", "Index 0: 19 baris\n", "Index 1: 13 baris\n", "Index 2: 0 baris\n", "Index 3: 72 baris\n", "Index 4: 0 baris\n", "Index 5: 54 baris\n", "\n", "--- Perbandingan Data (Head) ---\n", " midsole softness midsole_softness\n", "0 balanced 3\n", "1 - 0\n", "2 soft 5\n", "3 balanced 3\n", "4 - 0\n" ] } ], "source": [ "softness_scaled = {\n", " \"firm\": 1,\n", " \"balanced\": 3,\n", " \"soft\": 5,\n", " \"-\": 0,\n", " \"0\": 0\n", "}\n", "\n", "df['midsole_softness'] = df['midsole softness'].map(softness_scaled)\n", "\n", "print(\"--- Value Counts Kolom Asli ---\")\n", "print(df[\"midsole softness\"].value_counts())\n", "\n", "print(\"\\n--- Sebaran Nilai Hasil Ordinal (Scale 1-5) ---\")\n", "counts = df[\"midsole_softness\"].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[[\"midsole softness\", \"midsole_softness\"]].head())" ] }, { "cell_type": "code", "execution_count": 45, "id": "c361b27d", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 158 entries, 0 to 157\n", "Data columns (total 38 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 brand 158 non-null str \n", " 1 name 158 non-null str \n", " 2 lightweight 152 non-null float64\n", " 3 plate 158 non-null str \n", " 4 toebox durability 158 non-null str \n", " 5 heel padding durability 158 non-null str \n", " 6 outsole durability 158 non-null str \n", " 7 breathability 158 non-null str \n", " 8 width / fit 158 non-null str \n", " 9 toebox width 158 non-null str \n", " 10 stiffness 158 non-null str \n", " 11 torsional rigidity 158 non-null str \n", " 12 heel counter stiffness 158 non-null str \n", " 13 lug depth 158 non-null str \n", " 14 heel stack lab heel stack brand 158 non-null str \n", " 15 forefoot lab forefoot brand 158 non-null str \n", " 16 season 158 non-null str \n", " 17 removable insole 158 non-null int64 \n", " 18 orthotic friendly 158 non-null int64 \n", " 19 waterproofing 156 non-null str \n", " 20 terrain_light 158 non-null int64 \n", " 21 terrain_moderate 158 non-null int64 \n", " 22 terrain_technical 158 non-null int64 \n", " 23 shock_absorption 158 non-null int64 \n", " 24 energy_return 158 non-null int64 \n", " 25 traction_scaled 158 non-null int64 \n", " 26 arch_neutral 158 non-null int64 \n", " 27 arch_stability 158 non-null int64 \n", " 28 weight_lab_oz 158 non-null float64\n", " 29 weight_lab_g 158 non-null int64 \n", " 30 weight_brand_oz 155 non-null float64\n", " 31 weight_brand_g 155 non-null float64\n", " 32 drop_lab_mm 158 non-null float64\n", " 33 drop_brand_mm 152 non-null float64\n", " 34 strike_heel 158 non-null int64 \n", " 35 strike_mid 158 non-null int64 \n", " 36 strike_forefoot 158 non-null int64 \n", " 37 midsole_softness 158 non-null int64 \n", "dtypes: float64(6), int64(15), str(17)\n", "memory usage: 47.0 KB\n" ] } ], "source": [ "df.drop(columns=[\"midsole softness\"], inplace=True)\n", "df.info()" ] }, { "cell_type": "markdown", "id": "00df0f14", "metadata": {}, "source": [ "## Toebox durability" ] }, { "cell_type": "code", "execution_count": 46, "id": "6e926181", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "toebox durability\n", "good 39\n", "decent 39\n", "- 36\n", "bad 17\n", "very bad 15\n", "very good 12\n", "Name: count, dtype: int64\n" ] } ], "source": [ "print(df['toebox durability'].value_counts())" ] }, { "cell_type": "code", "execution_count": 47, "id": "8a18a9a8", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Rows: 158\n", "\n", "Unique Values mapping check:\n", "'-' di-encode menjadi 0 (Total: 36)\n", "'very bad' di-encode menjadi 1 (Total: 15)\n", "'bad' di-encode menjadi 2 (Total: 17)\n", "'decent' di-encode menjadi 3 (Total: 39)\n", "'good' di-encode menjadi 4 (Total: 39)\n", "'very good' di-encode menjadi 5 (Total: 12)\n", "\n", "Sample Data:\n", " toebox durability toebox_durability\n", "0 good 4\n", "1 - 0\n", "2 decent 3\n", "3 decent 3\n", "4 - 0\n", "5 - 0\n", "6 - 0\n", "7 good 4\n", "8 decent 3\n", "9 - 0\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": 48, "id": "96538ff1", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 158 entries, 0 to 157\n", "Data columns (total 38 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 brand 158 non-null str \n", " 1 name 158 non-null str \n", " 2 lightweight 152 non-null float64\n", " 3 plate 158 non-null str \n", " 4 heel padding durability 158 non-null str \n", " 5 outsole durability 158 non-null str \n", " 6 breathability 158 non-null str \n", " 7 width / fit 158 non-null str \n", " 8 toebox width 158 non-null str \n", " 9 stiffness 158 non-null str \n", " 10 torsional rigidity 158 non-null str \n", " 11 heel counter stiffness 158 non-null str \n", " 12 lug depth 158 non-null str \n", " 13 heel stack lab heel stack brand 158 non-null str \n", " 14 forefoot lab forefoot brand 158 non-null str \n", " 15 season 158 non-null str \n", " 16 removable insole 158 non-null int64 \n", " 17 orthotic friendly 158 non-null int64 \n", " 18 waterproofing 156 non-null str \n", " 19 terrain_light 158 non-null int64 \n", " 20 terrain_moderate 158 non-null int64 \n", " 21 terrain_technical 158 non-null int64 \n", " 22 shock_absorption 158 non-null int64 \n", " 23 energy_return 158 non-null int64 \n", " 24 traction_scaled 158 non-null int64 \n", " 25 arch_neutral 158 non-null int64 \n", " 26 arch_stability 158 non-null int64 \n", " 27 weight_lab_oz 158 non-null float64\n", " 28 weight_lab_g 158 non-null int64 \n", " 29 weight_brand_oz 155 non-null float64\n", " 30 weight_brand_g 155 non-null float64\n", " 31 drop_lab_mm 158 non-null float64\n", " 32 drop_brand_mm 152 non-null float64\n", " 33 strike_heel 158 non-null int64 \n", " 34 strike_mid 158 non-null int64 \n", " 35 strike_forefoot 158 non-null int64 \n", " 36 midsole_softness 158 non-null int64 \n", " 37 toebox_durability 158 non-null int64 \n", "dtypes: float64(6), int64(16), str(16)\n", "memory usage: 47.0 KB\n" ] } ], "source": [ "df.drop(columns=['toebox durability'], inplace=True)\n", "df.info()" ] }, { "cell_type": "markdown", "id": "554157d1", "metadata": {}, "source": [ "## Heel padding durability" ] }, { "cell_type": "code", "execution_count": 49, "id": "0d78f5d6", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "heel padding durability\n", "decent 51\n", "good 50\n", "- 38\n", "bad 19\n", "Name: count, dtype: int64\n" ] } ], "source": [ "print(df[\"heel padding durability\"].value_counts())" ] }, { "cell_type": "code", "execution_count": 50, "id": "c5df3591", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "--- Value Counts Kolom Asli ---\n", "heel padding durability\n", "decent 51\n", "good 50\n", "- 38\n", "bad 19\n", "Name: count, dtype: int64\n", "\n", "--- Sebaran Nilai Hasil Ordinal (Scale 1-5) ---\n", "Index 0: 38 baris\n", "Index 1: 0 baris\n", "Index 2: 19 baris\n", "Index 3: 51 baris\n", "Index 4: 50 baris\n", "Index 5: 0 baris\n", "\n", "--- Perbandingan Data (Head) ---\n", " heel padding durability heel_durability\n", "0 good 4\n", "1 - 0\n", "2 decent 3\n", "3 good 4\n", "4 - 0\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())" ] }, { "cell_type": "code", "execution_count": 51, "id": "5126e7a6", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 158 entries, 0 to 157\n", "Data columns (total 38 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 brand 158 non-null str \n", " 1 name 158 non-null str \n", " 2 lightweight 152 non-null float64\n", " 3 plate 158 non-null str \n", " 4 outsole durability 158 non-null str \n", " 5 breathability 158 non-null str \n", " 6 width / fit 158 non-null str \n", " 7 toebox width 158 non-null str \n", " 8 stiffness 158 non-null str \n", " 9 torsional rigidity 158 non-null str \n", " 10 heel counter stiffness 158 non-null str \n", " 11 lug depth 158 non-null str \n", " 12 heel stack lab heel stack brand 158 non-null str \n", " 13 forefoot lab forefoot brand 158 non-null str \n", " 14 season 158 non-null str \n", " 15 removable insole 158 non-null int64 \n", " 16 orthotic friendly 158 non-null int64 \n", " 17 waterproofing 156 non-null str \n", " 18 terrain_light 158 non-null int64 \n", " 19 terrain_moderate 158 non-null int64 \n", " 20 terrain_technical 158 non-null int64 \n", " 21 shock_absorption 158 non-null int64 \n", " 22 energy_return 158 non-null int64 \n", " 23 traction_scaled 158 non-null int64 \n", " 24 arch_neutral 158 non-null int64 \n", " 25 arch_stability 158 non-null int64 \n", " 26 weight_lab_oz 158 non-null float64\n", " 27 weight_lab_g 158 non-null int64 \n", " 28 weight_brand_oz 155 non-null float64\n", " 29 weight_brand_g 155 non-null float64\n", " 30 drop_lab_mm 158 non-null float64\n", " 31 drop_brand_mm 152 non-null float64\n", " 32 strike_heel 158 non-null int64 \n", " 33 strike_mid 158 non-null int64 \n", " 34 strike_forefoot 158 non-null int64 \n", " 35 midsole_softness 158 non-null int64 \n", " 36 toebox_durability 158 non-null int64 \n", " 37 heel_durability 158 non-null int64 \n", "dtypes: float64(6), int64(17), str(15)\n", "memory usage: 47.0 KB\n" ] } ], "source": [ "df.drop('heel padding durability', axis=1, inplace=True)\n", "df.info()" ] }, { "cell_type": "code", "execution_count": 52, "id": "46a4046e", "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", "
brandnamelightweightplateoutsole durabilitybreathabilitywidth / fittoebox widthstiffnesstorsional rigidity...weight_brand_ozweight_brand_gdrop_lab_mmdrop_brand_mmstrike_heelstrike_midstrike_forefootmidsole_softnesstoebox_durabilityheel_durability
0adidasterrex agravic speed ultra0.00decentmoderatemediumnarrowmoderatestiff...9.5270.00.38.0011344
1adidasterrex speed ultra0.00--narrow-stiffflexible...9.0255.08.28.0111000
2altraexperience wild0.00goodmoderatewidewidemoderatestiff...9.6273.04.34.0011533
3altraexperience wild 20.00goodwarmwidewidemoderatemoderate...10.3293.06.14.0011334
4altralone peak 5.00.0rock plate--narrow-stiffflexible...10.6301.00.20.0011000
\n", "

5 rows × 38 columns

\n", "
" ], "text/plain": [ " brand name lightweight plate \\\n", "0 adidas terrex agravic speed ultra 0.0 0 \n", "1 adidas terrex speed ultra 0.0 0 \n", "2 altra experience wild 0.0 0 \n", "3 altra experience wild 2 0.0 0 \n", "4 altra lone peak 5.0 0.0 rock plate \n", "\n", " outsole durability breathability width / fit toebox width stiffness \\\n", "0 decent moderate medium narrow moderate \n", "1 - - narrow - stiff \n", "2 good moderate wide wide moderate \n", "3 good warm wide wide moderate \n", "4 - - narrow - stiff \n", "\n", " torsional rigidity ... weight_brand_oz weight_brand_g drop_lab_mm \\\n", "0 stiff ... 9.5 270.0 0.3 \n", "1 flexible ... 9.0 255.0 8.2 \n", "2 stiff ... 9.6 273.0 4.3 \n", "3 moderate ... 10.3 293.0 6.1 \n", "4 flexible ... 10.6 301.0 0.2 \n", "\n", " drop_brand_mm strike_heel strike_mid strike_forefoot midsole_softness \\\n", "0 8.0 0 1 1 3 \n", "1 8.0 1 1 1 0 \n", "2 4.0 0 1 1 5 \n", "3 4.0 0 1 1 3 \n", "4 0.0 0 1 1 0 \n", "\n", " toebox_durability heel_durability \n", "0 4 4 \n", "1 0 0 \n", "2 3 3 \n", "3 3 4 \n", "4 0 0 \n", "\n", "[5 rows x 38 columns]" ] }, "execution_count": 52, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df.head()" ] }, { "cell_type": "markdown", "id": "20b755dc", "metadata": {}, "source": [ "## Outsole durability" ] }, { "cell_type": "code", "execution_count": 53, "id": "0647abf7", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "outsole durability\n", "good 77\n", "- 42\n", "decent 38\n", "bad 1\n", "Name: count, dtype: int64\n" ] } ], "source": [ "print(df[\"outsole durability\"].value_counts())" ] }, { "cell_type": "code", "execution_count": 54, "id": "fbba911c", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "--- Value Counts Kolom Asli ---\n", "outsole durability\n", "good 77\n", "- 42\n", "decent 38\n", "bad 1\n", "Name: count, dtype: int64\n", "\n", "--- Sebaran Nilai Hasil Ordinal (Scale 1-5) ---\n", "Index 0: 42 baris\n", "Index 1: 0 baris\n", "Index 2: 1 baris\n", "Index 3: 38 baris\n", "Index 4: 77 baris\n", "Index 5: 0 baris\n", "\n", "--- Perbandingan Data (Head) ---\n", " outsole durability outsole_durability\n", "0 decent 3\n", "1 - 0\n", "2 good 4\n", "3 good 4\n", "4 - 0\n" ] } ], "source": [ "durability_scaled = {\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_scaled)\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": 55, "id": "b9a91d05", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 158 entries, 0 to 157\n", "Data columns (total 38 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 brand 158 non-null str \n", " 1 name 158 non-null str \n", " 2 lightweight 152 non-null float64\n", " 3 plate 158 non-null str \n", " 4 breathability 158 non-null str \n", " 5 width / fit 158 non-null str \n", " 6 toebox width 158 non-null str \n", " 7 stiffness 158 non-null str \n", " 8 torsional rigidity 158 non-null str \n", " 9 heel counter stiffness 158 non-null str \n", " 10 lug depth 158 non-null str \n", " 11 heel stack lab heel stack brand 158 non-null str \n", " 12 forefoot lab forefoot brand 158 non-null str \n", " 13 season 158 non-null str \n", " 14 removable insole 158 non-null int64 \n", " 15 orthotic friendly 158 non-null int64 \n", " 16 waterproofing 156 non-null str \n", " 17 terrain_light 158 non-null int64 \n", " 18 terrain_moderate 158 non-null int64 \n", " 19 terrain_technical 158 non-null int64 \n", " 20 shock_absorption 158 non-null int64 \n", " 21 energy_return 158 non-null int64 \n", " 22 traction_scaled 158 non-null int64 \n", " 23 arch_neutral 158 non-null int64 \n", " 24 arch_stability 158 non-null int64 \n", " 25 weight_lab_oz 158 non-null float64\n", " 26 weight_lab_g 158 non-null int64 \n", " 27 weight_brand_oz 155 non-null float64\n", " 28 weight_brand_g 155 non-null float64\n", " 29 drop_lab_mm 158 non-null float64\n", " 30 drop_brand_mm 152 non-null float64\n", " 31 strike_heel 158 non-null int64 \n", " 32 strike_mid 158 non-null int64 \n", " 33 strike_forefoot 158 non-null int64 \n", " 34 midsole_softness 158 non-null int64 \n", " 35 toebox_durability 158 non-null int64 \n", " 36 heel_durability 158 non-null int64 \n", " 37 outsole_durability 158 non-null int64 \n", "dtypes: float64(6), int64(18), str(14)\n", "memory usage: 47.0 KB\n" ] } ], "source": [ "df.drop('outsole durability', axis=1, inplace=True)\n", "df.info()" ] }, { "cell_type": "markdown", "id": "d6e10b84", "metadata": {}, "source": [ "## Breathability" ] }, { "cell_type": "code", "execution_count": 56, "id": "c6a78523", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "breathability\n", "moderate 92\n", "warm 31\n", "- 19\n", "breathable 16\n", "Name: count, dtype: int64\n" ] } ], "source": [ "print(df[\"breathability\"].value_counts())" ] }, { "cell_type": "code", "execution_count": 57, "id": "35945fd4", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "--- Value Counts Kolom Asli ---\n", "breathability\n", "moderate 92\n", "warm 31\n", "- 19\n", "breathable 16\n", "Name: count, dtype: int64\n", "\n", "--- Sebaran Nilai Hasil Ordinal ---\n", "Index 0: 19 baris\n", "Index 1: 31 baris\n", "Index 2: 0 baris\n", "Index 3: 92 baris\n", "Index 4: 0 baris\n", "Index 5: 16 baris\n", "\n", "--- Perbandingan Data (Head) ---\n", " breathability breathability_scaled\n", "0 moderate 3\n", "1 - 0\n", "2 moderate 3\n", "3 warm 1\n", "4 - 0\n" ] } ], "source": [ "breathability_scaled = {\n", " \"-\": 0,\n", " # \"suffocating\": 1,\n", " \"warm\": 1,\n", " \"moderate\": 3,\n", " \"good\": 4,\n", " \"breathable\": 5\n", "}\n", "\n", "df['breathability_scaled'] = df['breathability'].map(breathability_scaled)\n", "\n", "print(\"--- Value Counts Kolom Asli ---\")\n", "print(df[\"breathability\"].value_counts())\n", "\n", "print(\"\\n--- Sebaran Nilai Hasil Ordinal ---\")\n", "counts = df[\"breathability_scaled\"].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_scaled\"]].head())" ] }, { "cell_type": "code", "execution_count": 58, "id": "f9163564", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 158 entries, 0 to 157\n", "Data columns (total 38 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 brand 158 non-null str \n", " 1 name 158 non-null str \n", " 2 lightweight 152 non-null float64\n", " 3 plate 158 non-null str \n", " 4 width / fit 158 non-null str \n", " 5 toebox width 158 non-null str \n", " 6 stiffness 158 non-null str \n", " 7 torsional rigidity 158 non-null str \n", " 8 heel counter stiffness 158 non-null str \n", " 9 lug depth 158 non-null str \n", " 10 heel stack lab heel stack brand 158 non-null str \n", " 11 forefoot lab forefoot brand 158 non-null str \n", " 12 season 158 non-null str \n", " 13 removable insole 158 non-null int64 \n", " 14 orthotic friendly 158 non-null int64 \n", " 15 waterproofing 156 non-null str \n", " 16 terrain_light 158 non-null int64 \n", " 17 terrain_moderate 158 non-null int64 \n", " 18 terrain_technical 158 non-null int64 \n", " 19 shock_absorption 158 non-null int64 \n", " 20 energy_return 158 non-null int64 \n", " 21 traction_scaled 158 non-null int64 \n", " 22 arch_neutral 158 non-null int64 \n", " 23 arch_stability 158 non-null int64 \n", " 24 weight_lab_oz 158 non-null float64\n", " 25 weight_lab_g 158 non-null int64 \n", " 26 weight_brand_oz 155 non-null float64\n", " 27 weight_brand_g 155 non-null float64\n", " 28 drop_lab_mm 158 non-null float64\n", " 29 drop_brand_mm 152 non-null float64\n", " 30 strike_heel 158 non-null int64 \n", " 31 strike_mid 158 non-null int64 \n", " 32 strike_forefoot 158 non-null int64 \n", " 33 midsole_softness 158 non-null int64 \n", " 34 toebox_durability 158 non-null int64 \n", " 35 heel_durability 158 non-null int64 \n", " 36 outsole_durability 158 non-null int64 \n", " 37 breathability_scaled 158 non-null int64 \n", "dtypes: float64(6), int64(19), str(13)\n", "memory usage: 47.0 KB\n" ] } ], "source": [ "df.drop('breathability', axis=1, inplace=True)\n", "df.info()" ] }, { "cell_type": "markdown", "id": "838283e8", "metadata": {}, "source": [ "## Plate" ] }, { "cell_type": "code", "execution_count": 59, "id": "eb229705", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "plate\n", "0 112\n", "rock plate 35\n", "carbon plate 11\n", "Name: count, dtype: int64\n" ] } ], "source": [ "print(df[\"plate\"].value_counts())" ] }, { "cell_type": "code", "execution_count": 60, "id": "a97958df", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Rows: 158\n", "NULL Value: 112\n", "\n", "Sample Comparison:\n", " plate plate_rock_plate plate_carbon_plate\n", "0 0 0 0\n", "1 0 0 0\n", "2 0 0 0\n", "3 0 0 0\n", "4 rock plate 1 0\n", "5 rock plate 1 0\n", "6 0 0 0\n", "7 0 0 0\n", "8 0 0 0\n", "9 0 0 0\n" ] } ], "source": [ "df['plate'] = df['plate'].astype(str).str.lower()\n", "base_plate = ['rock plate', 'carbon plate']\n", "\n", "for level in base_plate:\n", " column_name = f\"plate_{level.replace(' ', '_')}\"\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": 61, "id": "ff871a52", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "plate\n", "0 112\n", "rock plate 35\n", "carbon plate 11\n", "Name: count, dtype: int64\n", "\n", "plate_rock_plate sum: 35\n", "plate_carbon_plate sum: 11\n", "\n", " plate plate_rock_plate plate_carbon_plate\n", "0 0 0 0\n", "1 0 0 0\n", "2 0 0 0\n", "3 0 0 0\n", "4 rock plate 1 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": 62, "id": "8173c5b5", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 158 entries, 0 to 157\n", "Data columns (total 39 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 brand 158 non-null str \n", " 1 name 158 non-null str \n", " 2 lightweight 152 non-null float64\n", " 3 width / fit 158 non-null str \n", " 4 toebox width 158 non-null str \n", " 5 stiffness 158 non-null str \n", " 6 torsional rigidity 158 non-null str \n", " 7 heel counter stiffness 158 non-null str \n", " 8 lug depth 158 non-null str \n", " 9 heel stack lab heel stack brand 158 non-null str \n", " 10 forefoot lab forefoot brand 158 non-null str \n", " 11 season 158 non-null str \n", " 12 removable insole 158 non-null int64 \n", " 13 orthotic friendly 158 non-null int64 \n", " 14 waterproofing 156 non-null str \n", " 15 terrain_light 158 non-null int64 \n", " 16 terrain_moderate 158 non-null int64 \n", " 17 terrain_technical 158 non-null int64 \n", " 18 shock_absorption 158 non-null int64 \n", " 19 energy_return 158 non-null int64 \n", " 20 traction_scaled 158 non-null int64 \n", " 21 arch_neutral 158 non-null int64 \n", " 22 arch_stability 158 non-null int64 \n", " 23 weight_lab_oz 158 non-null float64\n", " 24 weight_lab_g 158 non-null int64 \n", " 25 weight_brand_oz 155 non-null float64\n", " 26 weight_brand_g 155 non-null float64\n", " 27 drop_lab_mm 158 non-null float64\n", " 28 drop_brand_mm 152 non-null float64\n", " 29 strike_heel 158 non-null int64 \n", " 30 strike_mid 158 non-null int64 \n", " 31 strike_forefoot 158 non-null int64 \n", " 32 midsole_softness 158 non-null int64 \n", " 33 toebox_durability 158 non-null int64 \n", " 34 heel_durability 158 non-null int64 \n", " 35 outsole_durability 158 non-null int64 \n", " 36 breathability_scaled 158 non-null int64 \n", " 37 plate_rock_plate 158 non-null int64 \n", " 38 plate_carbon_plate 158 non-null int64 \n", "dtypes: float64(6), int64(21), str(12)\n", "memory usage: 48.3 KB\n" ] } ], "source": [ "df.drop(columns=[\"plate\"], inplace=True)\n", "df.info()" ] }, { "cell_type": "markdown", "id": "273e5d26", "metadata": {}, "source": [ "## Width / fit" ] }, { "cell_type": "code", "execution_count": 63, "id": "229ae3b1", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "width / fit\n", "medium 92\n", "narrow 47\n", "wide 19\n", "Name: count, dtype: int64\n" ] } ], "source": [ "print(df['width / fit'].value_counts())" ] }, { "cell_type": "code", "execution_count": 64, "id": "9e4b2c22", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "--- Value Counts Kolom Asli ---\n", "width / fit\n", "medium 92\n", "narrow 47\n", "wide 19\n", "Name: count, dtype: int64\n", "\n", "--- Sebaran Nilai Hasil Ordinal ---\n", "Index 0: 0 baris\n", "Index 1: 47 baris\n", "Index 2: 0 baris\n", "Index 3: 92 baris\n", "Index 4: 0 baris\n", "Index 5: 19 baris\n", "\n", "--- Perbandingan Data (Head) ---\n", " width / fit width_fit\n", "0 medium 3\n", "1 narrow 1\n", "2 wide 5\n", "3 wide 5\n", "4 narrow 1\n" ] } ], "source": [ "width_scaled = {\n", " \"narrow\": 1,\n", " \"medium\": 3,\n", " \"wide\": 5,\n", " \"-\": 0,\n", " \"0\": 0\n", "}\n", "\n", "df['width_fit'] = df['width / fit'].map(width_scaled)\n", "\n", "print(\"--- Value Counts Kolom Asli ---\")\n", "print(df[\"width / fit\"].value_counts())\n", "\n", "print(\"\\n--- Sebaran Nilai Hasil Ordinal ---\")\n", "counts = df[\"width_fit\"].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[[\"width / fit\", \"width_fit\"]].head())" ] }, { "cell_type": "code", "execution_count": 65, "id": "227f8218", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 158 entries, 0 to 157\n", "Data columns (total 39 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 brand 158 non-null str \n", " 1 name 158 non-null str \n", " 2 lightweight 152 non-null float64\n", " 3 toebox width 158 non-null str \n", " 4 stiffness 158 non-null str \n", " 5 torsional rigidity 158 non-null str \n", " 6 heel counter stiffness 158 non-null str \n", " 7 lug depth 158 non-null str \n", " 8 heel stack lab heel stack brand 158 non-null str \n", " 9 forefoot lab forefoot brand 158 non-null str \n", " 10 season 158 non-null str \n", " 11 removable insole 158 non-null int64 \n", " 12 orthotic friendly 158 non-null int64 \n", " 13 waterproofing 156 non-null str \n", " 14 terrain_light 158 non-null int64 \n", " 15 terrain_moderate 158 non-null int64 \n", " 16 terrain_technical 158 non-null int64 \n", " 17 shock_absorption 158 non-null int64 \n", " 18 energy_return 158 non-null int64 \n", " 19 traction_scaled 158 non-null int64 \n", " 20 arch_neutral 158 non-null int64 \n", " 21 arch_stability 158 non-null int64 \n", " 22 weight_lab_oz 158 non-null float64\n", " 23 weight_lab_g 158 non-null int64 \n", " 24 weight_brand_oz 155 non-null float64\n", " 25 weight_brand_g 155 non-null float64\n", " 26 drop_lab_mm 158 non-null float64\n", " 27 drop_brand_mm 152 non-null float64\n", " 28 strike_heel 158 non-null int64 \n", " 29 strike_mid 158 non-null int64 \n", " 30 strike_forefoot 158 non-null int64 \n", " 31 midsole_softness 158 non-null int64 \n", " 32 toebox_durability 158 non-null int64 \n", " 33 heel_durability 158 non-null int64 \n", " 34 outsole_durability 158 non-null int64 \n", " 35 breathability_scaled 158 non-null int64 \n", " 36 plate_rock_plate 158 non-null int64 \n", " 37 plate_carbon_plate 158 non-null int64 \n", " 38 width_fit 158 non-null int64 \n", "dtypes: float64(6), int64(22), str(11)\n", "memory usage: 48.3 KB\n" ] } ], "source": [ "df.drop(columns=[\"width / fit\"], inplace=True)\n", "df.info()" ] }, { "cell_type": "markdown", "id": "2f75044e", "metadata": {}, "source": [ "## Toebox width" ] }, { "cell_type": "code", "execution_count": 66, "id": "5534fbde", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "toebox width\n", "medium 68\n", "wide 38\n", "- 32\n", "narrow 20\n", "Name: count, dtype: int64\n" ] } ], "source": [ "print(df['toebox width'].value_counts())" ] }, { "cell_type": "code", "execution_count": 67, "id": "8a4afd8d", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "--- Value Counts Kolom Asli ---\n", "toebox width\n", "medium 68\n", "wide 38\n", "- 32\n", "narrow 20\n", "Name: count, dtype: int64\n", "\n", "--- Sebaran Nilai Hasil Ordinal ---\n", "Index 0: 32 baris\n", "Index 1: 20 baris\n", "Index 2: 0 baris\n", "Index 3: 68 baris\n", "Index 4: 0 baris\n", "Index 5: 38 baris\n", "\n", "--- Perbandingan Data (Head) ---\n", " toebox width toebox_width\n", "0 narrow 1\n", "1 - 0\n", "2 wide 5\n", "3 wide 5\n", "4 - 0\n" ] } ], "source": [ "toebox_scaled = {\n", " \"narrow\": 1,\n", " \"medium\": 3,\n", " \"wide\": 5,\n", " \"-\": 0,\n", " \"0\": 0\n", "}\n", "\n", "df['toebox_width'] = df['toebox width'].map(toebox_scaled)\n", "\n", "print(\"--- Value Counts Kolom Asli ---\")\n", "print(df[\"toebox width\"].value_counts())\n", "\n", "print(\"\\n--- Sebaran Nilai Hasil Ordinal ---\")\n", "counts = df[\"toebox_width\"].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[[\"toebox width\", \"toebox_width\"]].head())" ] }, { "cell_type": "code", "execution_count": 68, "id": "54c66b79", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 158 entries, 0 to 157\n", "Data columns (total 39 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 brand 158 non-null str \n", " 1 name 158 non-null str \n", " 2 lightweight 152 non-null float64\n", " 3 stiffness 158 non-null str \n", " 4 torsional rigidity 158 non-null str \n", " 5 heel counter stiffness 158 non-null str \n", " 6 lug depth 158 non-null str \n", " 7 heel stack lab heel stack brand 158 non-null str \n", " 8 forefoot lab forefoot brand 158 non-null str \n", " 9 season 158 non-null str \n", " 10 removable insole 158 non-null int64 \n", " 11 orthotic friendly 158 non-null int64 \n", " 12 waterproofing 156 non-null str \n", " 13 terrain_light 158 non-null int64 \n", " 14 terrain_moderate 158 non-null int64 \n", " 15 terrain_technical 158 non-null int64 \n", " 16 shock_absorption 158 non-null int64 \n", " 17 energy_return 158 non-null int64 \n", " 18 traction_scaled 158 non-null int64 \n", " 19 arch_neutral 158 non-null int64 \n", " 20 arch_stability 158 non-null int64 \n", " 21 weight_lab_oz 158 non-null float64\n", " 22 weight_lab_g 158 non-null int64 \n", " 23 weight_brand_oz 155 non-null float64\n", " 24 weight_brand_g 155 non-null float64\n", " 25 drop_lab_mm 158 non-null float64\n", " 26 drop_brand_mm 152 non-null float64\n", " 27 strike_heel 158 non-null int64 \n", " 28 strike_mid 158 non-null int64 \n", " 29 strike_forefoot 158 non-null int64 \n", " 30 midsole_softness 158 non-null int64 \n", " 31 toebox_durability 158 non-null int64 \n", " 32 heel_durability 158 non-null int64 \n", " 33 outsole_durability 158 non-null int64 \n", " 34 breathability_scaled 158 non-null int64 \n", " 35 plate_rock_plate 158 non-null int64 \n", " 36 plate_carbon_plate 158 non-null int64 \n", " 37 width_fit 158 non-null int64 \n", " 38 toebox_width 158 non-null int64 \n", "dtypes: float64(6), int64(23), str(10)\n", "memory usage: 48.3 KB\n" ] } ], "source": [ "df.drop(columns=[\"toebox width\"], inplace=True)\n", "df.info()" ] }, { "cell_type": "markdown", "id": "a723b8bd", "metadata": {}, "source": [ "## Stiffness" ] }, { "cell_type": "code", "execution_count": 69, "id": "76d488f5", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "stiffness\n", "stiff 99\n", "moderate 53\n", "flexible 6\n", "Name: count, dtype: int64\n" ] } ], "source": [ "print(df['stiffness'].value_counts())" ] }, { "cell_type": "code", "execution_count": 70, "id": "18ae5a28", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "--- Value Counts Kolom Asli ---\n", "stiffness\n", "stiff 99\n", "moderate 53\n", "flexible 6\n", "Name: count, dtype: int64\n", "\n", "--- Sebaran Nilai Hasil Ordinal ---\n", "Index 0: 0 baris\n", "Index 1: 6 baris\n", "Index 2: 0 baris\n", "Index 3: 53 baris\n", "Index 4: 0 baris\n", "Index 5: 99 baris\n", "\n", "--- Perbandingan Data ---\n", " stiffness stiffness_scaled\n", "0 moderate 3\n", "1 stiff 5\n", "2 moderate 3\n", "3 moderate 3\n", "4 stiff 5\n" ] } ], "source": [ "stiffness_scaled = {\n", " \"flexible\": 1,\n", " \"moderate\": 3,\n", " \"stiff\": 5,\n", " \"-\": 0,\n", " \"0\": 0\n", "}\n", "\n", "df['stiffness_scaled'] = df['stiffness'].map(stiffness_scaled)\n", "\n", "print(\"--- Value Counts Kolom Asli ---\")\n", "print(df[\"stiffness\"].value_counts())\n", "\n", "print(\"\\n--- Sebaran Nilai Hasil Ordinal ---\")\n", "counts = df[\"stiffness_scaled\"].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 ---\")\n", "print(df[[\"stiffness\", \"stiffness_scaled\"]].head())" ] }, { "cell_type": "code", "execution_count": 71, "id": "429e0c4e", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 158 entries, 0 to 157\n", "Data columns (total 39 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 brand 158 non-null str \n", " 1 name 158 non-null str \n", " 2 lightweight 152 non-null float64\n", " 3 torsional rigidity 158 non-null str \n", " 4 heel counter stiffness 158 non-null str \n", " 5 lug depth 158 non-null str \n", " 6 heel stack lab heel stack brand 158 non-null str \n", " 7 forefoot lab forefoot brand 158 non-null str \n", " 8 season 158 non-null str \n", " 9 removable insole 158 non-null int64 \n", " 10 orthotic friendly 158 non-null int64 \n", " 11 waterproofing 156 non-null str \n", " 12 terrain_light 158 non-null int64 \n", " 13 terrain_moderate 158 non-null int64 \n", " 14 terrain_technical 158 non-null int64 \n", " 15 shock_absorption 158 non-null int64 \n", " 16 energy_return 158 non-null int64 \n", " 17 traction_scaled 158 non-null int64 \n", " 18 arch_neutral 158 non-null int64 \n", " 19 arch_stability 158 non-null int64 \n", " 20 weight_lab_oz 158 non-null float64\n", " 21 weight_lab_g 158 non-null int64 \n", " 22 weight_brand_oz 155 non-null float64\n", " 23 weight_brand_g 155 non-null float64\n", " 24 drop_lab_mm 158 non-null float64\n", " 25 drop_brand_mm 152 non-null float64\n", " 26 strike_heel 158 non-null int64 \n", " 27 strike_mid 158 non-null int64 \n", " 28 strike_forefoot 158 non-null int64 \n", " 29 midsole_softness 158 non-null int64 \n", " 30 toebox_durability 158 non-null int64 \n", " 31 heel_durability 158 non-null int64 \n", " 32 outsole_durability 158 non-null int64 \n", " 33 breathability_scaled 158 non-null int64 \n", " 34 plate_rock_plate 158 non-null int64 \n", " 35 plate_carbon_plate 158 non-null int64 \n", " 36 width_fit 158 non-null int64 \n", " 37 toebox_width 158 non-null int64 \n", " 38 stiffness_scaled 158 non-null int64 \n", "dtypes: float64(6), int64(24), str(9)\n", "memory usage: 48.3 KB\n" ] } ], "source": [ "df.drop(columns=[\"stiffness\"], inplace=True)\n", "df.info()" ] }, { "cell_type": "markdown", "id": "347d1f39", "metadata": {}, "source": [ "## Torsional rigidity" ] }, { "cell_type": "code", "execution_count": 72, "id": "898bbd3d", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "torsional rigidity\n", "stiff 93\n", "moderate 37\n", "flexible 22\n", "- 6\n", "Name: count, dtype: int64\n" ] } ], "source": [ "print(df['torsional rigidity'].value_counts())" ] }, { "cell_type": "code", "execution_count": 73, "id": "94fbcfb9", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "--- Value Counts Kolom Asli ---\n", "torsional rigidity\n", "stiff 93\n", "moderate 37\n", "flexible 22\n", "- 6\n", "Name: count, dtype: int64\n", "\n", "--- Sebaran Nilai Hasil Ordinal (Scale 0-5) ---\n", "Index 0: 6 baris\n", "Index 1: 22 baris\n", "Index 2: 0 baris\n", "Index 3: 37 baris\n", "Index 4: 0 baris\n", "Index 5: 93 baris\n", "\n", "--- Perbandingan Data (Head) ---\n", " torsional rigidity torsional_rigidity\n", "0 stiff 5\n", "1 flexible 1\n", "2 stiff 5\n", "3 moderate 3\n", "4 flexible 1\n" ] } ], "source": [ "torsional_scaled = {\n", " \"flexible\": 1,\n", " \"moderate\": 3,\n", " \"stiff\": 5,\n", " \"-\": 0,\n", " \"0\": 0,\n", " \"nan\": 0 \n", "}\n", "\n", "df['torsional_rigidity'] = df['torsional rigidity'].map(torsional_scaled).fillna(0).astype(int)\n", "\n", "print(\"--- Value Counts Kolom Asli ---\")\n", "print(df[\"torsional rigidity\"].value_counts())\n", "\n", "print(\"\\n--- Sebaran Nilai Hasil Ordinal (Scale 0-5) ---\")\n", "counts = df[\"torsional_rigidity\"].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[[\"torsional rigidity\", \"torsional_rigidity\"]].head())" ] }, { "cell_type": "code", "execution_count": 74, "id": "5087be70", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 158 entries, 0 to 157\n", "Data columns (total 39 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 brand 158 non-null str \n", " 1 name 158 non-null str \n", " 2 lightweight 152 non-null float64\n", " 3 heel counter stiffness 158 non-null str \n", " 4 lug depth 158 non-null str \n", " 5 heel stack lab heel stack brand 158 non-null str \n", " 6 forefoot lab forefoot brand 158 non-null str \n", " 7 season 158 non-null str \n", " 8 removable insole 158 non-null int64 \n", " 9 orthotic friendly 158 non-null int64 \n", " 10 waterproofing 156 non-null str \n", " 11 terrain_light 158 non-null int64 \n", " 12 terrain_moderate 158 non-null int64 \n", " 13 terrain_technical 158 non-null int64 \n", " 14 shock_absorption 158 non-null int64 \n", " 15 energy_return 158 non-null int64 \n", " 16 traction_scaled 158 non-null int64 \n", " 17 arch_neutral 158 non-null int64 \n", " 18 arch_stability 158 non-null int64 \n", " 19 weight_lab_oz 158 non-null float64\n", " 20 weight_lab_g 158 non-null int64 \n", " 21 weight_brand_oz 155 non-null float64\n", " 22 weight_brand_g 155 non-null float64\n", " 23 drop_lab_mm 158 non-null float64\n", " 24 drop_brand_mm 152 non-null float64\n", " 25 strike_heel 158 non-null int64 \n", " 26 strike_mid 158 non-null int64 \n", " 27 strike_forefoot 158 non-null int64 \n", " 28 midsole_softness 158 non-null int64 \n", " 29 toebox_durability 158 non-null int64 \n", " 30 heel_durability 158 non-null int64 \n", " 31 outsole_durability 158 non-null int64 \n", " 32 breathability_scaled 158 non-null int64 \n", " 33 plate_rock_plate 158 non-null int64 \n", " 34 plate_carbon_plate 158 non-null int64 \n", " 35 width_fit 158 non-null int64 \n", " 36 toebox_width 158 non-null int64 \n", " 37 stiffness_scaled 158 non-null int64 \n", " 38 torsional_rigidity 158 non-null int64 \n", "dtypes: float64(6), int64(25), str(8)\n", "memory usage: 48.3 KB\n" ] } ], "source": [ "df.drop(columns=[\"torsional rigidity\"], inplace=True)\n", "df.info()" ] }, { "cell_type": "markdown", "id": "4fab1922", "metadata": {}, "source": [ "## Heel counter stiffness" ] }, { "cell_type": "code", "execution_count": 75, "id": "d17ba028", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "heel counter stiffness\n", "moderate 55\n", "stiff 49\n", "flexible 46\n", "- 8\n", "Name: count, dtype: int64\n" ] } ], "source": [ "print(df['heel counter stiffness'].value_counts())" ] }, { "cell_type": "code", "execution_count": 76, "id": "1ffb3c8c", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Rows: 158\n", "NULL Value (tidak cocok dengan kategori): 0\n", "\n", "Sample Comparison:\n", " heel counter stiffness heel_stiff\n", "0 flexible 1\n", "1 flexible 1\n", "2 moderate 3\n", "3 flexible 1\n", "4 - 0\n", "5 - 0\n", "6 flexible 1\n", "7 flexible 1\n", "8 flexible 1\n", "9 - 0\n" ] } ], "source": [ "heel_stiff_map = {\n", " 'flexible': 1,\n", " 'moderate': 3,\n", " 'stiff': 5\n", "}\n", "\n", "df['heel_stiff'] = df['heel counter stiffness'].map(heel_stiff_map).fillna(0).astype(int)\n", "\n", "# Cek hasil\n", "print(f\"Rows: {len(df)}\")\n", "print(f\"NULL Value (tidak cocok dengan kategori): {df['heel_stiff'].isna().sum()}\")\n", "print(\"\\nSample Comparison:\")\n", "print(df[['heel counter stiffness', 'heel_stiff']].head(10))" ] }, { "cell_type": "code", "execution_count": 77, "id": "65d93f9a", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 158 entries, 0 to 157\n", "Data columns (total 39 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 brand 158 non-null str \n", " 1 name 158 non-null str \n", " 2 lightweight 152 non-null float64\n", " 3 lug depth 158 non-null str \n", " 4 heel stack lab heel stack brand 158 non-null str \n", " 5 forefoot lab forefoot brand 158 non-null str \n", " 6 season 158 non-null str \n", " 7 removable insole 158 non-null int64 \n", " 8 orthotic friendly 158 non-null int64 \n", " 9 waterproofing 156 non-null str \n", " 10 terrain_light 158 non-null int64 \n", " 11 terrain_moderate 158 non-null int64 \n", " 12 terrain_technical 158 non-null int64 \n", " 13 shock_absorption 158 non-null int64 \n", " 14 energy_return 158 non-null int64 \n", " 15 traction_scaled 158 non-null int64 \n", " 16 arch_neutral 158 non-null int64 \n", " 17 arch_stability 158 non-null int64 \n", " 18 weight_lab_oz 158 non-null float64\n", " 19 weight_lab_g 158 non-null int64 \n", " 20 weight_brand_oz 155 non-null float64\n", " 21 weight_brand_g 155 non-null float64\n", " 22 drop_lab_mm 158 non-null float64\n", " 23 drop_brand_mm 152 non-null float64\n", " 24 strike_heel 158 non-null int64 \n", " 25 strike_mid 158 non-null int64 \n", " 26 strike_forefoot 158 non-null int64 \n", " 27 midsole_softness 158 non-null int64 \n", " 28 toebox_durability 158 non-null int64 \n", " 29 heel_durability 158 non-null int64 \n", " 30 outsole_durability 158 non-null int64 \n", " 31 breathability_scaled 158 non-null int64 \n", " 32 plate_rock_plate 158 non-null int64 \n", " 33 plate_carbon_plate 158 non-null int64 \n", " 34 width_fit 158 non-null int64 \n", " 35 toebox_width 158 non-null int64 \n", " 36 stiffness_scaled 158 non-null int64 \n", " 37 torsional_rigidity 158 non-null int64 \n", " 38 heel_stiff 158 non-null int64 \n", "dtypes: float64(6), int64(26), str(7)\n", "memory usage: 48.3 KB\n" ] } ], "source": [ "df.drop(columns=[\"heel counter stiffness\"], inplace=True)\n", "df.info()" ] }, { "cell_type": "markdown", "id": "62efa68c", "metadata": {}, "source": [ "## Lug depth" ] }, { "cell_type": "code", "execution_count": 78, "id": "3c47127b", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "0 2.5 mm\n", "1 2.6 mm\n", "2 3.6 mm\n", "3 3.5 mm\n", "4 3.7 mm\n", "Name: lug depth, dtype: str\n" ] } ], "source": [ "print(df[\"lug depth\"].head())" ] }, { "cell_type": "code", "execution_count": 79, "id": "31d7c1e3", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "--- Value Counts Kolom Asli ---\n", "lug depth\n", "3.5 mm 15\n", "3.0 mm 14\n", "4.0 mm 12\n", "3.4 mm 11\n", "2.5 mm 7\n", "2.9 mm 7\n", "3.2 mm 7\n", "3.6 mm 6\n", "3.7 mm 6\n", "4.4 mm 6\n", "Name: count, dtype: int64\n", "\n", " lug depth lug_dept_mm\n", "0 2.5 mm 2.5\n", "1 2.6 mm 2.6\n", "2 3.6 mm 3.6\n", "3 3.5 mm 3.5\n", "4 3.7 mm 3.7\n" ] } ], "source": [ "df['lug_dept_mm'] = df['lug depth'].astype(str).str.replace(' mm', '', regex=False)\n", "df['lug_dept_mm'] = pd.to_numeric(df['lug_dept_mm'].replace('-', '0'), errors='coerce').fillna(0)\n", "\n", "print(\"--- Value Counts Kolom Asli ---\")\n", "print(df[\"lug depth\"].value_counts().head(10))\n", "\n", "print()\n", "print(df[[\"lug depth\", \"lug_dept_mm\"]].head())" ] }, { "cell_type": "code", "execution_count": 80, "id": "e7b1ee60", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 158 entries, 0 to 157\n", "Data columns (total 39 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 brand 158 non-null str \n", " 1 name 158 non-null str \n", " 2 lightweight 152 non-null float64\n", " 3 heel stack lab heel stack brand 158 non-null str \n", " 4 forefoot lab forefoot brand 158 non-null str \n", " 5 season 158 non-null str \n", " 6 removable insole 158 non-null int64 \n", " 7 orthotic friendly 158 non-null int64 \n", " 8 waterproofing 156 non-null str \n", " 9 terrain_light 158 non-null int64 \n", " 10 terrain_moderate 158 non-null int64 \n", " 11 terrain_technical 158 non-null int64 \n", " 12 shock_absorption 158 non-null int64 \n", " 13 energy_return 158 non-null int64 \n", " 14 traction_scaled 158 non-null int64 \n", " 15 arch_neutral 158 non-null int64 \n", " 16 arch_stability 158 non-null int64 \n", " 17 weight_lab_oz 158 non-null float64\n", " 18 weight_lab_g 158 non-null int64 \n", " 19 weight_brand_oz 155 non-null float64\n", " 20 weight_brand_g 155 non-null float64\n", " 21 drop_lab_mm 158 non-null float64\n", " 22 drop_brand_mm 152 non-null float64\n", " 23 strike_heel 158 non-null int64 \n", " 24 strike_mid 158 non-null int64 \n", " 25 strike_forefoot 158 non-null int64 \n", " 26 midsole_softness 158 non-null int64 \n", " 27 toebox_durability 158 non-null int64 \n", " 28 heel_durability 158 non-null int64 \n", " 29 outsole_durability 158 non-null int64 \n", " 30 breathability_scaled 158 non-null int64 \n", " 31 plate_rock_plate 158 non-null int64 \n", " 32 plate_carbon_plate 158 non-null int64 \n", " 33 width_fit 158 non-null int64 \n", " 34 toebox_width 158 non-null int64 \n", " 35 stiffness_scaled 158 non-null int64 \n", " 36 torsional_rigidity 158 non-null int64 \n", " 37 heel_stiff 158 non-null int64 \n", " 38 lug_dept_mm 158 non-null float64\n", "dtypes: float64(7), int64(26), str(6)\n", "memory usage: 48.3 KB\n" ] } ], "source": [ "df.drop(columns=[\"lug depth\"], inplace=True)\n", "df.info()" ] }, { "cell_type": "markdown", "id": "edb40b00", "metadata": {}, "source": [ "## Heel stack lab Heel stack brand" ] }, { "cell_type": "code", "execution_count": 81, "id": "6f8956df", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "0 30.6 mm 38.0 mm\n", "1 32.8 mm 26.0 mm\n", "2 34.5 mm 34.0 mm\n", "3 32.3 mm 32.0 mm\n", "4 24.5 mm 25.0 mm\n", "Name: heel stack lab heel stack brand, dtype: str\n" ] } ], "source": [ "print(df[\"heel stack lab heel stack brand\"].head())" ] }, { "cell_type": "code", "execution_count": 82, "id": "9123ea7c", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "np.int64(0)" ] }, "execution_count": 82, "metadata": {}, "output_type": "execute_result" } ], "source": [ "mask_missing = (\n", " df[\"heel stack lab heel stack brand\"].isna() |\n", " (df[\"heel stack lab heel stack brand\"].astype(str).str.strip() == \"-\")\n", ")\n", "mask_missing.sum()" ] }, { "cell_type": "code", "execution_count": 83, "id": "dc55349b", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " heel stack lab heel stack brand heel_lab_mm heel_brand_mm\n", "0 30.6 mm 38.0 mm 30.6 38.0\n", "1 32.8 mm 26.0 mm 32.8 26.0\n", "2 34.5 mm 34.0 mm 34.5 34.0\n", "3 32.3 mm 32.0 mm 32.3 32.0\n", "4 24.5 mm 25.0 mm 24.5 25.0\n" ] } ], "source": [ "heel = df[\"heel stack lab heel stack 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 stack lab heel stack brand\", \"heel_lab_mm\", \"heel_brand_mm\"]].head())" ] }, { "cell_type": "code", "execution_count": 84, "id": "2f899e58", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 158 entries, 0 to 157\n", "Data columns (total 40 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 brand 158 non-null str \n", " 1 name 158 non-null str \n", " 2 lightweight 152 non-null float64\n", " 3 forefoot lab forefoot brand 158 non-null str \n", " 4 season 158 non-null str \n", " 5 removable insole 158 non-null int64 \n", " 6 orthotic friendly 158 non-null int64 \n", " 7 waterproofing 156 non-null str \n", " 8 terrain_light 158 non-null int64 \n", " 9 terrain_moderate 158 non-null int64 \n", " 10 terrain_technical 158 non-null int64 \n", " 11 shock_absorption 158 non-null int64 \n", " 12 energy_return 158 non-null int64 \n", " 13 traction_scaled 158 non-null int64 \n", " 14 arch_neutral 158 non-null int64 \n", " 15 arch_stability 158 non-null int64 \n", " 16 weight_lab_oz 158 non-null float64\n", " 17 weight_lab_g 158 non-null int64 \n", " 18 weight_brand_oz 155 non-null float64\n", " 19 weight_brand_g 155 non-null float64\n", " 20 drop_lab_mm 158 non-null float64\n", " 21 drop_brand_mm 152 non-null float64\n", " 22 strike_heel 158 non-null int64 \n", " 23 strike_mid 158 non-null int64 \n", " 24 strike_forefoot 158 non-null int64 \n", " 25 midsole_softness 158 non-null int64 \n", " 26 toebox_durability 158 non-null int64 \n", " 27 heel_durability 158 non-null int64 \n", " 28 outsole_durability 158 non-null int64 \n", " 29 breathability_scaled 158 non-null int64 \n", " 30 plate_rock_plate 158 non-null int64 \n", " 31 plate_carbon_plate 158 non-null int64 \n", " 32 width_fit 158 non-null int64 \n", " 33 toebox_width 158 non-null int64 \n", " 34 stiffness_scaled 158 non-null int64 \n", " 35 torsional_rigidity 158 non-null int64 \n", " 36 heel_stiff 158 non-null int64 \n", " 37 lug_dept_mm 158 non-null float64\n", " 38 heel_lab_mm 158 non-null float64\n", " 39 heel_brand_mm 145 non-null float64\n", "dtypes: float64(9), int64(26), str(5)\n", "memory usage: 49.5 KB\n" ] } ], "source": [ "df.drop(columns=[\"heel stack lab heel stack brand\"], inplace=True)\n", "df.info()" ] }, { "cell_type": "markdown", "id": "69155f32", "metadata": {}, "source": [ "## Forefoot lab Forefoot brand" ] }, { "cell_type": "code", "execution_count": 85, "id": "586618dc", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "0 30.3 mm 30.0 mm\n", "1 24.6 mm 18.0 mm\n", "2 30.2 mm 30.0 mm\n", "3 26.2 mm 28.0 mm\n", "4 24.3 mm 25.0 mm\n", "Name: forefoot lab forefoot brand, dtype: str\n" ] } ], "source": [ "print(df['forefoot lab forefoot brand'].head())" ] }, { "cell_type": "code", "execution_count": 86, "id": "b1323541", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "np.int64(0)" ] }, "execution_count": 86, "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": 87, "id": "a29bbb63", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " forefoot lab forefoot brand forefoot_lab_mm forefoot_brand_mm\n", "0 30.3 mm 30.0 mm 30.3 30.0\n", "1 24.6 mm 18.0 mm 24.6 18.0\n", "2 30.2 mm 30.0 mm 30.2 30.0\n", "3 26.2 mm 28.0 mm 26.2 28.0\n", "4 24.3 mm 25.0 mm 24.3 25.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": 88, "id": "081b4449", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 158 entries, 0 to 157\n", "Data columns (total 41 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 brand 158 non-null str \n", " 1 name 158 non-null str \n", " 2 lightweight 152 non-null float64\n", " 3 season 158 non-null str \n", " 4 removable insole 158 non-null int64 \n", " 5 orthotic friendly 158 non-null int64 \n", " 6 waterproofing 156 non-null str \n", " 7 terrain_light 158 non-null int64 \n", " 8 terrain_moderate 158 non-null int64 \n", " 9 terrain_technical 158 non-null int64 \n", " 10 shock_absorption 158 non-null int64 \n", " 11 energy_return 158 non-null int64 \n", " 12 traction_scaled 158 non-null int64 \n", " 13 arch_neutral 158 non-null int64 \n", " 14 arch_stability 158 non-null int64 \n", " 15 weight_lab_oz 158 non-null float64\n", " 16 weight_lab_g 158 non-null int64 \n", " 17 weight_brand_oz 155 non-null float64\n", " 18 weight_brand_g 155 non-null float64\n", " 19 drop_lab_mm 158 non-null float64\n", " 20 drop_brand_mm 152 non-null float64\n", " 21 strike_heel 158 non-null int64 \n", " 22 strike_mid 158 non-null int64 \n", " 23 strike_forefoot 158 non-null int64 \n", " 24 midsole_softness 158 non-null int64 \n", " 25 toebox_durability 158 non-null int64 \n", " 26 heel_durability 158 non-null int64 \n", " 27 outsole_durability 158 non-null int64 \n", " 28 breathability_scaled 158 non-null int64 \n", " 29 plate_rock_plate 158 non-null int64 \n", " 30 plate_carbon_plate 158 non-null int64 \n", " 31 width_fit 158 non-null int64 \n", " 32 toebox_width 158 non-null int64 \n", " 33 stiffness_scaled 158 non-null int64 \n", " 34 torsional_rigidity 158 non-null int64 \n", " 35 heel_stiff 158 non-null int64 \n", " 36 lug_dept_mm 158 non-null float64\n", " 37 heel_lab_mm 158 non-null float64\n", " 38 heel_brand_mm 145 non-null float64\n", " 39 forefoot_lab_mm 158 non-null float64\n", " 40 forefoot_brand_mm 143 non-null float64\n", "dtypes: float64(11), int64(26), str(4)\n", "memory usage: 50.7 KB\n" ] } ], "source": [ "df.drop(columns=[\"forefoot lab forefoot brand\"], inplace=True)\n", "df.info()" ] }, { "cell_type": "markdown", "id": "21494e05", "metadata": {}, "source": [ "## Season" ] }, { "cell_type": "code", "execution_count": 89, "id": "c3e07080", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "season\n", "all seasons 107\n", "- 19\n", "summer all seasons 15\n", "winter 15\n", "0 1\n", "summerall seasons 1\n", "Name: count, dtype: int64\n" ] } ], "source": [ "print(df[\"season\"].value_counts())" ] }, { "cell_type": "markdown", "id": "93dfd937", "metadata": {}, "source": [ "Summer All seasons = sepatu yang dirancang secara spesifik untuk summer tapi diklaim bisa dipakai all season" ] }, { "cell_type": "code", "execution_count": 90, "id": "fa7f5747", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Jumlah baris dengan '-' atau '0': 20\n", "\n", "--- Detail Baris (season = '-' atau '0') ---\n", " brand name season\n", "1 adidas terrex speed ultra -\n", "4 altra lone peak 5.0 -\n", "5 altra lone peak 6 -\n", "9 altra mont blanc -\n", "36 brooks cascadia 16 -\n", "57 hoka tecton x -\n", "61 hoka zinal -\n", "67 inov8 trailtalon 0\n", "68 kailas flythorn air 2.0 -\n", "70 kailas fuga elite 2 -\n", "71 kailas fuga ex 2 -\n", "73 kailas fuga ex boa -\n", "75 kailas fuga pro 4 -\n", "89 merrell nova 2 -\n", "101 nike air zoom terra kiger 6 -\n", "104 nike pegasus trail 4 -\n", "124 salomon sense pro 4 -\n", "140 saucony endorphin trail -\n", "141 saucony peregrine 11 -\n", "142 saucony peregrine 12 -\n", "\n", "Frekuensi spesifik:\n", "season\n", "- 19\n", "0 1\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": 91, "id": "40f37790", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Rows: 158\n", "NULL/Unknown Value (0 dan -): 20\n", "\n", "Sample Comparison (Multi-label):\n", " season season_summer season_winter season_all\n", "13 summer all seasons 1 0 1\n", "17 summer all seasons 1 0 1\n", "26 summer all seasons 1 0 1\n", "28 summer all seasons 1 0 1\n", "29 summer all 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": 92, "id": "39a01a66", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "season\n", "all seasons 107\n", "- 19\n", "summer all seasons 15\n", "winter 15\n", "0 1\n", "summerall seasons 1\n", "Name: count, dtype: int64\n", "\n", "season_summer sum: 16\n", "season_winter sum: 15\n", "season_all sum: 123\n", "\n", " season season_summer season_winter season_all\n", "0 all seasons 0 0 1\n", "1 - 0 0 0\n", "2 all seasons 0 0 1\n", "3 all seasons 0 0 1\n", "4 - 0 0 0\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": 93, "id": "d8eea361", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 158 entries, 0 to 157\n", "Data columns (total 43 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 brand 158 non-null str \n", " 1 name 158 non-null str \n", " 2 lightweight 152 non-null float64\n", " 3 removable insole 158 non-null int64 \n", " 4 orthotic friendly 158 non-null int64 \n", " 5 waterproofing 156 non-null str \n", " 6 terrain_light 158 non-null int64 \n", " 7 terrain_moderate 158 non-null int64 \n", " 8 terrain_technical 158 non-null int64 \n", " 9 shock_absorption 158 non-null int64 \n", " 10 energy_return 158 non-null int64 \n", " 11 traction_scaled 158 non-null int64 \n", " 12 arch_neutral 158 non-null int64 \n", " 13 arch_stability 158 non-null int64 \n", " 14 weight_lab_oz 158 non-null float64\n", " 15 weight_lab_g 158 non-null int64 \n", " 16 weight_brand_oz 155 non-null float64\n", " 17 weight_brand_g 155 non-null float64\n", " 18 drop_lab_mm 158 non-null float64\n", " 19 drop_brand_mm 152 non-null float64\n", " 20 strike_heel 158 non-null int64 \n", " 21 strike_mid 158 non-null int64 \n", " 22 strike_forefoot 158 non-null int64 \n", " 23 midsole_softness 158 non-null int64 \n", " 24 toebox_durability 158 non-null int64 \n", " 25 heel_durability 158 non-null int64 \n", " 26 outsole_durability 158 non-null int64 \n", " 27 breathability_scaled 158 non-null int64 \n", " 28 plate_rock_plate 158 non-null int64 \n", " 29 plate_carbon_plate 158 non-null int64 \n", " 30 width_fit 158 non-null int64 \n", " 31 toebox_width 158 non-null int64 \n", " 32 stiffness_scaled 158 non-null int64 \n", " 33 torsional_rigidity 158 non-null int64 \n", " 34 heel_stiff 158 non-null int64 \n", " 35 lug_dept_mm 158 non-null float64\n", " 36 heel_lab_mm 158 non-null float64\n", " 37 heel_brand_mm 145 non-null float64\n", " 38 forefoot_lab_mm 158 non-null float64\n", " 39 forefoot_brand_mm 143 non-null float64\n", " 40 season_summer 158 non-null int64 \n", " 41 season_winter 158 non-null int64 \n", " 42 season_all 158 non-null int64 \n", "dtypes: float64(11), int64(29), str(3)\n", "memory usage: 53.2 KB\n" ] } ], "source": [ "df.drop(columns=[\"season\"], inplace=True)\n", "df.info()" ] }, { "cell_type": "code", "execution_count": 94, "id": "acdd890f", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " brand name removable insole orthotic friendly\n", "0 adidas terrex agravic speed ultra 1 1\n", "1 adidas terrex speed ultra 1 1\n", "2 altra experience wild 1 1\n", "3 altra experience wild 2 1 1\n", "4 altra lone peak 5.0 1 1\n" ] } ], "source": [ "print(df[[\"brand\", \"name\", \"removable insole\", \"orthotic friendly\"]].head())" ] }, { "cell_type": "markdown", "id": "00fb8fe8", "metadata": {}, "source": [ "## Removable insole" ] }, { "cell_type": "code", "execution_count": 95, "id": "68f9c5b7", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "removable insole\n", "1 147\n", "0 11\n", "Name: count, dtype: int64\n" ] } ], "source": [ "print(df[\"removable insole\"].value_counts())" ] }, { "cell_type": "code", "execution_count": 96, "id": "4916d5ba", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " removable insole removable_insole\n", "0 1 1\n", "1 1 1\n", "2 1 1\n", "3 1 1\n", "4 1 1\n" ] } ], "source": [ "# rename Removable insole to removable_insole\n", "df['removable_insole'] = df['removable insole'].fillna(0).astype(int)\n", "print(df[['removable insole', 'removable_insole']].head())" ] }, { "cell_type": "code", "execution_count": 97, "id": "9eb46039", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 158 entries, 0 to 157\n", "Data columns (total 43 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 brand 158 non-null str \n", " 1 name 158 non-null str \n", " 2 lightweight 152 non-null float64\n", " 3 orthotic friendly 158 non-null int64 \n", " 4 waterproofing 156 non-null str \n", " 5 terrain_light 158 non-null int64 \n", " 6 terrain_moderate 158 non-null int64 \n", " 7 terrain_technical 158 non-null int64 \n", " 8 shock_absorption 158 non-null int64 \n", " 9 energy_return 158 non-null int64 \n", " 10 traction_scaled 158 non-null int64 \n", " 11 arch_neutral 158 non-null int64 \n", " 12 arch_stability 158 non-null int64 \n", " 13 weight_lab_oz 158 non-null float64\n", " 14 weight_lab_g 158 non-null int64 \n", " 15 weight_brand_oz 155 non-null float64\n", " 16 weight_brand_g 155 non-null float64\n", " 17 drop_lab_mm 158 non-null float64\n", " 18 drop_brand_mm 152 non-null float64\n", " 19 strike_heel 158 non-null int64 \n", " 20 strike_mid 158 non-null int64 \n", " 21 strike_forefoot 158 non-null int64 \n", " 22 midsole_softness 158 non-null int64 \n", " 23 toebox_durability 158 non-null int64 \n", " 24 heel_durability 158 non-null int64 \n", " 25 outsole_durability 158 non-null int64 \n", " 26 breathability_scaled 158 non-null int64 \n", " 27 plate_rock_plate 158 non-null int64 \n", " 28 plate_carbon_plate 158 non-null int64 \n", " 29 width_fit 158 non-null int64 \n", " 30 toebox_width 158 non-null int64 \n", " 31 stiffness_scaled 158 non-null int64 \n", " 32 torsional_rigidity 158 non-null int64 \n", " 33 heel_stiff 158 non-null int64 \n", " 34 lug_dept_mm 158 non-null float64\n", " 35 heel_lab_mm 158 non-null float64\n", " 36 heel_brand_mm 145 non-null float64\n", " 37 forefoot_lab_mm 158 non-null float64\n", " 38 forefoot_brand_mm 143 non-null float64\n", " 39 season_summer 158 non-null int64 \n", " 40 season_winter 158 non-null int64 \n", " 41 season_all 158 non-null int64 \n", " 42 removable_insole 158 non-null int64 \n", "dtypes: float64(11), int64(29), str(3)\n", "memory usage: 53.2 KB\n" ] } ], "source": [ "df.drop(columns=['removable insole'], inplace=True)\n", "df.info()" ] }, { "cell_type": "markdown", "id": "f145cc43", "metadata": {}, "source": [ "## Orthotic friendly" ] }, { "cell_type": "code", "execution_count": 98, "id": "d52a6df6", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "orthotic friendly\n", "1 147\n", "0 11\n", "Name: count, dtype: int64\n" ] } ], "source": [ "print(df[\"orthotic friendly\"].value_counts())" ] }, { "cell_type": "code", "execution_count": 99, "id": "8f548dc5", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " orthotic friendly orthotic_friendly\n", "0 1 1\n", "1 1 1\n", "2 1 1\n", "3 1 1\n", "4 1 1\n" ] } ], "source": [ "# Rename Orthotic friendly to orthotic_friendly\n", "df['orthotic_friendly'] = df['orthotic friendly'].fillna(0).astype(int)\n", "print(df[['orthotic friendly', 'orthotic_friendly']].head())" ] }, { "cell_type": "code", "execution_count": 100, "id": "059a1824", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 158 entries, 0 to 157\n", "Data columns (total 43 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 brand 158 non-null str \n", " 1 name 158 non-null str \n", " 2 lightweight 152 non-null float64\n", " 3 waterproofing 156 non-null str \n", " 4 terrain_light 158 non-null int64 \n", " 5 terrain_moderate 158 non-null int64 \n", " 6 terrain_technical 158 non-null int64 \n", " 7 shock_absorption 158 non-null int64 \n", " 8 energy_return 158 non-null int64 \n", " 9 traction_scaled 158 non-null int64 \n", " 10 arch_neutral 158 non-null int64 \n", " 11 arch_stability 158 non-null int64 \n", " 12 weight_lab_oz 158 non-null float64\n", " 13 weight_lab_g 158 non-null int64 \n", " 14 weight_brand_oz 155 non-null float64\n", " 15 weight_brand_g 155 non-null float64\n", " 16 drop_lab_mm 158 non-null float64\n", " 17 drop_brand_mm 152 non-null float64\n", " 18 strike_heel 158 non-null int64 \n", " 19 strike_mid 158 non-null int64 \n", " 20 strike_forefoot 158 non-null int64 \n", " 21 midsole_softness 158 non-null int64 \n", " 22 toebox_durability 158 non-null int64 \n", " 23 heel_durability 158 non-null int64 \n", " 24 outsole_durability 158 non-null int64 \n", " 25 breathability_scaled 158 non-null int64 \n", " 26 plate_rock_plate 158 non-null int64 \n", " 27 plate_carbon_plate 158 non-null int64 \n", " 28 width_fit 158 non-null int64 \n", " 29 toebox_width 158 non-null int64 \n", " 30 stiffness_scaled 158 non-null int64 \n", " 31 torsional_rigidity 158 non-null int64 \n", " 32 heel_stiff 158 non-null int64 \n", " 33 lug_dept_mm 158 non-null float64\n", " 34 heel_lab_mm 158 non-null float64\n", " 35 heel_brand_mm 145 non-null float64\n", " 36 forefoot_lab_mm 158 non-null float64\n", " 37 forefoot_brand_mm 143 non-null float64\n", " 38 season_summer 158 non-null int64 \n", " 39 season_winter 158 non-null int64 \n", " 40 season_all 158 non-null int64 \n", " 41 removable_insole 158 non-null int64 \n", " 42 orthotic_friendly 158 non-null int64 \n", "dtypes: float64(11), int64(29), str(3)\n", "memory usage: 53.2 KB\n" ] } ], "source": [ "df.drop(columns=['orthotic friendly'], inplace=True)\n", "df.info()" ] }, { "cell_type": "markdown", "id": "442b3a27", "metadata": {}, "source": [ "## Waterproofing " ] }, { "cell_type": "code", "execution_count": 101, "id": "a056f12c", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "waterproofing\n", "- 137\n", "waterproof 12\n", "water repellent 5\n", "waterproof water repellent 1\n", "0 1\n", "Name: count, dtype: int64\n" ] } ], "source": [ "print(df['waterproofing'].value_counts())" ] }, { "cell_type": "markdown", "id": "7494a16e", "metadata": {}, "source": [ "Water repellent cuma nahan menolak air di permukaan tapi kalau terendam, kakinya tetap basah. kalau waterproof bener bener tahan air" ] }, { "cell_type": "code", "execution_count": 102, "id": "d52d4d09", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Rows: 158\n", "\n", "Sample Comparison:\n", " waterproofing waterproof water_repellent\n", "0 - 0 0\n", "1 - 0 0\n", "2 - 0 0\n", "3 - 0 0\n", "4 - 0 0\n", "5 - 0 0\n", "6 - 0 0\n", "7 - 0 0\n", "8 - 0 0\n", "9 - 0 0\n" ] } ], "source": [ "df['waterproofing'] = df['waterproofing'].astype(str).str.lower()\n", "base_water = ['waterproof', 'water repellent']\n", "\n", "def check_not_waterproof(val):\n", " if val in ['-', '0', 'nan', 'none']:\n", " return 1\n", " return 0\n", "\n", "for level in base_water:\n", " column_name = level.replace(' ', '_')\n", " \n", " if level == 'not waterproof':\n", " df[column_name] = df['waterproofing'].apply(check_not_waterproof)\n", " else:\n", " df[column_name] = df['waterproofing'].str.contains(level, na=False).astype(int)\n", " df.loc[df['waterproofing'].isin(['-', '0']), column_name] = 0\n", "\n", "print(\"Rows:\", len(df))\n", "\n", "water_cols = [l.replace(' ', '_') for l in base_water]\n", "\n", "print(\"\\nSample Comparison:\")\n", "print(df[[\"waterproofing\"] + water_cols].head(10))\n" ] }, { "cell_type": "code", "execution_count": 103, "id": "9d6e1eb8", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "waterproofing\n", "- 137\n", "waterproof 12\n", "water repellent 5\n", "waterproof water repellent 1\n", "0 1\n", "Name: count, dtype: int64\n", "\n", "--- Sum Per Kolom ---\n", "waterproof sum: 13\n", "water_repellent sum: 6\n", "\n", "Total Check (Harus >= 158): 19\n", "\n", " waterproofing waterproof water_repellent\n", "0 - 0 0\n", "1 - 0 0\n", "2 - 0 0\n", "3 - 0 0\n", "4 - 0 0\n" ] } ], "source": [ "print(df[\"waterproofing\"].value_counts())\n", "\n", "print(\"\\n--- Sum Per Kolom ---\")\n", "for col in water_cols:\n", " print(f\"{col} sum:\", int(df[col].sum()))\n", "\n", "total_sum = df[water_cols].sum().sum()\n", "print(f\"\\nTotal Check (Harus >= {len(df)}): {total_sum}\")\n", "\n", "print()\n", "print(df[[\"waterproofing\"] + water_cols].head())" ] }, { "cell_type": "code", "execution_count": 104, "id": "1804482a", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 158 entries, 0 to 157\n", "Data columns (total 44 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 brand 158 non-null str \n", " 1 name 158 non-null str \n", " 2 lightweight 152 non-null float64\n", " 3 terrain_light 158 non-null int64 \n", " 4 terrain_moderate 158 non-null int64 \n", " 5 terrain_technical 158 non-null int64 \n", " 6 shock_absorption 158 non-null int64 \n", " 7 energy_return 158 non-null int64 \n", " 8 traction_scaled 158 non-null int64 \n", " 9 arch_neutral 158 non-null int64 \n", " 10 arch_stability 158 non-null int64 \n", " 11 weight_lab_oz 158 non-null float64\n", " 12 weight_lab_g 158 non-null int64 \n", " 13 weight_brand_oz 155 non-null float64\n", " 14 weight_brand_g 155 non-null float64\n", " 15 drop_lab_mm 158 non-null float64\n", " 16 drop_brand_mm 152 non-null float64\n", " 17 strike_heel 158 non-null int64 \n", " 18 strike_mid 158 non-null int64 \n", " 19 strike_forefoot 158 non-null int64 \n", " 20 midsole_softness 158 non-null int64 \n", " 21 toebox_durability 158 non-null int64 \n", " 22 heel_durability 158 non-null int64 \n", " 23 outsole_durability 158 non-null int64 \n", " 24 breathability_scaled 158 non-null int64 \n", " 25 plate_rock_plate 158 non-null int64 \n", " 26 plate_carbon_plate 158 non-null int64 \n", " 27 width_fit 158 non-null int64 \n", " 28 toebox_width 158 non-null int64 \n", " 29 stiffness_scaled 158 non-null int64 \n", " 30 torsional_rigidity 158 non-null int64 \n", " 31 heel_stiff 158 non-null int64 \n", " 32 lug_dept_mm 158 non-null float64\n", " 33 heel_lab_mm 158 non-null float64\n", " 34 heel_brand_mm 145 non-null float64\n", " 35 forefoot_lab_mm 158 non-null float64\n", " 36 forefoot_brand_mm 143 non-null float64\n", " 37 season_summer 158 non-null int64 \n", " 38 season_winter 158 non-null int64 \n", " 39 season_all 158 non-null int64 \n", " 40 removable_insole 158 non-null int64 \n", " 41 orthotic_friendly 158 non-null int64 \n", " 42 waterproof 158 non-null int64 \n", " 43 water_repellent 158 non-null int64 \n", "dtypes: float64(11), int64(31), str(2)\n", "memory usage: 54.4 KB\n" ] } ], "source": [ "df.drop(columns=[\"waterproofing\"], inplace=True)\n", "df.info()" ] }, { "cell_type": "markdown", "id": "4a88a6c8", "metadata": {}, "source": [ "# Finishing" ] }, { "cell_type": "code", "execution_count": 105, "id": "26dc1dc9", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 158 entries, 0 to 157\n", "Data columns (total 44 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 brand 158 non-null str \n", " 1 name 158 non-null str \n", " 2 lightweight 158 non-null int64 \n", " 3 terrain_light 158 non-null int64 \n", " 4 terrain_moderate 158 non-null int64 \n", " 5 terrain_technical 158 non-null int64 \n", " 6 shock_absorption 158 non-null int64 \n", " 7 energy_return 158 non-null int64 \n", " 8 traction_scaled 158 non-null int64 \n", " 9 arch_neutral 158 non-null int64 \n", " 10 arch_stability 158 non-null int64 \n", " 11 weight_lab_oz 158 non-null float64\n", " 12 weight_lab_g 158 non-null int64 \n", " 13 weight_brand_oz 155 non-null float64\n", " 14 weight_brand_g 155 non-null float64\n", " 15 drop_lab_mm 158 non-null float64\n", " 16 drop_brand_mm 152 non-null float64\n", " 17 strike_heel 158 non-null int64 \n", " 18 strike_mid 158 non-null int64 \n", " 19 strike_forefoot 158 non-null int64 \n", " 20 midsole_softness 158 non-null int64 \n", " 21 toebox_durability 158 non-null int64 \n", " 22 heel_durability 158 non-null int64 \n", " 23 outsole_durability 158 non-null int64 \n", " 24 breathability_scaled 158 non-null int64 \n", " 25 plate_rock_plate 158 non-null int64 \n", " 26 plate_carbon_plate 158 non-null int64 \n", " 27 width_fit 158 non-null int64 \n", " 28 toebox_width 158 non-null int64 \n", " 29 stiffness_scaled 158 non-null int64 \n", " 30 torsional_rigidity 158 non-null int64 \n", " 31 heel_stiff 158 non-null int64 \n", " 32 lug_dept_mm 158 non-null float64\n", " 33 heel_lab_mm 158 non-null float64\n", " 34 heel_brand_mm 145 non-null float64\n", " 35 forefoot_lab_mm 158 non-null float64\n", " 36 forefoot_brand_mm 143 non-null float64\n", " 37 season_summer 158 non-null int64 \n", " 38 season_winter 158 non-null int64 \n", " 39 season_all 158 non-null int64 \n", " 40 removable_insole 158 non-null int64 \n", " 41 orthotic_friendly 158 non-null int64 \n", " 42 waterproof 158 non-null int64 \n", " 43 water_repellent 158 non-null int64 \n", "dtypes: float64(10), int64(32), str(2)\n", "memory usage: 54.4 KB\n" ] } ], "source": [ "# change lightweight to int\n", "df['lightweight'] = df['lightweight'].fillna(0).astype(int)\n", "df.info()" ] }, { "cell_type": "code", "execution_count": 106, "id": "9b96e4f7", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 158 entries, 0 to 157\n", "Data columns (total 41 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 brand 158 non-null str \n", " 1 name 158 non-null str \n", " 2 lightweight 158 non-null int64 \n", " 3 terrain_light 158 non-null int64 \n", " 4 terrain_moderate 158 non-null int64 \n", " 5 terrain_technical 158 non-null int64 \n", " 6 shock_absorption 158 non-null int64 \n", " 7 energy_return 158 non-null int64 \n", " 8 traction_scaled 158 non-null int64 \n", " 9 arch_neutral 158 non-null int64 \n", " 10 arch_stability 158 non-null int64 \n", " 11 weight_lab_oz 158 non-null float64\n", " 12 drop_lab_mm 158 non-null float64\n", " 13 drop_brand_mm 152 non-null float64\n", " 14 strike_heel 158 non-null int64 \n", " 15 strike_mid 158 non-null int64 \n", " 16 strike_forefoot 158 non-null int64 \n", " 17 midsole_softness 158 non-null int64 \n", " 18 toebox_durability 158 non-null int64 \n", " 19 heel_durability 158 non-null int64 \n", " 20 outsole_durability 158 non-null int64 \n", " 21 breathability_scaled 158 non-null int64 \n", " 22 plate_rock_plate 158 non-null int64 \n", " 23 plate_carbon_plate 158 non-null int64 \n", " 24 width_fit 158 non-null int64 \n", " 25 toebox_width 158 non-null int64 \n", " 26 stiffness_scaled 158 non-null int64 \n", " 27 torsional_rigidity 158 non-null int64 \n", " 28 heel_stiff 158 non-null int64 \n", " 29 lug_dept_mm 158 non-null float64\n", " 30 heel_lab_mm 158 non-null float64\n", " 31 heel_brand_mm 145 non-null float64\n", " 32 forefoot_lab_mm 158 non-null float64\n", " 33 forefoot_brand_mm 143 non-null float64\n", " 34 season_summer 158 non-null int64 \n", " 35 season_winter 158 non-null int64 \n", " 36 season_all 158 non-null int64 \n", " 37 removable_insole 158 non-null int64 \n", " 38 orthotic_friendly 158 non-null int64 \n", " 39 waterproof 158 non-null int64 \n", " 40 water_repellent 158 non-null int64 \n", "dtypes: float64(8), int64(31), str(2)\n", "memory usage: 50.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": 107, "id": "40a900de", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 158 entries, 0 to 157\n", "Data columns (total 40 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 brand 158 non-null str \n", " 1 name 158 non-null str \n", " 2 lightweight 158 non-null int64 \n", " 3 terrain_light 158 non-null int64 \n", " 4 terrain_moderate 158 non-null int64 \n", " 5 terrain_technical 158 non-null int64 \n", " 6 shock_absorption 158 non-null int64 \n", " 7 energy_return 158 non-null int64 \n", " 8 traction_scaled 158 non-null int64 \n", " 9 arch_neutral 158 non-null int64 \n", " 10 arch_stability 158 non-null int64 \n", " 11 weight_lab_oz 158 non-null float64\n", " 12 drop_lab_mm 158 non-null float64\n", " 13 strike_heel 158 non-null int64 \n", " 14 strike_mid 158 non-null int64 \n", " 15 strike_forefoot 158 non-null int64 \n", " 16 midsole_softness 158 non-null int64 \n", " 17 toebox_durability 158 non-null int64 \n", " 18 heel_durability 158 non-null int64 \n", " 19 outsole_durability 158 non-null int64 \n", " 20 breathability_scaled 158 non-null int64 \n", " 21 plate_rock_plate 158 non-null int64 \n", " 22 plate_carbon_plate 158 non-null int64 \n", " 23 width_fit 158 non-null int64 \n", " 24 toebox_width 158 non-null int64 \n", " 25 stiffness_scaled 158 non-null int64 \n", " 26 torsional_rigidity 158 non-null int64 \n", " 27 heel_stiff 158 non-null int64 \n", " 28 lug_dept_mm 158 non-null float64\n", " 29 heel_lab_mm 158 non-null float64\n", " 30 heel_brand_mm 145 non-null float64\n", " 31 forefoot_lab_mm 158 non-null float64\n", " 32 forefoot_brand_mm 143 non-null float64\n", " 33 season_summer 158 non-null int64 \n", " 34 season_winter 158 non-null int64 \n", " 35 season_all 158 non-null int64 \n", " 36 removable_insole 158 non-null int64 \n", " 37 orthotic_friendly 158 non-null int64 \n", " 38 waterproof 158 non-null int64 \n", " 39 water_repellent 158 non-null int64 \n", "dtypes: float64(7), int64(31), str(2)\n", "memory usage: 49.5 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": 108, "id": "84034462", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 158 entries, 0 to 157\n", "Data columns (total 39 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 brand 158 non-null str \n", " 1 name 158 non-null str \n", " 2 lightweight 158 non-null int64 \n", " 3 terrain_light 158 non-null int64 \n", " 4 terrain_moderate 158 non-null int64 \n", " 5 terrain_technical 158 non-null int64 \n", " 6 shock_absorption 158 non-null int64 \n", " 7 energy_return 158 non-null int64 \n", " 8 traction_scaled 158 non-null int64 \n", " 9 arch_neutral 158 non-null int64 \n", " 10 arch_stability 158 non-null int64 \n", " 11 weight_lab_oz 158 non-null float64\n", " 12 drop_lab_mm 158 non-null float64\n", " 13 strike_heel 158 non-null int64 \n", " 14 strike_mid 158 non-null int64 \n", " 15 strike_forefoot 158 non-null int64 \n", " 16 midsole_softness 158 non-null int64 \n", " 17 toebox_durability 158 non-null int64 \n", " 18 heel_durability 158 non-null int64 \n", " 19 outsole_durability 158 non-null int64 \n", " 20 breathability_scaled 158 non-null int64 \n", " 21 plate_rock_plate 158 non-null int64 \n", " 22 plate_carbon_plate 158 non-null int64 \n", " 23 width_fit 158 non-null int64 \n", " 24 toebox_width 158 non-null int64 \n", " 25 stiffness_scaled 158 non-null int64 \n", " 26 torsional_rigidity 158 non-null int64 \n", " 27 heel_stiff 158 non-null int64 \n", " 28 lug_dept_mm 158 non-null float64\n", " 29 heel_lab_mm 158 non-null float64\n", " 30 forefoot_lab_mm 158 non-null float64\n", " 31 forefoot_brand_mm 143 non-null float64\n", " 32 season_summer 158 non-null int64 \n", " 33 season_winter 158 non-null int64 \n", " 34 season_all 158 non-null int64 \n", " 35 removable_insole 158 non-null int64 \n", " 36 orthotic_friendly 158 non-null int64 \n", " 37 waterproof 158 non-null int64 \n", " 38 water_repellent 158 non-null int64 \n", "dtypes: float64(6), int64(31), str(2)\n", "memory usage: 48.3 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": 109, "id": "becce231", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 158 entries, 0 to 157\n", "Data columns (total 38 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 brand 158 non-null str \n", " 1 name 158 non-null str \n", " 2 lightweight 158 non-null int64 \n", " 3 terrain_light 158 non-null int64 \n", " 4 terrain_moderate 158 non-null int64 \n", " 5 terrain_technical 158 non-null int64 \n", " 6 shock_absorption 158 non-null int64 \n", " 7 energy_return 158 non-null int64 \n", " 8 traction_scaled 158 non-null int64 \n", " 9 arch_neutral 158 non-null int64 \n", " 10 arch_stability 158 non-null int64 \n", " 11 weight_lab_oz 158 non-null float64\n", " 12 drop_lab_mm 158 non-null float64\n", " 13 strike_heel 158 non-null int64 \n", " 14 strike_mid 158 non-null int64 \n", " 15 strike_forefoot 158 non-null int64 \n", " 16 midsole_softness 158 non-null int64 \n", " 17 toebox_durability 158 non-null int64 \n", " 18 heel_durability 158 non-null int64 \n", " 19 outsole_durability 158 non-null int64 \n", " 20 breathability_scaled 158 non-null int64 \n", " 21 plate_rock_plate 158 non-null int64 \n", " 22 plate_carbon_plate 158 non-null int64 \n", " 23 width_fit 158 non-null int64 \n", " 24 toebox_width 158 non-null int64 \n", " 25 stiffness_scaled 158 non-null int64 \n", " 26 torsional_rigidity 158 non-null int64 \n", " 27 heel_stiff 158 non-null int64 \n", " 28 lug_dept_mm 158 non-null float64\n", " 29 heel_lab_mm 158 non-null float64\n", " 30 forefoot_lab_mm 158 non-null float64\n", " 31 season_summer 158 non-null int64 \n", " 32 season_winter 158 non-null int64 \n", " 33 season_all 158 non-null int64 \n", " 34 removable_insole 158 non-null int64 \n", " 35 orthotic_friendly 158 non-null int64 \n", " 36 waterproof 158 non-null int64 \n", " 37 water_repellent 158 non-null int64 \n", "dtypes: float64(5), int64(31), str(2)\n", "memory usage: 47.0 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": 110, "id": "4c936ab8", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 158 entries, 0 to 157\n", "Data columns (total 37 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 brand 158 non-null str \n", " 1 name 158 non-null str \n", " 2 lightweight 158 non-null int64 \n", " 3 terrain_light 158 non-null int64 \n", " 4 terrain_moderate 158 non-null int64 \n", " 5 terrain_technical 158 non-null int64 \n", " 6 shock_absorption 158 non-null int64 \n", " 7 energy_return 158 non-null int64 \n", " 8 traction_scaled 158 non-null int64 \n", " 9 arch_neutral 158 non-null int64 \n", " 10 arch_stability 158 non-null int64 \n", " 11 weight_lab_oz 158 non-null float64\n", " 12 drop_lab_mm 158 non-null float64\n", " 13 strike_heel 158 non-null int64 \n", " 14 strike_mid 158 non-null int64 \n", " 15 strike_forefoot 158 non-null int64 \n", " 16 midsole_softness 158 non-null int64 \n", " 17 toebox_durability 158 non-null int64 \n", " 18 heel_durability 158 non-null int64 \n", " 19 outsole_durability 158 non-null int64 \n", " 20 breathability_scaled 158 non-null int64 \n", " 21 plate_rock_plate 158 non-null int64 \n", " 22 plate_carbon_plate 158 non-null int64 \n", " 23 width_fit 158 non-null int64 \n", " 24 toebox_width 158 non-null int64 \n", " 25 stiffness_scaled 158 non-null int64 \n", " 26 torsional_rigidity 158 non-null int64 \n", " 27 heel_stiff 158 non-null int64 \n", " 28 lug_dept_mm 158 non-null float64\n", " 29 heel_lab_mm 158 non-null float64\n", " 30 forefoot_lab_mm 158 non-null float64\n", " 31 season_summer 158 non-null int64 \n", " 32 season_winter 158 non-null int64 \n", " 33 season_all 158 non-null int64 \n", " 34 removable_insole 158 non-null int64 \n", " 35 waterproof 158 non-null int64 \n", " 36 water_repellent 158 non-null int64 \n", "dtypes: float64(5), int64(30), str(2)\n", "memory usage: 45.8 KB\n" ] } ], "source": [ "# Only take removable_insole feature \n", "df.drop(columns='orthotic_friendly', inplace=True)\n", "df.info()" ] }, { "cell_type": "code", "execution_count": 111, "id": "5cc8f859", "metadata": {}, "outputs": [], "source": [ "df.to_csv('../../data/trail_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 }