From c609433b71154cc2a4ef092baaf51430812a4522 Mon Sep 17 00:00:00 2001 From: kellywujy Date: Sat, 28 Jan 2023 21:05:29 -0800 Subject: [PATCH] docs: Usage format fixed --- docs/example.ipynb | 302 +++++++-------------------------------------- 1 file changed, 43 insertions(+), 259 deletions(-) diff --git a/docs/example.ipynb b/docs/example.ipynb index d3e6678..77a4386 100644 --- a/docs/example.ipynb +++ b/docs/example.ipynb @@ -24,7 +24,6 @@ ], "source": [ "import mercedestrenz\n", - "\n", "print(mercedestrenz.__version__)" ] }, @@ -64,177 +63,40 @@ "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", - "
price_USDconditionpaint_colormodelodometer_miyearnum_cylindersfueltransmissiondrivesizetypestateVINtitle_statusdescription
01300usedNaNother12774.01969NaNgasautomaticNaNNaNNaNalNaNcleanCar has been sitting and everything is still o...
14000fairsilverother88100.019726gasautomaticrwdfull-sizecoupeal11402312009097cleanMercedes Benz 250c 1972. Runs and drives fine...
229500like newwhiteother18000.02018NaNgasmanualNaNNaNsedanalNaNcleanLike new, one owner, non smoker, garage kept. ...
3800fairsilverother150000.019976dieselautomaticrwdfull-sizesedanalNaNparts only1997 Mercedes E300 Diesel runs and drives need...
44500usedNaNother60000.02014NaNgasautomaticNaNNaNNaNakNaNclean2014 Mercedes GLK350 Awd 60k miles all options...
\n", - "
" - ], - "text/plain": [ - " price_USD condition paint_color model odometer_mi year num_cylinders \\\n", - "0 1300 used NaN other 12774.0 1969 NaN \n", - "1 4000 fair silver other 88100.0 1972 6 \n", - "2 29500 like new white other 18000.0 2018 NaN \n", - "3 800 fair silver other 150000.0 1997 6 \n", - "4 4500 used NaN other 60000.0 2014 NaN \n", - "\n", - " fuel transmission drive size type state VIN \\\n", - "0 gas automatic NaN NaN NaN al NaN \n", - "1 gas automatic rwd full-size coupe al 11402312009097 \n", - "2 gas manual NaN NaN sedan al NaN \n", - "3 diesel automatic rwd full-size sedan al NaN \n", - "4 gas automatic NaN NaN NaN ak NaN \n", - "\n", - " title_status description \n", - "0 clean Car has been sitting and everything is still o... \n", - "1 clean Mercedes Benz 250c 1972. Runs and drives fine... \n", - "2 clean Like new, one owner, non smoker, garage kept. ... \n", - "3 parts only 1997 Mercedes E300 Diesel runs and drives need... \n", - "4 clean 2014 Mercedes GLK350 Awd 60k miles all options... " - ] - }, - "execution_count": 3, - "metadata": {}, - "output_type": "execute_result" + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "Int64Index: 8553 entries, 0 to 8552\n", + "Data columns (total 16 columns):\n", + " # Column Non-Null Count Dtype \n", + "--- ------ -------------- ----- \n", + " 0 price_USD 8553 non-null int64 \n", + " 1 condition 8553 non-null object \n", + " 2 paint_color 6820 non-null object \n", + " 3 model 8553 non-null object \n", + " 4 odometer_mi 8403 non-null float64\n", + " 5 year 8553 non-null int64 \n", + " 6 num_cylinders 4753 non-null object \n", + " 7 fuel 8547 non-null object \n", + " 8 transmission 8522 non-null object \n", + " 9 drive 5042 non-null object \n", + " 10 size 3013 non-null object \n", + " 11 type 7564 non-null object \n", + " 12 state 8553 non-null object \n", + " 13 VIN 5545 non-null object \n", + " 14 title_status 8458 non-null object \n", + " 15 description 8553 non-null object \n", + "dtypes: float64(1), int64(2), object(13)\n", + "memory usage: 1.1+ MB\n" + ] } ], "source": [ "\n", "# Load the sample mercedes listings data into a dataframe\n", "data = load_sample_mercedes_listings()\n", - "data.head()\n" + "data.info()\n" ] }, { @@ -277,19 +139,8 @@ " price_USD\n", " model\n", " odometer_mi\n", - " title_status\n", - " condition\n", - " num_cylinders\n", - " type\n", - " VIN\n", - " paint_color\n", " transmission\n", - " year\n", - " state\n", - " description\n", - " drive\n", - " fuel\n", - " size\n", + " paint_color\n", " \n", " \n", " \n", @@ -298,18 +149,7 @@ " 4999\n", " c-class\n", " 0.0\n", - " clean\n", - " excellent\n", - " NaN\n", - " NaN\n", - " WDBRN40JX4A552306\n", - " NaN\n", " automatic\n", - " 2004\n", - " mn\n", - " 2004 *** Mercedes-Benz C-Class C 230 Kompresso...\n", - " rwd\n", - " gas\n", " NaN\n", " \n", " \n", @@ -317,18 +157,7 @@ " 4999\n", " c-class\n", " 0.0\n", - " clean\n", - " excellent\n", - " NaN\n", - " NaN\n", - " WDBRN40JX4A552306\n", - " NaN\n", " automatic\n", - " 2004\n", - " mn\n", - " 2004 *** Mercedes-Benz C-Class C 230 Kompresso...\n", - " rwd\n", - " gas\n", " NaN\n", " \n", " \n", @@ -336,83 +165,36 @@ " 11900\n", " m-class\n", " 0.0\n", - " clean\n", - " excellent\n", - " 6\n", - " wagon\n", - " 4JGBB5GB9BA705850\n", - " white\n", " automatic\n", - " 2011\n", - " ca\n", - " 2011 Mercedes-Benz M-Class RWD 4dr ML 350 - $1...\n", - " fwd\n", - " gas\n", - " NaN\n", + " white\n", " \n", " \n", " 690\n", " 11900\n", " m-class\n", " 0.0\n", - " clean\n", - " excellent\n", - " 6\n", - " wagon\n", - " 4JGBB5GB9BA705850\n", - " white\n", " automatic\n", - " 2011\n", - " ca\n", - " 2011 Mercedes-Benz M-Class RWD 4dr ML 350 - $1...\n", - " fwd\n", - " gas\n", - " NaN\n", + " white\n", " \n", " \n", " 699\n", " 11900\n", " m-class\n", " 0.0\n", - " clean\n", - " excellent\n", - " 6\n", - " wagon\n", - " 4JGBB5GB9BA705850\n", - " white\n", " automatic\n", - " 2011\n", - " ca\n", - " 2011 Mercedes-Benz M-Class RWD 4dr ML 350 - $1...\n", - " fwd\n", - " gas\n", - " NaN\n", + " white\n", " \n", " \n", "\n", "" ], "text/plain": [ - " price_USD model odometer_mi title_status condition num_cylinders \\\n", - "2493 4999 c-class 0.0 clean excellent NaN \n", - "2494 4999 c-class 0.0 clean excellent NaN \n", - "686 11900 m-class 0.0 clean excellent 6 \n", - "690 11900 m-class 0.0 clean excellent 6 \n", - "699 11900 m-class 0.0 clean excellent 6 \n", - "\n", - " type VIN paint_color transmission year state \\\n", - "2493 NaN WDBRN40JX4A552306 NaN automatic 2004 mn \n", - "2494 NaN WDBRN40JX4A552306 NaN automatic 2004 mn \n", - "686 wagon 4JGBB5GB9BA705850 white automatic 2011 ca \n", - "690 wagon 4JGBB5GB9BA705850 white automatic 2011 ca \n", - "699 wagon 4JGBB5GB9BA705850 white automatic 2011 ca \n", - "\n", - " description drive fuel size \n", - "2493 2004 *** Mercedes-Benz C-Class C 230 Kompresso... rwd gas NaN \n", - "2494 2004 *** Mercedes-Benz C-Class C 230 Kompresso... rwd gas NaN \n", - "686 2011 Mercedes-Benz M-Class RWD 4dr ML 350 - $1... fwd gas NaN \n", - "690 2011 Mercedes-Benz M-Class RWD 4dr ML 350 - $1... fwd gas NaN \n", - "699 2011 Mercedes-Benz M-Class RWD 4dr ML 350 - $1... fwd gas NaN " + " price_USD model odometer_mi transmission paint_color\n", + "2493 4999 c-class 0.0 automatic NaN\n", + "2494 4999 c-class 0.0 automatic NaN\n", + "686 11900 m-class 0.0 automatic white\n", + "690 11900 m-class 0.0 automatic white\n", + "699 11900 m-class 0.0 automatic white" ] }, "execution_count": 4, @@ -422,9 +204,10 @@ ], "source": [ "\n", - "# Return the top listings that are within a budget range specified by the user. Returns a pandas dataframe of results.\n", + "# Return the top listings that are within a budget range specified by the user. \n", + "# Returns a pandas dataframe of results.\n", "listings = listing_search(data, budget=[2000, 20000], model = \"any\", sort_feature = \"odometer_mi\", ascending = True)\n", - "listings.head()\n" + "listings.head().iloc[:, 0:5]\n" ] }, { @@ -519,7 +302,8 @@ ], "source": [ "\n", - "# Plot a price distribution of specific mercedes models, and see where an input price falls in the distribution.\n", + "# Plot a price distribution of specific mercedes models, \n", + "# and see where an input price falls in the distribution.\n", "plot_mercedes_price(model='c-class', price=30000, market_df=data)\n" ] },