Skip to content

Commit c7ba4f4

Browse files
committed
adjust DATA_PATH, use it in 02 and 04
1 parent fe3ab0d commit c7ba4f4

3 files changed

+9
-17
lines changed

02-supervised-learning.ipynb

+4-4
Original file line numberDiff line numberDiff line change
@@ -2290,8 +2290,8 @@
22902290
}
22912291
],
22922292
"source": [
2293-
"import pandas as pd\n",
2294-
"ram_prices = pd.read_csv(\"data/ram_price.csv\")\n",
2293+
"import os\n",
2294+
"ram_prices = pd.read_csv(os.path.join(mglearn.datasets.DATA_PATH, \"ram_price.csv\"))\n",
22952295
"\n",
22962296
"plt.semilogy(ram_prices.date, ram_prices.price)\n",
22972297
"plt.xlabel(\"Year\")\n",
@@ -4622,9 +4622,9 @@
46224622
],
46234623
"metadata": {
46244624
"kernelspec": {
4625-
"display_name": "Python [Root]",
4625+
"display_name": "Python [conda root]",
46264626
"language": "python",
4627-
"name": "Python [Root]"
4627+
"name": "conda-root-py"
46284628
},
46294629
"language_info": {
46304630
"codemirror_mode": {

04-representing-data-feature-engineering.ipynb

+4-12
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,6 @@
2727
"### Categorical Variables"
2828
]
2929
},
30-
{
31-
"cell_type": "markdown",
32-
"metadata": {},
33-
"source": [
34-
"\\begin{align*}\n",
35-
"\\end{align*}"
36-
]
37-
},
3830
{
3931
"cell_type": "markdown",
4032
"metadata": {},
@@ -142,11 +134,11 @@
142134
}
143135
],
144136
"source": [
145-
"import pandas as pd\n",
137+
"import os\n",
146138
"# The file has no headers naming the columns, so we pass header=None\n",
147139
"# and provide the column names explicitly in \"names\"\n",
148140
"data = pd.read_csv(\n",
149-
" \"data/adult.data\", header=None, index_col=False,\n",
141+
" os.path.join(mglearn.datasets.DATA_FOLDER, \"adult.data\"), header=None, index_col=False,\n",
150142
" names=['age', 'workclass', 'fnlwgt', 'education', 'education-num',\n",
151143
" 'marital-status', 'occupation', 'relationship', 'race', 'gender',\n",
152144
" 'capital-gain', 'capital-loss', 'hours-per-week', 'native-country',\n",
@@ -2133,9 +2125,9 @@
21332125
"metadata": {
21342126
"anaconda-cloud": {},
21352127
"kernelspec": {
2136-
"display_name": "Python [Root]",
2128+
"display_name": "Python [conda root]",
21372129
"language": "python",
2138-
"name": "Python [Root]"
2130+
"name": "conda-root-py"
21392131
},
21402132
"language_info": {
21412133
"codemirror_mode": {

mglearn/datasets.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from sklearn.preprocessing import MinMaxScaler, PolynomialFeatures
77
from .make_blobs import make_blobs
88

9-
DATA_FOLDER = os.path.join(os.path.dirname(__file__), "data")
9+
DATA_FOLDER = os.path.join(os.path.dirname(__file__), "..", "data")
1010

1111

1212
def make_forge():

0 commit comments

Comments
 (0)